Merge pull request #2929 from binaryking/19674

Code Review for Job #19674
This commit is contained in:
Brad Hefta-Gaub 2014-05-27 11:58:23 -07:00
commit ee66d87bec
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), _nodeBoundsDisplay(this),
_previousScriptLocation(), _previousScriptLocation(),
_runningScriptsWidget(new RunningScriptsWidget(_window)), _runningScriptsWidget(new RunningScriptsWidget(_window)),
_runningScriptsWidgetWasVisible(false) _runningScriptsWidgetWasVisible(false),
_trayIcon(new QSystemTrayIcon(_window))
{ {
// read the ApplicationInfo.ini file for Name/Version/Domain information // read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
@ -391,6 +392,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
OAuthWebViewHandler::getInstance(); OAuthWebViewHandler::getInstance();
// make sure the High Fidelity root CA is in our list of trusted certs // make sure the High Fidelity root CA is in our list of trusted certs
OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig(); OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig();
_trayIcon->show();
} }
Application::~Application() { Application::~Application() {

View file

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

View file

@ -34,6 +34,7 @@
#include <UUID.h> #include <UUID.h>
#include "Application.h" #include "Application.h"
#include "AccountManager.h"
#include "Menu.h" #include "Menu.h"
#include "scripting/MenuScriptingInterface.h" #include "scripting/MenuScriptingInterface.h"
#include "Util.h" #include "Util.h"
@ -1201,19 +1202,24 @@ void Menu::showScriptEditor() {
} }
void Menu::showChat() { void Menu::showChat() {
if (AccountManager::getInstance().isLoggedIn()) {
QMainWindow* mainWindow = Application::getInstance()->getWindow(); QMainWindow* mainWindow = Application::getInstance()->getWindow();
if (!_chatWindow) { if (!_chatWindow) {
_chatWindow = new ChatWindow(mainWindow); _chatWindow = new ChatWindow(mainWindow);
} }
if (_chatWindow->isHidden()) { if (_chatWindow->isHidden()) {
_chatWindow->show(); _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() { void Menu::toggleChat() {
#ifdef HAVE_QXMPP #ifdef HAVE_QXMPP
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected()); _chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
if (!_chatAction->isEnabled() && _chatWindow) { if (!_chatAction->isEnabled() && _chatWindow && AccountManager::getInstance().isLoggedIn()) {
if (_chatWindow->isHidden()) { if (_chatWindow->isHidden()) {
_chatWindow->show(); _chatWindow->show();
} else { } else {