GUI2/Screenshot Notification: fixed wrong path being used for opening screenshot (fixes #5322)

This commit is contained in:
Charles Dang 2020-12-19 11:43:23 +11:00
parent 3118f34798
commit 92c10f1b19
3 changed files with 6 additions and 2 deletions

View file

@ -36,6 +36,8 @@
* Add a overwrite_specials option for abilities like weapon could overwrite specials or other ablities like weapon
### Miscellaneous and Bug Fixes
* Fixed several possible crashes in wmllint
* Screenshots now default to JPG instead of PNG
* Fixed screenshot popup sometimes using the wrong path when trying to open the screenshot after saving
## Version 1.15.7
### Add-ons server

View file

@ -125,6 +125,8 @@ void screenshot_notification::save_screenshot()
boost::filesystem::path path(screenshots_dir_path_);
path /= filename;
path_ = path.string();
image::save_result res = image::save_image(screenshot_, path.string());
if(res == image::save_result::unsupported_format) {
gui2::show_error_message(_("Unsupported image format.\n\n"
@ -144,7 +146,7 @@ void screenshot_notification::save_screenshot()
find_widget<button>(&window, "copy", false).set_active(true);
}
const int filesize = filesystem::file_size(path.string());
const int filesize = filesystem::file_size(path_);
const std::string sizetext = utils::si_string(filesize, true, _("unit_byte^B"));
find_widget<label>(&window, "filesize", false).set_label(sizetext);
}

View file

@ -41,7 +41,7 @@ public:
DEFINE_SIMPLE_DISPLAY_WRAPPER(screenshot_notification)
private:
const std::string path_;
std::string path_;
const std::string screenshots_dir_path_;
surface screenshot_;