This commit is contained in:
Andrzej Kapolka 2014-05-27 12:31:12 -07:00
commit 3f478b1939
3 changed files with 42 additions and 29 deletions

View file

@ -172,7 +172,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_nodeBoundsDisplay(this),
_previousScriptLocation(),
_runningScriptsWidget(new RunningScriptsWidget(_window)),
_runningScriptsWidgetWasVisible(false)
_runningScriptsWidgetWasVisible(false),
_trayIcon(new QSystemTrayIcon(_window))
{
// read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
@ -391,6 +392,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
OAuthWebViewHandler::getInstance();
// make sure the High Fidelity root CA is in our list of trusted certs
OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig();
_trayIcon->show();
}
Application::~Application() {

View file

@ -28,6 +28,7 @@
#include <QHash>
#include <QTouchEvent>
#include <QUndoStack>
#include <QSystemTrayIcon>
#include <ModelEditPacketSender.h>
#include <NetworkPacket.h>
@ -203,6 +204,7 @@ public:
JoystickManager* getJoystickManager() { return &_joystickManager; }
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
QUndoStack* getUndoStack() { return &_undoStack; }
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
/// if you need to access the application settings, use lockSettings()/unlockSettings()
QSettings* lockSettings() { _settingsMutex.lock(); return _settings; }
@ -555,6 +557,8 @@ private:
RunningScriptsWidget* _runningScriptsWidget;
QHash<QString, ScriptEngine*> _scriptEnginesHash;
bool _runningScriptsWidgetWasVisible;
QSystemTrayIcon* _trayIcon;
};
#endif // hifi_Application_h

View file

@ -34,6 +34,7 @@
#include <UUID.h>
#include "Application.h"
#include "AccountManager.h"
#include "Menu.h"
#include "scripting/MenuScriptingInterface.h"
#include "Util.h"
@ -1202,19 +1203,24 @@ void Menu::showScriptEditor() {
}
void Menu::showChat() {
if (AccountManager::getInstance().isLoggedIn()) {
QMainWindow* mainWindow = Application::getInstance()->getWindow();
if (!_chatWindow) {
_chatWindow = new ChatWindow(mainWindow);
}
if (_chatWindow->isHidden()) {
_chatWindow->show();
}
} else {
Application::getInstance()->getTrayIcon()->showMessage("Interface", "You need to login to be able to chat with others on this domain.");
}
}
void Menu::toggleChat() {
#ifdef HAVE_QXMPP
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
if (!_chatAction->isEnabled() && _chatWindow) {
if (!_chatAction->isEnabled() && _chatWindow && AccountManager::getInstance().isLoggedIn()) {
if (_chatWindow->isHidden()) {
_chatWindow->show();
} else {