1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:27:43 +00:00

LibGUI+Userland: Make Dialog::ExecResult an enum class

This commit is contained in:
Sam Atkins 2022-05-13 13:10:27 +01:00 committed by Linus Groh
parent 1f82beded3
commit cdffe556c8
90 changed files with 232 additions and 232 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);
};
}

View file

@ -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);
};
}

View file

@ -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 {};

View file

@ -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;

View file

@ -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;
}));

View file

@ -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());
}

View file

@ -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())