16 #define GETTEXT_DOMAIN "wesnoth-lib"
33 #include <boost/filesystem/path.hpp>
47 , screenshot_(screenshot)
55 text_box& path_box = find_widget<text_box>(&
window,
"path",
false);
60 std::placeholders::_3, std::placeholders::_5));
64 button& copy_b = find_widget<button>(&
window,
"copy",
false);
70 copy_b.
set_tooltip(
_(
"Clipboard support not found, contact your packager"));
73 button& open_b = find_widget<button>(&
window,
"open",
false);
78 button& bdir_b = find_widget<button>(&
window,
"browse_dir",
false);
84 button& save_b = find_widget<button>(&
window,
"save",
false);
91 std::string filename = path_box.
get_value();
100 "Try to save the screenshot as PNG instead."));
104 "Make sure there is enough space on the drive holding Wesnoth’s player resource files and that file permissions are set up correctly."));
106 throw std::logic_error(
"Unexpected error while trying to save a screenshot");
109 find_widget<button>(
get_window(),
"open",
false).set_active(
true);
110 find_widget<button>(
get_window(),
"save",
false).set_active(
false);
113 find_widget<button>(
get_window(),
"copy",
false).set_active(
true);
118 find_widget<label>(
get_window(),
"filesize",
false).set_label(sizetext);
124 if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
Abstract base class for all modal dialogs.
window * get_window()
Returns a pointer to the dialog's window.
const std::string screenshots_dir_path_
void keypress_callback(bool &handled, const SDL_Keycode key)
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
std::string path_
The display function.
std::string get_value() const
void set_selection(std::size_t start, int length)
Sets or clears the text selection.
const std::string & text() const
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.
base class of top level items, the only item which needs to store the final canvases to draw on.
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)
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
bool available()
Whether wesnoth was compiled with support for a clipboard.
bool open_object([[maybe_unused]] const std::string &path_or_url)
std::string base_name(const std::string &file, const bool remove_extension)
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.
std::string get_screenshot_dir()
const std::string unicode_em_dash
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_pre_key_press(dispatcher &dispatcher, const signal_keyboard &signal)
Connects the signal for 'snooping' on the keypress.
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
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.