Skip to content

Commit

Permalink
Screenshot Notification: cleaned up and tweaked a few things
Browse files Browse the repository at this point in the history
* Added textdomain closure missing from 267510e
* 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
  • Loading branch information
Vultraz committed Mar 18, 2018
1 parent f5effa0 commit a43623f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions data/gui/window/screenshot_notification.cfg
Expand Up @@ -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]
Expand Down Expand Up @@ -81,8 +81,6 @@
grow_factor = 0

[column]
#textdomain wesnoth

grow_factor = 1

border = "all"
Expand All @@ -93,7 +91,9 @@
id = "title"
definition = "title"

#textdomain wesnoth
label = _ "Screenshot"
#textdomain wesnoth-lib
[/label]

[/column]
Expand Down Expand Up @@ -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]
Expand All @@ -176,6 +175,7 @@
grow_factor = 0

[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_alignment = "left"
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialogs/screenshot_notification.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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();
}
}

Expand Down

0 comments on commit a43623f

Please sign in to comment.