mirror of https://github.com/stella-emu/stella.git
added confirm dialog when erasing the whole EEPROM
This commit is contained in:
parent
9fc8b9fcc0
commit
e2844f566f
|
@ -36,7 +36,11 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
|
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font, int max_w, int max_h)
|
const GUI::Font& font, int max_w, int max_h)
|
||||||
: Dialog(osystem, parent)
|
: Dialog(osystem, parent),
|
||||||
|
myConfirmMsg(nullptr),
|
||||||
|
myMaxWidth(max_w),
|
||||||
|
myMaxHeight(max_h)
|
||||||
|
|
||||||
{
|
{
|
||||||
const int lineHeight = font.getLineHeight(),
|
const int lineHeight = font.getLineHeight(),
|
||||||
fontWidth = font.getMaxCharWidth(),
|
fontWidth = font.getMaxCharWidth(),
|
||||||
|
@ -519,6 +523,24 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEEButtonPressed:
|
case kEEButtonPressed:
|
||||||
|
if(!myConfirmMsg)
|
||||||
|
{
|
||||||
|
StringList msg;
|
||||||
|
msg.push_back("This operation cannot be undone.");
|
||||||
|
msg.push_back("All data stored on your AtariVox");
|
||||||
|
msg.push_back("or SaveKey will be erased!");
|
||||||
|
msg.push_back("");
|
||||||
|
msg.push_back("If you are sure you want to erase");
|
||||||
|
msg.push_back("the data, click 'OK', otherwise ");
|
||||||
|
msg.push_back("click 'Cancel'.");
|
||||||
|
myConfirmMsg = make_unique<GUI::MessageBox>
|
||||||
|
(this, instance().frameBuffer().font(), msg,
|
||||||
|
myMaxWidth, myMaxHeight, kConfirmEEEraseCmd);
|
||||||
|
}
|
||||||
|
myConfirmMsg->show();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kConfirmEEEraseCmd:
|
||||||
eraseEEPROM();
|
eraseEEPROM();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class StaticTextWidget;
|
||||||
|
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
#include "JoystickDialog.hxx"
|
#include "JoystickDialog.hxx"
|
||||||
|
#include "MessageBox.hxx"
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
class InputDialog : public Dialog
|
class InputDialog : public Dialog
|
||||||
|
@ -56,12 +57,13 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kDeadzoneChanged = 'DZch',
|
kDeadzoneChanged = 'DZch',
|
||||||
kDPSpeedChanged = 'PDch',
|
kDPSpeedChanged = 'PDch',
|
||||||
kMPSpeedChanged = 'PMch',
|
kMPSpeedChanged = 'PMch',
|
||||||
kTBSpeedChanged = 'TBch',
|
kTBSpeedChanged = 'TBch',
|
||||||
kDBButtonPressed = 'DBbp',
|
kDBButtonPressed = 'DBbp',
|
||||||
kEEButtonPressed = 'EEbp'
|
kEEButtonPressed = 'EEbp',
|
||||||
|
kConfirmEEEraseCmd = 'EEcf'
|
||||||
};
|
};
|
||||||
|
|
||||||
TabWidget* myTab;
|
TabWidget* myTab;
|
||||||
|
@ -93,6 +95,12 @@ class InputDialog : public Dialog
|
||||||
// Show the list of joysticks that the eventhandler knows about
|
// Show the list of joysticks that the eventhandler knows about
|
||||||
unique_ptr<JoystickDialog> myJoyDialog;
|
unique_ptr<JoystickDialog> myJoyDialog;
|
||||||
|
|
||||||
|
// Show a message about the dangers of using this function
|
||||||
|
unique_ptr<GUI::MessageBox> myConfirmMsg;
|
||||||
|
|
||||||
|
// Maximum width and height for this dialog
|
||||||
|
int myMaxWidth, myMaxHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
InputDialog() = delete;
|
InputDialog() = delete;
|
||||||
|
|
Loading…
Reference in New Issue