gui2/game_load: Improve display of old versions selection

* Return paths from fs API in the native format, not the generic
   format. The generic format looks wholly out of place on Windows.

 * Move the versions selector to the row with the dialog caption and
   Search box as per d53ca602b8.

 * Relabel options to make the purpose of the combobox clearer even
   without the tooltip.

 * Fix markup not being taken into account for the combobox option
   labels, and protect against potential markup characters in paths
   (shouldn't happen on Windows but it can happen on POSIX platforms).
This commit is contained in:
Iris Morelle 2019-11-05 12:30:48 -03:00
parent e15a611a9c
commit 666c4d27ce
3 changed files with 37 additions and 51 deletions

View file

@ -295,15 +295,39 @@
[/column]
[column]
border = "all"
border_size = 5
horizontal_alignment = "right"
[text_box]
id = "txtFilter"
definition = "default"
{FILTER_TEXT_BOX_HINT}
[/text_box]
[grid]
[row]
[column]
border = "all"
border_size = 5
[menu_button]
id = "dirList"
definition = "default"
tooltip = _ "Show saves from a different version of Wesnoth"
[/menu_button]
[/column]
[column]
border = "all"
border_size = 5
[text_box]
id = "txtFilter"
definition = "default"
{FILTER_TEXT_BOX_HINT}
[/text_box]
[/column]
[/row]
[/grid]
[/column]
@ -433,46 +457,6 @@
[grid]
[row]
grow_factor = 0
[column]
border_size = 5
horizontal_alignment = "left"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[spacer][/spacer]
[/column]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[menu_button]
id = "dirList"
definition = "default"
tooltip = _ "Show saves from a different version of Wesnoth"
[/menu_button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 1

View file

@ -870,7 +870,7 @@ std::vector<other_version_dir> find_other_version_saves_dirs()
#endif
if(bfs::exists(path)) {
result.emplace_back(suffix, path.generic_string());
result.emplace_back(suffix, path.string());
}
}

View file

@ -18,6 +18,7 @@
#include "desktop/open.hpp"
#include "filesystem.hpp"
#include "font/pango/escape.hpp"
#include "formatter.hpp"
#include "formula/string_utils.hpp"
#include "game_classification.hpp"
@ -145,6 +146,7 @@ void game_load::pre_show(window& window)
menu_button& dir_list = find_widget<menu_button>(&window, "dirList", false);
dir_list.set_use_markup(true);
set_save_dir_list(dir_list);
connect_signal_notify_modified(dir_list, std::bind(&game_load::handle_dir_select, this, std::ref(window)));
@ -163,14 +165,14 @@ void game_load::set_save_dir_list(menu_button& dir_list)
std::vector<config> options;
// The first option in the list is the current version's save dir
options.emplace_back("label", _("Normal saves directory"), "path", "");
options.emplace_back("label", _("game_version^Current Version"), "path", "");
for(const auto& known_dir : other_dirs) {
if(!known_dir.path.empty()) {
options.emplace_back(
"label", known_dir.version,
"label", VGETTEXT("game_version^Wesnoth $version", utils::string_map{{"version", known_dir.version}}),
"path", known_dir.path,
"details", formatter() << "<span color='#777777'>(" << known_dir.path << ")</span>"
"details", formatter() << "<span color='#777777'>" << font::escape_text(known_dir.path) << "</span>"
);
}
}