aboutsummaryrefslogtreecommitdiff
path: root/src/lobby.cpp
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2025-01-14 02:31:36 -0600
committerGitHub <noreply@github.com>2025-01-14 02:31:36 -0600
commit764b2f8944ef4d40a3829c1e55112b0cb4ff32fe (patch)
tree76db40f16c2e290ca8df7aff27597b6509f28e4f /src/lobby.cpp
parented8bc457351005b8590de5a70f8004edcf1635c1 (diff)
parenta9e2ea19508ceb120fbe8a570d35e651c15f819a (diff)
Merge pull request #1067 from AttorneyOnline/cleanup
Very cool and professional cleanup of clazy warnings
Diffstat (limited to 'src/lobby.cpp')
-rw-r--r--src/lobby.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lobby.cpp b/src/lobby.cpp
index f19845fa..5e98b757 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -466,7 +466,7 @@ void Lobby::list_servers()
ui_serverlist_search->setText("");
int i = 0;
- for (const ServerInfo &i_server : qAsConst(ao_app->get_server_list()))
+ for (const ServerInfo &i_server : std::as_const(ao_app->get_server_list()))
{
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_serverlist_tree);
treeItem->setData(0, Qt::DisplayRole, i);
@@ -563,11 +563,13 @@ void Lobby::check_for_updates()
QVersionNumber current_version = QVersionNumber::fromString(ao_app->get_version_string());
QVersionNumber master_version = QVersionNumber::fromString(version);
+ static QRegularExpression regexp_links("\\b(https?://\\S+\\.\\S+)\\b");
+
if (current_version < master_version)
{
ui_game_version_lbl->setText(tr("Version: %1 [OUTDATED]").arg(current_version.toString()));
setWindowTitle(tr("[Your client is outdated]"));
- const QString download_url = QString("https://github.com/AttorneyOnline/AO2-Client/releases/latest").replace(QRegularExpression("\\b(https?://\\S+\\.\\S+)\\b"), "<a href='\\1'>\\1</a>");
+ const QString download_url = QString("https://github.com/AttorneyOnline/AO2-Client/releases/latest").replace(regexp_links, "<a href='\\1'>\\1</a>");
const QString message = QString("Your client is outdated!<br>Your Version: %1<br>Current Version: %2<br>Download the latest version at<br>%3").arg(current_version.toString(), master_version.toString(), download_url);
QMessageBox::warning(this, "Your client is outdated!", message);
}
@@ -583,7 +585,8 @@ void Lobby::set_player_count(int players_online, int max_players)
void Lobby::set_server_description(const QString &server_description)
{
ui_server_description_text->clear();
- QString result = server_description.toHtmlEscaped().replace("\n", "<br>").replace(QRegularExpression("\\b(https?://\\S+\\.\\S+)\\b"), "<a href='\\1'>\\1</a>");
+ static QRegularExpression regexp_links("\\b(https?://\\S+\\.\\S+)\\b");
+ QString result = server_description.toHtmlEscaped().replace("\n", "<br>").replace(regexp_links, "<a href='\\1'>\\1</a>");
ui_server_description_text->insertHtml(result);
}