mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-01 21:59:11 +00:00
Spider: Get user confirmation to close when there is a active game
This commit is contained in:
parent
4df9d05f91
commit
f7eb6772ce
Notes:
sideshowbarker
2024-07-18 08:02:55 +09:00
Author: https://github.com/jamierocks
Commit: f7eb6772ce
Pull-request: https://github.com/SerenityOS/serenity/pull/9036
1 changed files with 18 additions and 0 deletions
|
@ -155,6 +155,24 @@ int main(int argc, char** argv)
|
||||||
statusbar.set_text(2, "Timer starts after your first move");
|
statusbar.set_text(2, "Timer starts after your first move");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window->on_close_request = [&]() {
|
||||||
|
auto game_in_progress = timer->is_active();
|
||||||
|
if (game_in_progress) {
|
||||||
|
auto result = GUI::MessageBox::show(window,
|
||||||
|
"A game is still in progress, are you sure you would like to quit?",
|
||||||
|
"Game in progress",
|
||||||
|
GUI::MessageBox::Type::Warning,
|
||||||
|
GUI::MessageBox::InputType::YesNoCancel);
|
||||||
|
|
||||||
|
if (result == GUI::MessageBox::ExecYes)
|
||||||
|
return GUI::Window::CloseRequestDecision::Close;
|
||||||
|
else
|
||||||
|
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GUI::Window::CloseRequestDecision::Close;
|
||||||
|
};
|
||||||
|
|
||||||
GUI::ActionGroup suit_actions;
|
GUI::ActionGroup suit_actions;
|
||||||
suit_actions.set_exclusive(true);
|
suit_actions.set_exclusive(true);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue