Added global support for the (so far undocumented) confirm_exit config key

svn-id: r27788
This commit is contained in:
Max Horn 2007-06-30 12:43:53 +00:00
parent 45aea284d1
commit c7fa7baf1f
3 changed files with 16 additions and 7 deletions

6
README
View File

@ -1575,6 +1575,8 @@ The following keywords are recognized:
super2xsai, supereagle, advmame2x, advmame3x,
hq2x, hq3x, tv2x, dotmatrix)
confirm_exit bool Ask for confirmation by the user before quitting
(SDL backend only).
cdrom number Number of CD-ROM unit to use for audio. If
negative, don't even try to access the CD-ROM.
joystick_num number Number of joystick device to use for input
@ -1600,8 +1602,8 @@ The following keywords are recognized:
midi_gain number The MIDI gain (0-1000) (default: 100) (Only
supported by some MIDI drivers.)
copy_protection bool Enable copy protection in SCUMM games, when
ScummVM disables it by default.
copy_protection bool Enable copy protection in certain games, in those
cases where ScummVM disables it by default.
demo_mode bool Start demo in Maniac Mansion
alt_intro bool Use alternative intro for CD versions of
Beneath a Steel Sky and Flight of the Amazon

View File

@ -26,8 +26,10 @@
#if !defined(DISABLE_DEFAULT_EVENTMANAGER)
#include "common/stdafx.h"
#include "common/config-manager.h"
#include "common/system.h"
#include "backends/events/default/default-events.h"
#include "gui/message.h"
DefaultEventManager::DefaultEventManager(OSystem *boss) :
_boss(boss),
@ -93,7 +95,15 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
break;
case Common::EVENT_QUIT:
_shouldQuit = true;
if (ConfMan.getBool("confirm_exit")) {
GUI::MessageDialog alert("Do you really want to quit?", "Yes", "No");
if (alert.runModal() == GUI::kMessageOK)
_shouldQuit = true;
else
result = false;
} else
_shouldQuit = true;
break;
default:

View File

@ -188,10 +188,7 @@ void ScummEngine::parseEvents() {
break;
case Common::EVENT_QUIT:
if (ConfMan.getBool("confirm_exit"))
confirmExitDialog();
else
_quit = true;
_quit = true;
break;
default: