Screenshot Notification: cleaned up and tweaked a few things

* Added textdomain closure missing from 267510ea076ce317d323da54bb81ccd255b93284
* Avoid use of invalidate_layout by having an em dash in the size field prior to
  saving. That's needed since GUI2 doesn't expand the label's canvas if its text
  is initially empty.
* Use a better button definition for the View button.
* Grouped Save and Close buttons together
This commit is contained in:
Charles Dang 2018-03-17 14:33:05 +11:00
parent f5effa03f3
commit a43623ff2d
2 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@
[button]
id = "open"
definition = "action_browse"
definition = "action_go"
label = _ "filesystem^Open"
tooltip = _ "Open this file with an external application"
[/button]
@ -81,8 +81,6 @@
grow_factor = 0
[column]
#textdomain wesnoth
grow_factor = 1
border = "all"
@ -93,7 +91,9 @@
id = "title"
definition = "title"
#textdomain wesnoth
label = _ "Screenshot"
#textdomain wesnoth-lib
[/label]
[/column]
@ -146,12 +146,11 @@
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
horizontal_grow = true
[label]
label = ""
id = "filesize"
wrap = true
definition = "default"
[/label]
[/column]
@ -176,6 +175,7 @@
grow_factor = 0
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"

View File

@ -90,6 +90,8 @@ void screenshot_notification::pre_show(window& window)
connect_signal_pre_key_press(path_box, std::bind(&screenshot_notification::keypress_callback, this,
std::placeholders::_3, std::placeholders::_5));
find_widget<label>(&window, "filesize", false).set_label(font::unicode_em_dash);
button& copy_b = find_widget<button>(&window, "copy", false);
connect_signal_mouse_left_click(
copy_b, std::bind(&desktop::clipboard::copy_to_clipboard, std::ref(path_), false));
@ -139,8 +141,6 @@ void screenshot_notification::save_screenshot()
const int filesize = filesystem::file_size(path.string());
const std::string sizetext = utils::si_string(filesize, true, _("unit_byte^B"));
find_widget<label>(&window, "filesize", false).set_label(sizetext);
window.invalidate_layout();
}
}