Converted a few plain enum to 'enum class'; eliminated some dead code.

This commit is contained in:
Stephen Anthony 2019-03-24 19:04:07 -02:30
parent 0bb5dfd493
commit 4b2b9aa626
11 changed files with 22 additions and 30 deletions

View File

@ -66,7 +66,8 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
// Inform the TIA output widget about its associated zoom widget
myTiaOutput->setZoomWidget(myTiaZoom);
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, OptionsDialog::debugger);
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h,
OptionsDialog::AppMode::debugger);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -86,7 +86,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
CheckboxWidget::kCheckActionCmd);
t->setTarget(this);
t->setID(i);
t->setFill(CheckboxWidget::Circle);
t->setFill(CheckboxWidget::FillType::Circle);
t->setTextColor(kTextColorEm);
ypos += _fontHeight;

View File

@ -30,7 +30,6 @@ class CheckListWidget : public ListWidget
{
public:
enum { kListItemChecked = 'LIct' /* checkbox toggled on current line*/ };
enum CheckStyle { XFill, SolidFill };
public:
CheckListWidget(GuiObject* boss, const GUI::Font& font,

View File

@ -78,11 +78,7 @@ class DeveloperDialog : public Dialog
kDFontSizeChanged = 'UIfs',
#endif
};
enum SettingsSet
{
player,
developer
};
enum SettingsSet { player = 0, developer = 1 };
// MUST be aligned with RewindManager!
static const int NUM_INTERVALS = 7;

View File

@ -205,7 +205,8 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
mySelectedItem = 0; // Highlight 'Rom Listing'
// Create an options dialog, similar to the in-game one
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, OptionsDialog::launcher);
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h,
OptionsDialog::AppMode::launcher);
// Create a game list, which contains all the information about a ROM that
// the launcher needs

View File

@ -26,5 +26,5 @@ Menu::Menu(OSystem& osystem)
: DialogContainer(osystem)
{
myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr,
FBMinimum::Width, FBMinimum::Height, OptionsDialog::emulator);
FBMinimum::Width, FBMinimum::Height, OptionsDialog::AppMode::emulator);
}

View File

@ -46,7 +46,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, stellaMode mode)
GuiObject* boss, int max_w, int max_h, AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"),
myMode(mode)
{
@ -139,7 +139,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
addToFocusList(wid);
// Certain buttons are disabled depending on mode
if(myMode == launcher)
if(myMode == AppMode::launcher)
{
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
}
@ -301,7 +301,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kExitCmd:
if(myMode != emulator)
if(myMode != AppMode::emulator)
close();
else
instance().eventHandler().leaveMenuMode();

View File

@ -44,15 +44,10 @@ class OptionsDialog : public Dialog
{
public:
// Current Stella mode
enum stellaMode
{
launcher,
emulator,
debugger
};
enum class AppMode { launcher, emulator, debugger };
OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss,
int max_w, int max_h, stellaMode mode);
int max_w, int max_h, AppMode mode);
virtual ~OptionsDialog();
private:
@ -80,7 +75,7 @@ class OptionsDialog : public Dialog
ButtonWidget* myCheatCodeButton;
// Indicates if this dialog is used for global (vs. in-game) settings
stellaMode myMode;
AppMode myMode;
enum {
kVidCmd = 'VIDO',

View File

@ -110,7 +110,7 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
else // center text
_textY = (14 - _font.getFontHeight()) / 2;
setFill(CheckboxWidget::Normal);
setFill(CheckboxWidget::FillType::Normal);
myGroup->addWidget(this);
}
@ -143,10 +143,10 @@ void RadioButtonWidget::setFill(FillType type)
{
switch(type)
{
case CheckboxWidget::Normal:
case CheckboxWidget::FillType::Normal:
_img = radio_img_active;
break;
case CheckboxWidget::Inactive:
case CheckboxWidget::FillType::Inactive:
_img = radio_img_inactive;
break;
default:

View File

@ -561,7 +561,7 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
else // center text
_textY = (14 - _font.getFontHeight()) / 2;
setFill(CheckboxWidget::Normal);
setFill(CheckboxWidget::FillType::Normal);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -599,7 +599,7 @@ void CheckboxWidget::setEditable(bool editable)
else
{
_bgcolor = kBGColorHi;
setFill(CheckboxWidget::Inactive);
setFill(CheckboxWidget::FillType::Inactive);
}
setDirty();
}
@ -609,15 +609,15 @@ void CheckboxWidget::setFill(FillType type)
{
switch(type)
{
case CheckboxWidget::Normal:
case CheckboxWidget::FillType::Normal:
_img = checked_img_active;
_drawBox = true;
break;
case CheckboxWidget::Inactive:
case CheckboxWidget::FillType::Inactive:
_img = checked_img_inactive;
_drawBox = true;
break;
case CheckboxWidget::Circle:
case CheckboxWidget::FillType::Circle:
_img = checked_img_circle;
_drawBox = false;
break;

View File

@ -264,7 +264,7 @@ class CheckboxWidget : public ButtonWidget
{
public:
enum { kCheckActionCmd = 'CBAC' };
enum FillType { Normal, Inactive, Circle };
enum class FillType { Normal, Inactive, Circle };
public:
CheckboxWidget(GuiObject* boss, const GUI::Font& font, int x, int y,