GUI: Swap OK/Alt values in MessageDialog

A follow-up commit adds support for multiple alternatives, so OK has to
come first.
This commit is contained in:
Orgad Shaneh 2021-08-17 22:31:54 +03:00 committed by Eugene Sandulenko
parent 6a68d8b7e5
commit 1c5c366649
4 changed files with 12 additions and 12 deletions

View File

@ -1264,7 +1264,7 @@ bool Control::convertSaveGame(uint8 slot, char *desc) {
GUI::MessageDialog dialog0(msg, _("Keep the old one"), _("Keep the new one"));
int choice = dialog0.runModal();
if (choice == GUI::kMessageCancel) {
if (choice == GUI::kMessageAlt) {
// User chose to keep the new game, so delete the old one
_saveFileMan->removeSavefile(oldFileName);
return true;

View File

@ -44,8 +44,8 @@ enum {
};
enum OptionSelected {
kOptionLeft = 1,
kOptionRight = 0
kOptionLeft = 0,
kOptionRight = 1
};
enum {

View File

@ -31,8 +31,8 @@
namespace GUI {
enum {
kOkCmd = 'OK ',
kCancelCmd = 'CNCL'
kDefaultCmd = 'DFLT',
kAltCmd = 'ALTC'
};
@ -92,12 +92,12 @@ void MessageDialog::init(const Common::U32String &message, const Common::U32Stri
if (!defaultButton.empty()) {
// Confirm dialog
new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, defaultButton, Common::U32String(), kOkCmd, Common::ASCII_RETURN);
new ButtonWidget(this, okButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, defaultButton, Common::U32String(), kDefaultCmd, Common::ASCII_RETURN);
}
if (!altButton.empty()) {
// Cancel dialog
new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, altButton, Common::U32String(), kCancelCmd, Common::ASCII_ESCAPE);
new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, altButton, Common::U32String(), kAltCmd, Common::ASCII_ESCAPE);
}
}
@ -115,17 +115,17 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
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) {
if (cmd == kDefaultCmd) {
setResult(kMessageOK);
close();
} else if (cmd == kCancelCmd) {
} else if (cmd == kAltCmd) {
if (_url) {
if (g_system->hasFeature(OSystem::kFeatureOpenUrl))
g_system->openUrl(_url);
setResult(kMessageOK);
} else {
setResult(kMessageCancel);
setResult(kMessageAlt);
}
close();
} else {

View File

@ -31,8 +31,8 @@ namespace GUI {
class CommandSender;
enum {
kMessageOK = 1,
kMessageCancel = 0
kMessageOK = 0,
kMessageAlt = 1
};