mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
PixelPaint: Display an error message if saving to PP file fails
This commit is contained in:
parent
fa7bb98b1e
commit
c333aec9f3
3 changed files with 17 additions and 10 deletions
|
@ -115,10 +115,14 @@ int main(int argc, char** argv)
|
|||
auto save_image_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
if (!image_editor.image())
|
||||
return;
|
||||
Optional<String> save_path = GUI::FilePicker::get_save_filepath(window, "untitled", "pp");
|
||||
auto save_path = GUI::FilePicker::get_save_filepath(window, "untitled", "pp");
|
||||
if (!save_path.has_value())
|
||||
return;
|
||||
image_editor.image()->save(save_path.value());
|
||||
auto result = image_editor.image()->write_to_file(save_path.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window, String::formatted("Could not save {}: {}", save_path.value(), result.error()));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
auto menubar = GUI::Menubar::construct();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue