From c614f67f081d2ddb39773f09b3761c110aa1fc31 Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Fri, 5 Nov 2010 22:21:13 +0000 Subject: [PATCH] Convert the Quit confirmation dialog to GUI2 --- src/hotkeys.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp index dfced0f0ff3..1339164b570 100644 --- a/src/hotkeys.cpp +++ b/src/hotkeys.cpp @@ -24,6 +24,8 @@ #include "game_end_exceptions.hpp" #include "game_preferences.hpp" #include "gettext.hpp" +#include "gui/dialogs/message.hpp" +#include "gui/widgets/window.hpp" #include "filesystem.hpp" #include "log.hpp" #include "preferences_display.hpp" @@ -715,8 +717,8 @@ void key_event(display& disp, const SDL_KeyboardEvent& event, command_executor* { if(event.keysym.sym == SDLK_ESCAPE && disp.in_game()) { LOG_G << "escape pressed..showing quit\n"; - const int res = gui::dialog(disp,_("Quit"),_("Do you really want to quit?"),gui::YES_NO).show(); - if(res == 0) { + const int res = gui2::show_message(disp.video(), _("Quit"), _("Do you really want to quit?"), gui2::tmessage::yes_no_buttons); + if(res != gui2::twindow::CANCEL) { throw end_level_exception(QUIT); } else { return; @@ -1014,8 +1016,8 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex case HOTKEY_QUIT_GAME: { if(disp.in_game()) { DBG_G << "is in game -- showing quit message\n"; - const int res = gui::dialog(disp,_("Quit"),_("Do you really want to quit?"),gui::YES_NO).show(); - if(res == 0) { + const int res = gui2::show_message(disp.video(), _("Quit"), _("Do you really want to quit?"), gui2::tmessage::yes_no_buttons); + if(res != gui2::twindow::CANCEL) { throw end_level_exception(QUIT); } }