Merge pull request #1126 from donpdonp/19444

19444 manage the window title, watch for username changes
This commit is contained in:
Stephen Birarda 2013-10-25 13:59:38 -07:00
commit 99ee614d04
3 changed files with 20 additions and 4 deletions

View file

@ -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");
@ -533,6 +533,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,
@ -3790,13 +3791,25 @@ 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);
// 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();
}

View file

@ -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);

View file

@ -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);
}