Parcourir la source

Merge pull request #3718 from IvanSavenko/lobby_tweaks_3

Few more tweaks for new lobby
Ivan Savenko il y a 1 an
Parent
commit
4bef4d9277

+ 1 - 1
client/globalLobby/GlobalLobbyClient.cpp

@@ -141,7 +141,7 @@ void GlobalLobbyClient::receiveChatHistory(const JsonNode & json)
 
 		chatHistory[channelKey].push_back(message);
 
-		if(lobbyWindowPtr)
+		if(lobbyWindowPtr && lobbyWindowPtr->isChannelOpen(channelType, channelName))
 			lobbyWindowPtr->onGameChatMessage(message.displayName, message.messageText, message.timeFormatted, channelType, channelName);
 	}
 }

+ 2 - 1
client/globalLobby/GlobalLobbyLoginWindow.cpp

@@ -38,7 +38,7 @@ GlobalLobbyLoginWindow::GlobalLobbyLoginWindow()
 
 	MetaString loginAs;
 	loginAs.appendTextID("vcmi.lobby.login.as");
-	loginAs.replaceTextID(CSH->getGlobalLobby().getAccountDisplayName());
+	loginAs.replaceRawString(CSH->getGlobalLobby().getAccountDisplayName());
 
 	filledBackground = std::make_shared<FilledTexturePlayerColored>(ImagePath::builtin("DiBoxBck"), Rect(0, 0, pos.w, pos.h));
 	labelTitle = std::make_shared<CLabel>( pos.w / 2, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->translate("vcmi.lobby.login.title"));
@@ -65,6 +65,7 @@ GlobalLobbyLoginWindow::GlobalLobbyLoginWindow()
 	{
 		buttonLogin->block(true);
 		toggleMode->setSelected(0);
+		onLoginModeChanged(0); // call it manually to disable widgets - toggleMode will not emit this call if this is currenly selected option
 	}
 	else
 		toggleMode->setSelected(1);

+ 1 - 0
client/globalLobby/GlobalLobbyWindow.cpp

@@ -64,6 +64,7 @@ void GlobalLobbyWindow::doOpenChannel(const std::string & channelType, const std
 	widget->getGameChatHeader()->setText(text.toString());
 
 	// Update currently selected item in UI
+	// WARNING: this invalidates function parameters since some of them are members of objects that will be destroyed by reset
 	widget->getAccountList()->reset();
 	widget->getChannelList()->reset();
 	widget->getMatchList()->reset();

+ 1 - 1
lobby/LobbyDatabase.cpp

@@ -288,7 +288,7 @@ void LobbyDatabase::prepareStatements()
 	isAccountNameExistsStatement = database->prepare(R"(
 		SELECT COUNT(displayName)
 		FROM accounts
-		WHERE displayName = ?
+		WHERE displayName = ? COLLATE NOCASE
 	)");
 }