mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
HackStudio: Show dialog on build and exit if there are unsaved changes
If the user tries to exit HackStudio, or build the project, when there are unsaved changes in some of the editors, A Yes/No/Cancel dialog will be shown.
This commit is contained in:
parent
672b14b70d
commit
329cb134d6
4 changed files with 50 additions and 2 deletions
|
@ -81,6 +81,12 @@ int main(int argc, char** argv)
|
|||
s_hack_studio_widget->initialize_menubar(menubar);
|
||||
s_window->set_menubar(menubar);
|
||||
|
||||
s_window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
|
||||
if (s_hack_studio_widget->warn_unsaved_changes("There are unsaved changes, do you want to save before exiting?") == HackStudioWidget::ContinueDecision::Yes)
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||
};
|
||||
|
||||
s_window->show();
|
||||
|
||||
s_hack_studio_widget->update_actions();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue