diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index ea02e52ff..19c8c2394 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -36,7 +36,11 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, 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(), fontWidth = font.getMaxCharWidth(), @@ -519,6 +523,24 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, break; 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 + (this, instance().frameBuffer().font(), msg, + myMaxWidth, myMaxHeight, kConfirmEEEraseCmd); + } + myConfirmMsg->show(); + break; + + case kConfirmEEEraseCmd: eraseEEPROM(); break; diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 1cea406f9..921eda0d4 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -30,6 +30,7 @@ class StaticTextWidget; #include "Dialog.hxx" #include "JoystickDialog.hxx" +#include "MessageBox.hxx" #include "bspf.hxx" class InputDialog : public Dialog @@ -56,12 +57,13 @@ class InputDialog : public Dialog private: enum { - kDeadzoneChanged = 'DZch', - kDPSpeedChanged = 'PDch', - kMPSpeedChanged = 'PMch', - kTBSpeedChanged = 'TBch', - kDBButtonPressed = 'DBbp', - kEEButtonPressed = 'EEbp' + kDeadzoneChanged = 'DZch', + kDPSpeedChanged = 'PDch', + kMPSpeedChanged = 'PMch', + kTBSpeedChanged = 'TBch', + kDBButtonPressed = 'DBbp', + kEEButtonPressed = 'EEbp', + kConfirmEEEraseCmd = 'EEcf' }; TabWidget* myTab; @@ -93,6 +95,12 @@ class InputDialog : public Dialog // Show the list of joysticks that the eventhandler knows about unique_ptr myJoyDialog; + // Show a message about the dangers of using this function + unique_ptr myConfirmMsg; + + // Maximum width and height for this dialog + int myMaxWidth, myMaxHeight; + private: // Following constructors and assignment operators not supported InputDialog() = delete;