mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibGUI+Userland: Make Dialog::ExecResult an enum class
This commit is contained in:
parent
1f82beded3
commit
cdffe556c8
90 changed files with 232 additions and 232 deletions
|
@ -35,7 +35,7 @@ public:
|
|||
editor->set_title("Edit Bookmark");
|
||||
editor->set_icon(g_icon_bag.bookmark_filled);
|
||||
|
||||
if (editor->exec() == Dialog::ExecOK) {
|
||||
if (editor->exec() == ExecResult::OK) {
|
||||
return Vector<JsonValue> { editor->title(), editor->url() };
|
||||
}
|
||||
|
||||
|
@ -58,23 +58,23 @@ private:
|
|||
m_title_textbox->set_focus(true);
|
||||
m_title_textbox->select_all();
|
||||
m_title_textbox->on_return_pressed = [this] {
|
||||
done(Dialog::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
m_url_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("url_textbox");
|
||||
m_url_textbox->set_text(url);
|
||||
m_url_textbox->on_return_pressed = [this] {
|
||||
done(Dialog::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(Dialog::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(Dialog::ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void BrowserWindow::build_menus()
|
|||
m_change_homepage_action = GUI::Action::create(
|
||||
"Set Homepage URL...", g_icon_bag.go_home, [this](auto&) {
|
||||
auto homepage_url = Config::read_string("Browser", "Preferences", "Home", "about:blank");
|
||||
if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecOK) {
|
||||
if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecResult::OK) {
|
||||
if (URL(homepage_url).is_valid()) {
|
||||
Config::write_string("Browser", "Preferences", "Home", homepage_url);
|
||||
Browser::g_home_url = homepage_url;
|
||||
|
@ -373,7 +373,7 @@ void BrowserWindow::build_menus()
|
|||
|
||||
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
|
||||
String user_agent;
|
||||
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecOK || user_agent.is_empty() || user_agent.is_null()) {
|
||||
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
|
||||
m_disable_user_agent_spoofing->activate();
|
||||
return;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
|||
|
||||
auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) {
|
||||
String search_engine;
|
||||
if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecOK || search_engine.is_empty()) {
|
||||
if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
|
||||
m_disable_search_engine_action->activate();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget()
|
|||
|
||||
m_add_new_domain_button->on_click = [&](unsigned) {
|
||||
String text;
|
||||
if (GUI::InputBox::show(window(), text, "Enter domain name", "Add domain to Content Filter") == GUI::Dialog::ExecOK) {
|
||||
if (GUI::InputBox::show(window(), text, "Enter domain name", "Add domain to Content Filter") == GUI::Dialog::ExecResult::OK) {
|
||||
m_domain_list_model->add_domain(std::move(text));
|
||||
set_modified(true);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
|
|||
ok_button.set_fixed_size(80, 20);
|
||||
ok_button.on_click = [this](auto) {
|
||||
dbgln("TODO: Add event icon on specific tile");
|
||||
done(Dialog::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
event_title_textbox.set_focus(true);
|
||||
|
|
|
@ -39,7 +39,7 @@ CharacterMapWidget::CharacterMapWidget()
|
|||
|
||||
m_choose_font_action = GUI::Action::create("Choose Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
auto font_picker = GUI::FontPicker::construct(window(), &font(), false);
|
||||
if (font_picker->exec() == GUI::Dialog::ExecOK) {
|
||||
if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto& font = *font_picker->font();
|
||||
Config::write_string("CharacterMap", "History", "Font", font.qualified_name());
|
||||
set_font(font);
|
||||
|
@ -70,7 +70,7 @@ CharacterMapWidget::CharacterMapWidget()
|
|||
|
||||
m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
String input;
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecOK && !input.is_empty()) {
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
|
||||
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
|
||||
if (!maybe_code_point.has_value())
|
||||
return;
|
||||
|
|
|
@ -28,7 +28,7 @@ FontSettingsWidget::FontSettingsWidget()
|
|||
auto& default_font_button = *find_descendant_of_type_named<GUI::Button>("default_font_button");
|
||||
default_font_button.on_click = [this](auto) {
|
||||
auto font_picker = GUI::FontPicker::construct(window(), &m_default_font_label->font(), false);
|
||||
if (font_picker->exec() == GUI::Dialog::ExecOK) {
|
||||
if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
update_label_with_font(*m_default_font_label, *font_picker->font());
|
||||
set_modified(true);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ FontSettingsWidget::FontSettingsWidget()
|
|||
auto& fixed_width_font_button = *find_descendant_of_type_named<GUI::Button>("fixed_width_font_button");
|
||||
fixed_width_font_button.on_click = [this](auto) {
|
||||
auto font_picker = GUI::FontPicker::construct(window(), &m_fixed_width_font_label->font(), true);
|
||||
if (font_picker->exec() == GUI::Dialog::ExecOK) {
|
||||
if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
update_label_with_font(*m_fixed_width_font_label, *font_picker->font());
|
||||
set_modified(true);
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ void MonitorSettingsWidget::apply_settings()
|
|||
revert_timer->start();
|
||||
|
||||
// If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.
|
||||
if (box->exec() == GUI::MessageBox::ExecYes) {
|
||||
if (box->exec() == GUI::MessageBox::ExecResult::Yes) {
|
||||
auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout();
|
||||
if (!save_result.success()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
|
||||
|
|
|
@ -542,7 +542,7 @@ void DirectoryView::setup_actions()
|
|||
{
|
||||
m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
|
||||
String value;
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecOK && !value.is_empty()) {
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:", "New directory") == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value));
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
|
@ -554,7 +554,7 @@ void DirectoryView::setup_actions()
|
|||
|
||||
m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
|
||||
String value;
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecOK && !value.is_empty()) {
|
||||
if (GUI::InputBox::show(window(), value, "Enter name:", "New file") == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value));
|
||||
struct stat st;
|
||||
int rc = stat(new_file_path.characters(), &st);
|
||||
|
|
|
@ -32,7 +32,7 @@ void delete_paths(Vector<String> const& paths, bool should_confirm, GUI::Window*
|
|||
"Confirm deletion",
|
||||
GUI::MessageBox::Type::Warning,
|
||||
GUI::MessageBox::InputType::OKCancel);
|
||||
if (result == GUI::MessageBox::ExecCancel)
|
||||
if (result == GUI::MessageBox::ExecResult::Cancel)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ void do_create_link(Vector<String> const& selected_file_paths, GUI::Window* wind
|
|||
void do_create_archive(Vector<String> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
String archive_name;
|
||||
if (GUI::InputBox::show(window, archive_name, "Enter name:", "Create Archive") != GUI::InputBox::ExecOK)
|
||||
if (GUI::InputBox::show(window, archive_name, "Enter name:", "Create Archive") != GUI::InputBox::ExecResult::OK)
|
||||
return;
|
||||
|
||||
auto output_directory_path = LexicalPath(selected_file_paths.first());
|
||||
|
|
|
@ -146,7 +146,7 @@ FontEditorWidget::FontEditorWidget()
|
|||
if (!request_close())
|
||||
return;
|
||||
auto new_font_wizard = NewFontDialog::construct(window());
|
||||
if (new_font_wizard->exec() == GUI::Dialog::ExecOK) {
|
||||
if (new_font_wizard->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto metadata = new_font_wizard->new_font_metadata();
|
||||
auto new_font = Gfx::BitmapFont::create(metadata.glyph_height, metadata.glyph_width, metadata.is_fixed_width, 0x110000);
|
||||
new_font->set_name(metadata.name);
|
||||
|
@ -241,7 +241,7 @@ FontEditorWidget::FontEditorWidget()
|
|||
|
||||
m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
String input;
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecOK && !input.is_empty()) {
|
||||
if (GUI::InputBox::show(window(), input, "Hexadecimal:", "Go to glyph") == GUI::InputBox::ExecResult::OK && !input.is_empty()) {
|
||||
auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input);
|
||||
if (!maybe_code_point.has_value())
|
||||
return;
|
||||
|
@ -782,12 +782,12 @@ bool FontEditorWidget::request_close()
|
|||
if (!window()->is_modified())
|
||||
return true;
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, m_undo_stack->last_unmodified_timestamp());
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
m_save_action->activate();
|
||||
if (!window()->is_modified())
|
||||
return true;
|
||||
}
|
||||
if (result == GUI::MessageBox::ExecNo)
|
||||
if (result == GUI::MessageBox::ExecResult::No)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ static constexpr Array<Option, 2> options = {
|
|||
}
|
||||
};
|
||||
|
||||
int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||
GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all)
|
||||
{
|
||||
auto dialog = FindDialog::construct();
|
||||
|
||||
|
@ -46,7 +46,7 @@ int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& o
|
|||
|
||||
auto result = dialog->exec();
|
||||
|
||||
if (result != GUI::Dialog::ExecOK)
|
||||
if (result != ExecResult::OK)
|
||||
return result;
|
||||
|
||||
auto selected_option = dialog->selected_option();
|
||||
|
@ -56,7 +56,7 @@ int FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& o
|
|||
|
||||
if (processed.is_error()) {
|
||||
GUI::MessageBox::show_error(parent_window, processed.error());
|
||||
result = GUI::Dialog::ExecAborted;
|
||||
result = ExecResult::Aborted;
|
||||
} else {
|
||||
out_buffer = move(processed.value());
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ FindDialog::FindDialog()
|
|||
auto text = m_text_editor->text();
|
||||
if (!text.is_empty()) {
|
||||
m_text_value = text;
|
||||
done(ExecResult::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -148,6 +148,6 @@ FindDialog::FindDialog()
|
|||
};
|
||||
|
||||
m_cancel_button->on_click = [this](auto) {
|
||||
done(ExecResult::ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class FindDialog : public GUI::Dialog {
|
|||
C_OBJECT(FindDialog);
|
||||
|
||||
public:
|
||||
static int show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all);
|
||||
static ExecResult show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all);
|
||||
|
||||
private:
|
||||
Result<ByteBuffer, String> process_input(String text_value, OptionId opt);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int buffer_size)
|
||||
GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int buffer_size)
|
||||
{
|
||||
auto dialog = GoToOffsetDialog::construct();
|
||||
dialog->m_selection_offset = selection_offset;
|
||||
|
@ -31,7 +31,7 @@ int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int&
|
|||
|
||||
auto result = dialog->exec();
|
||||
|
||||
if (result != GUI::Dialog::ExecOK)
|
||||
if (result != ExecResult::OK)
|
||||
return result;
|
||||
|
||||
auto input_offset = dialog->process_input();
|
||||
|
@ -41,7 +41,7 @@ int GoToOffsetDialog::show(GUI::Window* parent_window, int& history_offset, int&
|
|||
dbgln("Go to offset: value={}", new_offset);
|
||||
out_offset = move(new_offset);
|
||||
|
||||
return GUI::Dialog::ExecOK;
|
||||
return ExecResult::OK;
|
||||
}
|
||||
|
||||
int GoToOffsetDialog::process_input()
|
||||
|
@ -124,7 +124,7 @@ GoToOffsetDialog::GoToOffsetDialog()
|
|||
};
|
||||
|
||||
m_go_button->on_click = [this](auto) {
|
||||
done(ExecResult::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
m_text_editor->on_change = [this]() {
|
||||
|
|
|
@ -14,7 +14,7 @@ class GoToOffsetDialog : public GUI::Dialog {
|
|||
C_OBJECT(GoToOffsetDialog);
|
||||
|
||||
public:
|
||||
static int show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int end);
|
||||
static ExecResult show(GUI::Window* parent_window, int& history_offset, int& out_offset, int selection_offset, int end);
|
||||
|
||||
private:
|
||||
GoToOffsetDialog();
|
||||
|
|
|
@ -94,7 +94,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
|
||||
m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) {
|
||||
String value;
|
||||
if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecOK && !value.is_empty()) {
|
||||
if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:", "New file size") == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto file_size = value.to_int();
|
||||
if (file_size.has_value() && file_size.value() > 0) {
|
||||
window()->set_modified(false);
|
||||
|
@ -151,7 +151,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
m_find_action = GUI::Action::create("&Find", { Mod_Ctrl, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
|
||||
auto old_buffer = m_search_buffer;
|
||||
bool find_all = false;
|
||||
if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecOK) {
|
||||
if (FindDialog::show(window(), m_search_text, m_search_buffer, find_all) == GUI::InputBox::ExecResult::OK) {
|
||||
if (find_all) {
|
||||
auto matches = m_editor->find_all(m_search_buffer, 0);
|
||||
m_search_results->set_model(*new SearchResultsModel(move(matches)));
|
||||
|
@ -193,7 +193,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
new_offset,
|
||||
m_editor->selection_start_offset(),
|
||||
m_editor->buffer_size());
|
||||
if (result == GUI::InputBox::ExecOK) {
|
||||
if (result == GUI::InputBox::ExecResult::OK) {
|
||||
m_editor->highlight(new_offset, new_offset);
|
||||
m_editor->update();
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
|
||||
m_fill_selection_action = GUI::Action::create("Fill &Selection...", { Mod_Ctrl, Key_B }, [&](const GUI::Action&) {
|
||||
String value;
|
||||
if (GUI::InputBox::show(window(), value, "Fill byte (hex):", "Fill Selection") == GUI::InputBox::ExecOK && !value.is_empty()) {
|
||||
if (GUI::InputBox::show(window(), value, "Fill byte (hex):", "Fill Selection") == GUI::InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto fill_byte = strtol(value.characters(), nullptr, 16);
|
||||
m_editor->fill_selection(fill_byte);
|
||||
}
|
||||
|
@ -508,11 +508,11 @@ bool HexEditorWidget::request_close()
|
|||
return true;
|
||||
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path);
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
m_save_action->activate();
|
||||
return !window()->is_modified();
|
||||
}
|
||||
return result == GUI::MessageBox::ExecNo;
|
||||
return result == GUI::MessageBox::ExecResult::No;
|
||||
}
|
||||
|
||||
void HexEditorWidget::set_search_results_visible(bool visible)
|
||||
|
|
|
@ -128,7 +128,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
GUI::MessageBox::Type::Warning,
|
||||
GUI::MessageBox::InputType::OKCancel);
|
||||
|
||||
if (msgbox_result == GUI::MessageBox::ExecCancel)
|
||||
if (msgbox_result == GUI::MessageBox::ExecResult::Cancel)
|
||||
return;
|
||||
|
||||
auto unlinked_or_error = Core::System::unlink(widget->path());
|
||||
|
|
|
@ -26,7 +26,7 @@ bool KeyboardMapperWidget::request_close()
|
|||
if (!window()->is_modified())
|
||||
return true;
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_filename);
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
ErrorOr<void> error_or = save();
|
||||
if (error_or.is_error())
|
||||
show_error_to_user(error_or.error());
|
||||
|
@ -34,7 +34,7 @@ bool KeyboardMapperWidget::request_close()
|
|||
if (!window()->is_modified())
|
||||
return true;
|
||||
}
|
||||
return result == GUI::MessageBox::ExecNo;
|
||||
return result == GUI::MessageBox::ExecResult::No;
|
||||
}
|
||||
|
||||
void KeyboardMapperWidget::create_frame()
|
||||
|
@ -58,7 +58,7 @@ void KeyboardMapperWidget::create_frame()
|
|||
|
||||
tmp_button.on_click = [this, &tmp_button]() {
|
||||
String value;
|
||||
if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecOK) {
|
||||
if (GUI::InputBox::show(window(), value, "New Character:", "Select Character") == GUI::InputBox::ExecResult::OK) {
|
||||
int i = m_keys.find_first_index(&tmp_button).value_or(0);
|
||||
VERIFY(i > 0);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
auto dialog = KeymapSelectionDialog::construct(parent_window, selected_keymaps);
|
||||
dialog->set_title("Add a keymap");
|
||||
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK) {
|
||||
if (dialog->exec() == ExecResult::OK) {
|
||||
return dialog->selected_keymap();
|
||||
}
|
||||
|
||||
|
@ -87,12 +87,12 @@ private:
|
|||
|
||||
auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(Dialog::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(Dialog::ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,8 @@ bool MailWidget::connect_and_login()
|
|||
auto server = Config::read_string("Mail", "Connection", "Server", {});
|
||||
|
||||
if (server.is_empty()) {
|
||||
int result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo);
|
||||
if (result == GUI::MessageBox::ExecResult::ExecYes)
|
||||
auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo);
|
||||
if (result == GUI::MessageBox::ExecResult::Yes)
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/bin/MailSettings"), "/bin/MailSettings");
|
||||
return false;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ bool MailWidget::connect_and_login()
|
|||
|
||||
auto password = Config::read_string("Mail", "User", "Password", {});
|
||||
while (password.is_empty()) {
|
||||
if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecOK)
|
||||
if (GUI::PasswordInputDialog::show(window(), password, "Login", server, username) != GUI::Dialog::ExecResult::OK)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
|
|||
|
||||
auto& ok_button = button_container.add<GUI::Button>("OK");
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& cancel_button = button_container.add<GUI::Button>("Cancel");
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
|
||||
width_spinbox.on_change = [this](int value) {
|
||||
|
@ -66,7 +66,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
|
|||
};
|
||||
|
||||
m_name_textbox->on_return_pressed = [this] {
|
||||
done(ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
width_spinbox.set_range(1, 16384);
|
||||
|
|
|
@ -51,12 +51,12 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G
|
|||
|
||||
auto& ok_button = button_container.add<GUI::Button>("OK");
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& cancel_button = button_container.add<GUI::Button>("Cancel");
|
||||
cancel_button.on_click = [this](auto) {
|
||||
done(ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
|
||||
width_spinbox.on_change = [this](int value) {
|
||||
|
@ -68,7 +68,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G
|
|||
};
|
||||
|
||||
m_name_textbox->on_return_pressed = [this] {
|
||||
done(ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
width_spinbox.set_range(1, 16384);
|
||||
|
|
|
@ -59,20 +59,20 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offse
|
|||
} else if (m_is_horizontal_checked) {
|
||||
m_orientation = Guide::Orientation::Horizontal;
|
||||
} else {
|
||||
done(ExecResult::ExecAborted);
|
||||
done(ExecResult::Aborted);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_offset_text_box->text().is_empty())
|
||||
done(ExecResult::ExecAborted);
|
||||
done(ExecResult::Aborted);
|
||||
|
||||
m_offset = m_offset_text_box->text();
|
||||
|
||||
done(ExecResult::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
cancel_button->on_click = [this](auto) {
|
||||
done(ExecResult::ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -69,16 +69,16 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor)
|
|||
|
||||
apply_button->on_click = [this](auto) {
|
||||
if (!m_selected_filter) {
|
||||
done(ExecResult::ExecAborted);
|
||||
done(ExecResult::Aborted);
|
||||
return;
|
||||
}
|
||||
|
||||
m_selected_filter->apply();
|
||||
done(ExecResult::ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
cancel_button->on_click = [this](auto) {
|
||||
done(ExecResult::ExecCancel);
|
||||
done(ExecResult::Cancel);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ private:
|
|||
m_should_wrap = wrap_checkbox.is_checked();
|
||||
if (norm_checkbox.is_checked())
|
||||
normalize(m_matrix);
|
||||
done(ExecOK);
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ struct FilterParameters<Gfx::GenericConvolutionFilter<N>> {
|
|||
{
|
||||
auto input = GenericConvolutionFilterInputDialog<N>::construct(parent_window);
|
||||
input->exec();
|
||||
if (input->result() == GUI::Dialog::ExecOK)
|
||||
if (input->result() == GUI::Dialog::ExecResult::OK)
|
||||
return make<typename Gfx::GenericConvolutionFilter<N>::Parameters>(input->matrix(), input->should_wrap());
|
||||
|
||||
return {};
|
||||
|
|
|
@ -565,12 +565,12 @@ bool ImageEditor::request_close()
|
|||
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), path(), undo_stack().last_unmodified_timestamp());
|
||||
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
save_project();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result == GUI::MessageBox::ExecNo)
|
||||
if (result == GUI::MessageBox::ExecResult::No)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -115,7 +115,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
m_new_image_action = GUI::Action::create(
|
||||
"&New Image...", { Mod_Ctrl, Key_N }, g_icon_bag.filetype_pixelpaint, [&](auto&) {
|
||||
auto dialog = PixelPaint::CreateNewImageDialog::construct(&window);
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK) {
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto image = PixelPaint::Image::try_create_with_size(dialog->image_size()).release_value_but_fixme_should_propagate_errors();
|
||||
auto bg_layer = PixelPaint::Layer::try_create_with_size(*image, image->size(), "Background").release_value_but_fixme_should_propagate_errors();
|
||||
image->add_layer(*bg_layer);
|
||||
|
@ -173,7 +173,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
if (response.is_error())
|
||||
return;
|
||||
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes);
|
||||
auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Export to BMP failed: {}", result.error()));
|
||||
}));
|
||||
|
@ -188,7 +188,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
if (response.is_error())
|
||||
return;
|
||||
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?", "Preserve transparency?", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecYes);
|
||||
auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Export to PNG failed: {}", result.error()));
|
||||
}));
|
||||
|
@ -392,7 +392,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
m_add_guide_action = GUI::Action::create(
|
||||
"&Add Guide", g_icon_bag.add_guide, [&](auto&) {
|
||||
auto dialog = PixelPaint::EditGuideDialog::construct(&window);
|
||||
if (dialog->exec() != GUI::Dialog::ExecOK)
|
||||
if (dialog->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return;
|
||||
auto* editor = current_image_editor();
|
||||
VERIFY(editor);
|
||||
|
@ -517,7 +517,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
auto* editor = current_image_editor();
|
||||
VERIFY(editor);
|
||||
auto dialog = PixelPaint::CreateNewLayerDialog::construct(editor->image().size(), &window);
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK) {
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto layer_or_error = PixelPaint::Layer::try_create_with_size(editor->image(), dialog->layer_size(), dialog->layer_name());
|
||||
if (layer_or_error.is_error()) {
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Unable to create layer with size {}", dialog->size()));
|
||||
|
@ -671,7 +671,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
auto* editor = current_image_editor();
|
||||
VERIFY(editor);
|
||||
auto dialog = PixelPaint::FilterGallery::construct(&window, editor);
|
||||
if (dialog->exec() != GUI::Dialog::ExecOK)
|
||||
if (dialog->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return;
|
||||
}));
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
{
|
||||
if (event.modifiers() & KeyModifier::Mod_Ctrl) {
|
||||
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK) {
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
m_color = dialog->color();
|
||||
auto pal = palette();
|
||||
pal.set_color(ColorRole::Background, m_color);
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
return;
|
||||
|
||||
auto dialog = GUI::ColorPicker::construct(m_color, window());
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK)
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK)
|
||||
on_color_change(dialog->color());
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
|
|||
editor()->window(),
|
||||
String::formatted("{}", m_context_menu_guide->offset()),
|
||||
m_context_menu_guide->orientation());
|
||||
if (dialog->exec() != GUI::Dialog::ExecOK)
|
||||
if (dialog->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return;
|
||||
auto offset = dialog->offset_as_pixel(*editor());
|
||||
if (!offset.has_value())
|
||||
|
|
|
@ -360,7 +360,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
"Deletion failed",
|
||||
GUI::MessageBox::Type::Error,
|
||||
GUI::MessageBox::InputType::YesNo);
|
||||
if (retry_message_result == GUI::MessageBox::ExecYes) {
|
||||
if (retry_message_result == GUI::MessageBox::ExecResult::Yes) {
|
||||
try_again = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -59,7 +59,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet,
|
|||
button_layout.add_spacer();
|
||||
auto& ok_button = buttonbox.add<GUI::Button>("OK");
|
||||
ok_button.set_fixed_width(80);
|
||||
ok_button.on_click = [&](auto) { done(ExecOK); };
|
||||
ok_button.on_click = [&](auto) { done(ExecResult::OK); };
|
||||
}
|
||||
|
||||
Vector<String> const g_horizontal_alignments { "Left", "Center", "Right" };
|
||||
|
|
|
@ -257,7 +257,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File&
|
|||
wizard->replace_page(page.page());
|
||||
auto result = wizard->exec();
|
||||
|
||||
if (result == GUI::Dialog::ExecResult::ExecOK) {
|
||||
if (result == GUI::Dialog::ExecResult::OK) {
|
||||
auto& writer = page.writer();
|
||||
if (!writer.has_value())
|
||||
return String { "CSV Export failed" };
|
||||
|
@ -312,7 +312,7 @@ Result<void, String> ExportDialog::make_and_run_for(StringView mime, Core::File&
|
|||
|
||||
wizard->push_page(page);
|
||||
|
||||
if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK)
|
||||
if (wizard->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return String { "Export was cancelled" };
|
||||
|
||||
if (format_combo_box->selected_index() == 0)
|
||||
|
|
|
@ -187,7 +187,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W
|
|||
wizard->replace_page(page.page());
|
||||
auto result = wizard->exec();
|
||||
|
||||
if (result == GUI::Dialog::ExecResult::ExecOK) {
|
||||
if (result == GUI::Dialog::ExecResult::OK) {
|
||||
auto& reader = page.reader();
|
||||
|
||||
NonnullRefPtrVector<Sheet> sheets;
|
||||
|
@ -265,7 +265,7 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(GUI::W
|
|||
|
||||
wizard->push_page(page);
|
||||
|
||||
if (wizard->exec() != GUI::Dialog::ExecResult::ExecOK)
|
||||
if (wizard->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return String { "Import was cancelled" };
|
||||
|
||||
if (format_combo_box->selected_index() == 0)
|
||||
|
|
|
@ -392,7 +392,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
|
|||
}
|
||||
|
||||
auto dialog = CellTypeDialog::construct(positions, *m_sheet, window());
|
||||
if (dialog->exec() == GUI::Dialog::ExecOK) {
|
||||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
for (auto& position : positions) {
|
||||
auto& cell = m_sheet->ensure(position);
|
||||
cell.set_type(dialog->type());
|
||||
|
|
|
@ -99,7 +99,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
|
|||
VERIFY(sheet_ptr); // How did we get here without a sheet?
|
||||
auto& sheet = *sheet_ptr;
|
||||
String new_name;
|
||||
if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecOK) {
|
||||
if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet") == GUI::Dialog::ExecResult::OK) {
|
||||
sheet.set_name(new_name);
|
||||
sheet.update();
|
||||
m_tab_widget->set_tab_title(static_cast<GUI::Widget&>(*m_tab_context_menu_sheet_view), new_name);
|
||||
|
@ -108,7 +108,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
|
|||
m_tab_context_menu->add_action(*m_rename_action);
|
||||
m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
String name;
|
||||
if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecOK) {
|
||||
if (GUI::InputBox::show(window(), name, "Name for new sheet", "Create sheet") == GUI::Dialog::ExecResult::OK) {
|
||||
NonnullRefPtrVector<Sheet> new_sheets;
|
||||
new_sheets.append(m_workbook->add_sheet(name));
|
||||
setup_tabs(move(new_sheets));
|
||||
|
@ -456,12 +456,12 @@ bool SpreadsheetWidget::request_close()
|
|||
return true;
|
||||
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), current_filename());
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
m_save_action->activate();
|
||||
return !m_workbook->dirty();
|
||||
}
|
||||
|
||||
if (result == GUI::MessageBox::ExecNo)
|
||||
if (result == GUI::MessageBox::ExecResult::No)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -442,7 +442,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (pid == -1)
|
||||
return;
|
||||
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
if (rc == GUI::Dialog::ExecYes)
|
||||
if (rc == GUI::Dialog::ExecResult::Yes)
|
||||
kill(pid, SIGKILL);
|
||||
},
|
||||
&process_table_view);
|
||||
|
@ -453,7 +453,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (pid == -1)
|
||||
return;
|
||||
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
if (rc == GUI::Dialog::ExecYes)
|
||||
if (rc == GUI::Dialog::ExecResult::Yes)
|
||||
kill(pid, SIGSTOP);
|
||||
},
|
||||
&process_table_view);
|
||||
|
|
|
@ -357,9 +357,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return background_process_count;
|
||||
};
|
||||
|
||||
auto check_terminal_quit = [&]() -> int {
|
||||
auto check_terminal_quit = [&]() -> GUI::Dialog::ExecResult {
|
||||
if (!should_confirm_close)
|
||||
return GUI::MessageBox::ExecOK;
|
||||
return GUI::MessageBox::ExecResult::OK;
|
||||
Optional<String> close_message;
|
||||
if (tty_has_foreground_process()) {
|
||||
close_message = "There is still a process running in this terminal. Closing the terminal will kill it.";
|
||||
|
@ -372,12 +372,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
if (close_message.has_value())
|
||||
return GUI::MessageBox::show(window, *close_message, "Close this terminal?", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
|
||||
return GUI::MessageBox::ExecOK;
|
||||
return GUI::MessageBox::ExecResult::OK;
|
||||
};
|
||||
|
||||
TRY(file_menu->try_add_action(GUI::CommonActions::make_quit_action([&](auto&) {
|
||||
dbgln("Terminal: Quit menu activated!");
|
||||
if (check_terminal_quit() == GUI::MessageBox::ExecOK)
|
||||
if (check_terminal_quit() == GUI::MessageBox::ExecResult::OK)
|
||||
GUI::Application::the()->quit();
|
||||
})));
|
||||
|
||||
|
@ -408,7 +408,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
|
||||
if (check_terminal_quit() == GUI::MessageBox::ExecOK)
|
||||
if (check_terminal_quit() == GUI::MessageBox::ExecResult::OK)
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||
};
|
||||
|
|
|
@ -150,7 +150,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget()
|
|||
font_text.set_font(m_font);
|
||||
font_button.on_click = [&](auto) {
|
||||
auto picker = GUI::FontPicker::construct(window(), m_font.ptr(), true);
|
||||
if (picker->exec() == GUI::Dialog::ExecOK) {
|
||||
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
m_font = picker->font();
|
||||
font_text.set_text(m_font->human_readable_name());
|
||||
font_text.set_font(m_font);
|
||||
|
|
|
@ -239,9 +239,9 @@ MainWidget::MainWidget()
|
|||
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
||||
if (editor().document().is_modified()) {
|
||||
auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp());
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::Yes)
|
||||
m_save_action->activate();
|
||||
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
||||
if (save_document_first_result != GUI::Dialog::ExecResult::No && editor().document().is_modified())
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -253,9 +253,9 @@ MainWidget::MainWidget()
|
|||
m_open_action = GUI::CommonActions::make_open_action([this](auto&) {
|
||||
if (editor().document().is_modified()) {
|
||||
auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp());
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
||||
if (save_document_first_result == GUI::Dialog::ExecResult::Yes)
|
||||
m_save_action->activate();
|
||||
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
||||
if (save_document_first_result != GUI::Dialog::ExecResult::No && editor().document().is_modified())
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
view_menu.add_action(GUI::Action::create("Editor &Font...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors(),
|
||||
[&](auto&) {
|
||||
auto picker = GUI::FontPicker::construct(&window, &m_editor->font(), false);
|
||||
if (picker->exec() == GUI::Dialog::ExecOK) {
|
||||
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
dbgln("setting font {}", picker->font()->qualified_name());
|
||||
m_editor->set_font(picker->font());
|
||||
}
|
||||
|
@ -719,14 +719,14 @@ bool MainWidget::request_close()
|
|||
return true;
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path, editor().document().undo_stack().last_unmodified_timestamp());
|
||||
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
m_save_action->activate();
|
||||
if (editor().document().is_modified())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result == GUI::MessageBox::ExecNo)
|
||||
if (result == GUI::MessageBox::ExecResult::No)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -432,14 +432,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return GUI::Window::CloseRequestDecision::Close;
|
||||
|
||||
auto result = GUI::MessageBox::ask_about_unsaved_changes(window, path.value_or(""), last_modified_time);
|
||||
if (result == GUI::MessageBox::ExecYes) {
|
||||
if (result == GUI::MessageBox::ExecResult::Yes) {
|
||||
save_action->activate();
|
||||
if (window->is_modified())
|
||||
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
}
|
||||
|
||||
if (result == GUI::MessageBox::ExecNo)
|
||||
if (result == GUI::MessageBox::ExecResult::No)
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
|
||||
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue