From 17bd58dd79925698b5a4644bf903d055c0a4f492 Mon Sep 17 00:00:00 2001 From: Iris Morelle Date: Thu, 29 Feb 2024 20:20:26 -0300 Subject: [PATCH] gui/addon_manager: Show server identification after the address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables the client to show the [server_id] info (for 1.16+ campaignd instances that provide the relevant fields) in the UI so the user can more easily know which instance they are connected to in case they do not handle that information directly themselves (e.g. when entering a port number of their own). The server info shown in the bottom left is changed from " " to add "— ()" right after it, with the server version in parentheses being included only if debug mode is enabled to avoid redundancy or confusing values (such as "wesnoth.org — 1.18 (1.17.19+dev)"). --- changelog_entries/addon_server_id_ui.md | 3 +++ src/gui/dialogs/addon/manager.cpp | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelog_entries/addon_server_id_ui.md diff --git a/changelog_entries/addon_server_id_ui.md b/changelog_entries/addon_server_id_ui.md new file mode 100644 index 00000000000..6341e7c1ce5 --- /dev/null +++ b/changelog_entries/addon_server_id_ui.md @@ -0,0 +1,3 @@ + ### Add-ons client + * The add-ons server identifier (e.g. 1.18) is now displayed on the bottom left after the + server address. If debug mode is enabled the server software version is also shown. diff --git a/src/gui/dialogs/addon/manager.cpp b/src/gui/dialogs/addon/manager.cpp index af28d106ed1..cf077b8eb22 100644 --- a/src/gui/dialogs/addon/manager.cpp +++ b/src/gui/dialogs/addon/manager.cpp @@ -325,7 +325,18 @@ void addon_manager::pre_show(window& window) if(addr_visible) { auto addr_box = dynamic_cast(addr_visible->find("server_addr", false)); if(addr_box) { - addr_box->set_label(client_.addr()); + if(!client_.server_id().empty()) { + auto full_id = formatter() + << client_.addr() << ' ' + << font::unicode_em_dash << ' ' + << client_.server_id(); + if(game_config::debug && !client_.server_version().empty()) { + full_id << " (" << client_.server_version() << ')'; + } + addr_box->set_label(full_id.str()); + } else { + addr_box->set_label(client_.addr()); + } } }