diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-09 21:05:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-09 21:05:11 +0300 |
commit | c175949a70a621a246df04a7824267a59299136b (patch) | |
tree | 988feb528c421dbc69eabbb1cc4fc03c97912cd6 | |
parent | 76a67b908156124490210db74832f34d3ab3652e (diff) | |
download | manaplus-c175949a70a621a246df04a7824267a59299136b.tar.gz manaplus-c175949a70a621a246df04a7824267a59299136b.tar.bz2 manaplus-c175949a70a621a246df04a7824267a59299136b.tar.xz manaplus-c175949a70a621a246df04a7824267a59299136b.zip |
Show player login in window title.
-rw-r--r-- | src/client.cpp | 10 | ||||
-rw-r--r-- | src/gui/windowmanager.cpp | 6 | ||||
-rw-r--r-- | src/settings.h | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/client.cpp b/src/client.cpp index ccc64b30f..c027aae9e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -775,7 +775,6 @@ void Client::stateConnectServer1() settings.persistentIp = mCurrentServer.persistentIp; settings.supportUrl = mCurrentServer.supportUrl; settings.updateMirrors = mCurrentServer.updateMirrors; - WindowManager::updateTitle(); if (settings.options.username.empty()) { @@ -788,6 +787,8 @@ void Client::stateConnectServer1() { loginData.username = settings.options.username; } + settings.login = loginData.username; + WindowManager::updateTitle(); loginData.remember = serverConfig.getValue("remember", 1); Net::connectToServer(mCurrentServer); @@ -1086,7 +1087,7 @@ int Client::gameExec() CREATEWIDGETV(mCurrentDialog, ConnectionDialog, // TRANSLATORS: connection dialog header _("Connecting to server"), - State::SWITCH_SERVER); + State::SWITCH_SERVER); TranslationManager::loadCurrentLang(); BLOCK_END("Client::gameExec State::CONNECT_SERVER") break; @@ -1619,6 +1620,7 @@ int Client::gameExec() gameHandler->clear(); } settings.serverName.clear(); + settings.login.clear(); WindowManager::updateTitle(); serverConfig.write(); serverConfig.unload(); @@ -1643,6 +1645,8 @@ int Client::gameExec() if (loginHandler) loginHandler->connect(); + settings.login.clear(); + WindowManager::updateTitle(); mState = State::LOGIN; BLOCK_END("Client::gameExec State::SWITCH_LOGIN") break; @@ -1655,6 +1659,8 @@ int Client::gameExec() if (gameHandler) gameHandler->disconnect(); + settings.login.clear(); + WindowManager::updateTitle(); mState = State::GET_CHARACTERS; BLOCK_END("Client::gameExec State::SWITCH_CHARACTER") break; diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 822b3b3e9..479c8d2ca 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -165,7 +165,11 @@ void WindowManager::initTitle() void WindowManager::updateTitle() { - const std::string str = settings.serverName; + std::string str; + if (settings.login.empty()) + str = settings.serverName; + else + str.append(settings.login).append(" ").append(settings.serverName); if (str.empty()) { settings.windowCaption = strprintf("%s %s", diff --git a/src/settings.h b/src/settings.h index 50a8cb51c..f9df412e0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -36,6 +36,7 @@ class Settings final updateHost(), oldUpdates(), updatesDir(), + login(), configDir(), localDataDir(), tempDir(), @@ -85,6 +86,7 @@ class Settings final { } std::string updateHost; + std::string login; std::string oldUpdates; std::string updatesDir; std::string configDir; |