From 92ea5a89fba49c02ac830b802c923ed8bb12498b Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sat, 21 Jan 2023 22:05:42 +0100 Subject: [PATCH] Don't update the chat completion list with every new message This caused performance issues when connecting. Instead, update the list whenever the chat input gets focus (so never if it's never used). --- client/chatline.cpp | 276 ++++++++++++++++++++------------------------ client/chatline.h | 15 +-- 2 files changed, 131 insertions(+), 160 deletions(-) diff --git a/client/chatline.cpp b/client/chatline.cpp index e5634703af..5ab8a1f023 100644 --- a/client/chatline.cpp +++ b/client/chatline.cpp @@ -45,7 +45,6 @@ static bool is_plain_public_message(const QString &s); FC_CPP_DECLARE_LISTENER(chat_listener) QStringList chat_listener::history = QStringList(); -QStringList chat_listener::word_list = QStringList(); namespace { @@ -61,140 +60,6 @@ void set_chat_colors(const QHash &colors) color_mapping = colors; } -/** - * Updates the chat completion word list. - */ -void chat_listener::update_word_list() -{ - QString str; - static QStringList server_commands; - - word_list.clear(); - - // sourced from server/commands.cpp - server_commands << "/start"; - server_commands << "/help"; - server_commands << "/list colors"; - server_commands << "/list connections"; - server_commands << "/list delegations"; - server_commands << "/list ignored users"; - server_commands << "/list map image definitions"; - server_commands << "/list players"; - server_commands << "/list rulesets"; - server_commands << "/list scenarios"; - server_commands << "/list nationsets"; - server_commands << "/list teams"; - server_commands << "/list votes"; - server_commands << "/quit"; - server_commands << "/cut "; - server_commands << "/explain "; - server_commands << "/show "; - server_commands << "/show all"; - server_commands << "/show vital"; - server_commands << "/show situational"; - server_commands << "/show rare"; - server_commands << "/show changed"; - server_commands << "/show locked"; - server_commands << "/show rulesetdir"; - server_commands << "/wall "; - server_commands << "/connectmsg "; - server_commands << "/vote yes|no|abstain [vote number]"; - server_commands << "/debug diplomacy "; - server_commands << "/debug ferries"; - server_commands << "/debug tech "; - server_commands << "/debug city "; - server_commands << "/debug units "; - server_commands << "/debug unit "; - server_commands << "/debug timing"; - server_commands << "/debug info"; - server_commands << "/set "; - server_commands << "/team "; - server_commands << "/rulesetdir "; - server_commands << "/metamessage "; - server_commands << "/metapatches "; - server_commands << "/metaconnection up|down|?"; - server_commands << "/metaserver
"; - server_commands << "/aitoggle "; - server_commands << "/take "; - server_commands << "/observe "; - server_commands << "/detach "; - server_commands << "/create [ai type]"; - server_commands << "/away"; - server_commands << "/handicapped "; - server_commands << "/novice "; - server_commands << "/easy "; - server_commands << "/normal "; - server_commands << "/hard "; - server_commands << "/cheating "; - server_commands << "/experimental "; - server_commands << "/cmdlevel none|info|basic|ctrl|admin|hack"; - server_commands << "/first"; - server_commands << "/timeoutshow"; - server_commands << "/timeoutset