16#define GETTEXT_DOMAIN "wesnoth-lib"
32#include <boost/filesystem/path.hpp>
46 , screenshots_dir_path_(
filesystem::get_screenshot_dir())
47 , screenshot_(
std::move(screenshot))
55 text_box& path_box = find_widget<text_box>(
"path");
60 std::placeholders::_3, std::placeholders::_5));
64 button& copy_b = find_widget<button>(
"copy");
65 connect_signal_mouse_left_click(
69 button& open_b = find_widget<button>(
"open");
70 connect_signal_mouse_left_click(
74 button& bdir_b = find_widget<button>(
"browse_dir");
75 connect_signal_mouse_left_click(
80 button& save_b = find_widget<button>(
"save");
86 text_box& path_box = find_widget<text_box>(
"path");
91 path_ = path.string();
96 "Try to save the screenshot as PNG instead."));
100 "Make sure there is enough space on the drive holding Wesnoth’s player resource files and that file permissions are set up correctly."));
102 throw std::logic_error(
"Unexpected error while trying to save a screenshot");
105 find_widget<button>(
"open").set_active(
true);
106 find_widget<button>(
"save").set_active(
false);
107 find_widget<button>(
"copy").set_active(
true);
111 find_widget<label>(
"filesize").set_label(sizetext);
117 if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
Abstract base class for all modal dialogs.
const std::string screenshots_dir_path_
void keypress_callback(bool &handled, const SDL_Keycode key)
virtual void pre_show() override
Actions to be taken before showing the window.
std::string path_
The display function.
const std::string & text() const
std::string get_value() const
void set_selection(std::size_t start, int length)
Sets or clears the text selection.
virtual void set_value(const std::string &text)
The set_value is virtual for the password_box class.
virtual void set_active(const bool active) override
See styled_widget::set_active.
A widget that allows the user to input text in single line.
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
void keyboard_capture(widget *widget)
Declarations for File-IO.
static std::string _(const char *str)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
void copy_to_clipboard(const std::string &text)
Copies text to the clipboard.
bool open_object(const std::string &path_or_url)
Opens the specified object with the default application configured for its type.
std::string base_name(const std::string &file, const bool remove_extension=false)
Returns the base filename of a file, with directory name stripped.
int file_size(const std::string &fname)
Returns the size of a file, or -1 if the file doesn't exist.
const std::string unicode_em_dash
void show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
save_result save_image(const locator &i_locator, const std::string &filename)
std::string dsgettext(const char *domainname, const char *msgid)
std::string si_string(double input, bool base2, const std::string &unit)
Convert into a string with an SI-postfix.
Desktop environment interaction functions.
std::string filename
Filename.