mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
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:
parent
6a68d8b7e5
commit
1c5c366649
@ -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;
|
||||
|
@ -44,8 +44,8 @@ enum {
|
||||
};
|
||||
|
||||
enum OptionSelected {
|
||||
kOptionLeft = 1,
|
||||
kOptionRight = 0
|
||||
kOptionLeft = 0,
|
||||
kOptionRight = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -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 {
|
||||
|
@ -31,8 +31,8 @@ namespace GUI {
|
||||
class CommandSender;
|
||||
|
||||
enum {
|
||||
kMessageOK = 1,
|
||||
kMessageCancel = 0
|
||||
kMessageOK = 0,
|
||||
kMessageAlt = 1
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user