gui/addon_manager: Show server identification after the address
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 "<encryption status> <server address>" to add "— <server id> (<server version>)" 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)").
This commit is contained in:
parent
597a64701c
commit
17bd58dd79
2 changed files with 15 additions and 1 deletions
3
changelog_entries/addon_server_id_ui.md
Normal file
3
changelog_entries/addon_server_id_ui.md
Normal file
|
@ -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.
|
|
@ -325,7 +325,18 @@ void addon_manager::pre_show(window& window)
|
|||
if(addr_visible) {
|
||||
auto addr_box = dynamic_cast<styled_widget*>(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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue