aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-08-11 21:49:58 +0000
committerMax Horn2004-08-11 21:49:58 +0000
commitee70457667b7480226b3af3bf3047e098a0344c5 (patch)
treee05bab6e875610e014a821826c5a1a66a09ff5fe
parent39137da10d4c8c18c0c0a6b30351459d1654a6c2 (diff)
downloadscummvm-rg350-ee70457667b7480226b3af3bf3047e098a0344c5.tar.gz
scummvm-rg350-ee70457667b7480226b3af3bf3047e098a0344c5.tar.bz2
scummvm-rg350-ee70457667b7480226b3af3bf3047e098a0344c5.zip
Fix for bug #1007093 (GUI: removing game configuration from Launcher buggy); moral: either document how things work, or at least provide well named constants for certain return values... using the cheap way out here, i.e. method (b) :-)
svn-id: r14557
-rw-r--r--backends/wince/CEActionsPocket.cpp2
-rw-r--r--backends/wince/CELauncherDialog.cpp2
-rw-r--r--gui/launcher.cpp2
-rw-r--r--gui/message.cpp5
-rw-r--r--gui/message.h6
-rw-r--r--scumm/resource.cpp2
-rw-r--r--sword1/sword1.cpp2
7 files changed, 14 insertions, 7 deletions
diff --git a/backends/wince/CEActionsPocket.cpp b/backends/wince/CEActionsPocket.cpp
index 8ae9c96509..f382cff80f 100644
--- a/backends/wince/CEActionsPocket.cpp
+++ b/backends/wince/CEActionsPocket.cpp
@@ -187,7 +187,7 @@ bool CEActionsPocket::perform(ActionType action, bool pushed) {
return true;
case POCKET_ACTION_QUIT:
GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
- if (alert.runModal() == 1)
+ if (alert.runModal() == GUI::kMessageOK)
_mainSystem->quit();
return true;
}
diff --git a/backends/wince/CELauncherDialog.cpp b/backends/wince/CELauncherDialog.cpp
index 351847b9b0..79c8d1faa1 100644
--- a/backends/wince/CELauncherDialog.cpp
+++ b/backends/wince/CELauncherDialog.cpp
@@ -156,7 +156,7 @@ void CELauncherDialog::automaticScanDirectory(const FilesystemNode *node) {
void CELauncherDialog::addGame() {
MessageDialog alert("Do you want to perform an automatic scan ?", "Yes", "No");
- if (alert.runModal() == 1 && _browser->runModal() > 0) {
+ if (alert.runModal() == kMessageOK && _browser->runModal() > 0) {
// Clear existing domains
ConfigManager::DomainMap &domains = (ConfigManager::DomainMap&)ConfMan.getGameDomains();
domains.clear();
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index fde75f08b4..37db88cfa4 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -581,7 +581,7 @@ void LauncherDialog::addGame() {
void LauncherDialog::removeGame(int item) {
MessageDialog alert("Do you really want to remove this game configuration?", "Yes", "No");
- if (alert.runModal() > 0) {
+ if (alert.runModal() == GUI::kMessageOK) {
// Remove the currently selected game from the list
assert(item >= 0);
ConfMan.removeGameDomain(_domains[item]);
diff --git a/gui/message.cpp b/gui/message.cpp
index 206f145cdf..95b6ecfaf4 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -142,11 +142,12 @@ int MessageDialog::addLine(StringList &lines, const char *line, int size) {
}
void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ // FIXME: It's a really bad thing that we use two arbitrary constants
if (cmd == kOkCmd) {
- setResult(1);
+ setResult(kMessageOK);
close();
} else if (cmd == kCancelCmd) {
- setResult(2);
+ setResult(kMessageCancel);
close();
} else {
Dialog::handleCommand(sender, cmd, data);
diff --git a/gui/message.h b/gui/message.h
index 30a2c6bfa0..328eebf499 100644
--- a/gui/message.h
+++ b/gui/message.h
@@ -26,6 +26,12 @@
namespace GUI {
+enum {
+ kMessageOK = 1,
+ kMessageCancel = 0
+};
+
+
/**
* Simple message dialog ("alert box"): presents a text message in a dialog with up to two buttons.
*/
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index ee479d9fca..249a21f049 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -419,7 +419,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) {
#endif
result = displayMessage("Quit", buf);
- if (result == 2) {
+ if (!result) {
#ifdef __PALM_OS__
error("Cannot find file: '%s'", filename);
#else
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index 1d4113dbd9..f0eb203b3d 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -1078,7 +1078,7 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or
test.close();
} else {
const char msg[] = "Unable to find the game files.\nPlease read the ScummVM documentation";
- GUI::MessageDialog dialog(msg);
+ GUI::MessageDialog dialog(msg);
dialog.runModal();
error(msg);
}