From dc420beaf2cc4901309d0ba65a2dd61ef64fcc6e Mon Sep 17 00:00:00 2001 From: Don Park Date: Fri, 25 Oct 2013 10:09:34 -0700 Subject: [PATCH 1/3] updateWindowTitle() --- interface/src/Application.cpp | 13 +++++++++++++ interface/src/Application.h | 1 + 2 files changed, 14 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9b66b80c4c..67caadcd44 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3791,6 +3791,19 @@ void Application::attachNewHeadToNode(Node* newNode) { } } +void Application::updateWindowTitle(){ + QString title = ""; + QString username = _profile.getUsername(); + if(!username.isEmpty()){ + title += _profile.getUsername(); + title += " @ "; + } + title += _profile.getLastDomain(); + + qDebug("Application title set to: %s.\n", title.toStdString().c_str()); + _window->setWindowTitle(title); +} + void Application::domainChanged(QString domain) { qDebug("Application title set to: %s.\n", domain.toStdString().c_str()); _window->setWindowTitle(domain); diff --git a/interface/src/Application.h b/interface/src/Application.h index 6118bfb8b3..3333de3d7a 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -206,6 +206,7 @@ private: void initDisplay(); void init(); + void updateWindowTitle(); void update(float deltaTime); From 248f59325cb6c0a40a04c1333434f94b085e2cac Mon Sep 17 00:00:00 2001 From: Don Park Date: Fri, 25 Oct 2013 11:05:50 -0700 Subject: [PATCH 2/3] update the window title when the domain changes or the username changes --- interface/src/Application.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 67caadcd44..4399895999 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -194,7 +194,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : // call Menu getInstance static method to set up the menu _window->setMenuBar(Menu::getInstance()); - + // Check to see if the user passed in a command line option for loading a local // Voxel File. _voxelsFilename = getCmdOption(argc, constArgv, "-i"); @@ -534,6 +534,7 @@ void Application::resetProfile(const QString& username) { // call the destructor on the old profile and construct a new one (&_profile)->~Profile(); new (&_profile) Profile(username); + updateWindowTitle(); } void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes, @@ -3805,12 +3806,11 @@ void Application::updateWindowTitle(){ } void Application::domainChanged(QString domain) { - qDebug("Application title set to: %s.\n", domain.toStdString().c_str()); - _window->setWindowTitle(domain); - // update the user's last domain in their Profile (which will propagate to data-server) _profile.updateDomain(domain); + updateWindowTitle(); + // reset the environment so that we don't erroneously end up with multiple _environment.resetToDefault(); } From e44b0af9b6f2f74c937bd79083dd943084306735 Mon Sep 17 00:00:00 2001 From: Don Park Date: Fri, 25 Oct 2013 11:36:50 -0700 Subject: [PATCH 3/3] make updateWindowTitle public, call it after Menu loads data into the Profile --- interface/src/Application.h | 3 ++- interface/src/Menu.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 3333de3d7a..fb258f0353 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -109,6 +109,8 @@ public: void touchEndEvent(QTouchEvent* event); void touchUpdateEvent(QTouchEvent* event); + void updateWindowTitle(); + void wheelEvent(QWheelEvent* event); const glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel); @@ -206,7 +208,6 @@ private: void initDisplay(); void init(); - void updateWindowTitle(); void update(float deltaTime); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 1775c250f1..a31ff61ae8 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -532,6 +532,7 @@ void Menu::loadSettings(QSettings* settings) { Application::getInstance()->getAvatar()->loadData(settings); Application::getInstance()->getSwatch()->loadData(settings); Application::getInstance()->getProfile()->loadData(settings); + Application::getInstance()->updateWindowTitle(); NodeList::getInstance()->loadData(settings); }