Final batch of brace conversion.

Added const in a few places.
This commit is contained in:
Stephen Anthony 2020-12-20 21:08:00 -03:30
parent ac09bcd032
commit aefb9075ae
49 changed files with 105 additions and 105 deletions

View File

@ -143,7 +143,7 @@ Common::Rect CheckListWidget::getEditRect() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CheckListWidget::getState(int line)
bool CheckListWidget::getState(int line) const
{
if(line >= 0 && line < int(_stateList.size()))
return _stateList[line];

View File

@ -39,8 +39,8 @@ class CheckListWidget : public ListWidget
void setList(const StringList& list, const BoolArray& state);
void setLine(int line, const string& str, const bool& state);
bool getState(int line);
bool getSelectedState() { return getState(_selectedItem); }
bool getState(int line) const;
bool getSelectedState() const { return getState(_selectedItem); }
private:
bool handleEvent(Event::Type e) override;

View File

@ -28,8 +28,8 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int cmd, bool framed)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_framed(framed),
_cmd(cmd)
_framed{framed},
_cmd{cmd}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
}

View File

@ -48,7 +48,7 @@ class CommandSender
// and add methods addTarget/removeTarget.
public:
explicit CommandSender(CommandReceiver* target)
: _target(target) { }
: _target{target} { }
virtual ~CommandSender() = default;

View File

@ -31,9 +31,9 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
const VariantList& items, int cmd, int width)
: Dialog(boss->instance(), boss->parent(), font),
CommandSender(boss),
_rowHeight(font.getLineHeight()),
_cmd(cmd),
_maxWidth(width)
_rowHeight{font.getLineHeight()},
_cmd{cmd},
_maxWidth{width}
{
setArrows();
addItems(items);

View File

@ -130,7 +130,7 @@ class ContextMenu : public Dialog, public CommandSender
int _id{-1};
uInt32 _xorig{0}, _yorig{0};
uInt32 _maxWidth{0};
int _maxWidth{0};
int _textOfs{0};
int _arrowSize{0};

View File

@ -148,7 +148,7 @@ class DeveloperDialog : public Dialog
CheckboxWidget* myGhostReadsTrapWidget{nullptr};
#endif
bool mySettings;
bool mySettings{false};
// Emulator sets
std::array<bool, 2> myFrameStats;
std::array<bool, 2> myDetectedInfo;

View File

@ -49,8 +49,8 @@
Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font,
const string& title, int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h),
_font(font),
_title(title)
_font{font},
_title{title}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG;
setTitle(title);

View File

@ -213,7 +213,7 @@ class Dialog : public GuiObject
Widget* widget{nullptr};
WidgetArray list;
explicit Focus(Widget* w = nullptr) : widget(w) { }
explicit Focus(Widget* w = nullptr) : widget{w} { }
};
using FocusList = vector<Focus>;
@ -222,7 +222,7 @@ class Dialog : public GuiObject
FocusList focus;
uInt32 currentTab{0};
explicit TabFocus(TabWidget* w = nullptr) : widget(w) { }
explicit TabFocus(TabWidget* w = nullptr) : widget{w} { }
void appendFocusList(WidgetArray& list);
void saveCurrentFocus(Widget* w);

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DialogContainer::DialogContainer(OSystem& osystem)
: myOSystem(osystem)
: myOSystem{osystem}
{
_DOUBLE_CLICK_DELAY = osystem.settings().getInt("mdouble");
_REPEAT_INITIAL_DELAY = osystem.settings().getInt("ctrldelay");

View File

@ -40,7 +40,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
EventMode mode)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
myEventMode(mode)
myEventMode{mode}
{
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),

View File

@ -28,7 +28,7 @@
FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: StringListWidget(boss, font, x, y, w, h),
_filter([](const FilesystemNode& node) { return true; })
_filter{[](const FilesystemNode& node) { return true; }}
{
// This widget is special, in that it catches signals and redirects them
setTarget(this);

View File

@ -89,7 +89,7 @@ class FileListWidget : public StringListWidget
const FilesystemNode& currentDir() const { return _node; }
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
uInt64 getQuickSelectDelay() { return _QUICK_SELECT_DELAY; }
uInt64 getQuickSelectDelay() const { return _QUICK_SELECT_DELAY; }
ProgressDialog& progress();
void incProgress();

View File

@ -26,7 +26,7 @@ namespace GUI {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Font::Font(const FontDesc& desc)
: myFontDesc(desc)
: myFontDesc{desc}
{
}

View File

@ -70,10 +70,10 @@ class GuiObject : public CommandReceiver
public:
GuiObject(OSystem& osystem, DialogContainer& parent, Dialog& dialog,
int x, int y, int w, int h)
: myOSystem(osystem),
myParent(parent),
myDialog(dialog),
_x(x), _y(y), _w(w), _h(h) { }
: myOSystem{osystem},
myParent{parent},
myDialog{dialog},
_x{x}, _y{y}, _w{w}, _h{h} { }
~GuiObject() override = default;

View File

@ -35,7 +35,6 @@ class Serializer;
using json = nlohmann::json;
/**
The dialog for displaying high scores in Stella.

View File

@ -41,8 +41,8 @@
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Input settings"),
myMaxWidth(max_w),
myMaxHeight(max_h)
myMaxWidth{max_w},
myMaxHeight{max_h}
{
const int lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth(),

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem& osystem)
: DialogContainer(osystem),
mySize(myOSystem.settings().getSize("launcherres"))
mySize{myOSystem.settings().getSize("launcherres")}
{
const Common::Size& d = myOSystem.frameBuffer().desktopSize();
double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;

View File

@ -28,7 +28,7 @@
ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, bool useScrollbar)
: EditableWidget(boss, font, x, y, 16, 16),
_useScrollbar(useScrollbar)
_useScrollbar{useScrollbar}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
_bgcolor = kWidColor;

View File

@ -33,8 +33,8 @@ MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
bool focusOKButton)
: Dialog(boss->instance(), boss->parent(), font, title, 0, 0, max_w, max_h),
CommandSender(boss),
myOkCmd(okCmd),
myCancelCmd(cancelCmd)
myOkCmd{okCmd},
myCancelCmd{cancelCmd}
{
addText(font, text);

View File

@ -82,6 +82,7 @@ void MessageDialog::setMessage(const string& title, const string& text, bool yes
setMessage(title, StringParser(text).stringList(), yesNo);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string MessageDialog::myTitle = "";
StringList MessageDialog::myText;
bool MessageDialog::myYesNo = false;

View File

@ -26,36 +26,36 @@ class OSystem;
class MessageDialog : public Dialog
{
public:
MessageDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h);
~MessageDialog() override;
public:
MessageDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h);
~MessageDialog() override;
// Define the message displayed
void setMessage(const string& title, const string& text, bool yesNo = false);
void setMessage(const string& title, const StringList& text, bool yesNo = false);
bool confirmed() { return myConfirmed; }
// Define the message displayed
void setMessage(const string& title, const string& text, bool yesNo = false);
void setMessage(const string& title, const StringList& text, bool yesNo = false);
bool confirmed() { return myConfirmed; }
protected:
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
protected:
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
static string myTitle;
static StringList myText;
static bool myYesNo;
static bool myConfirmed;
private:
static string myTitle;
static StringList myText;
static bool myYesNo;
static bool myConfirmed;
// Show a message
GUI::MessageBox* myMsg{nullptr};
// Show a message
GUI::MessageBox* myMsg{nullptr};
private:
// Following constructors and assignment operators not supported
MessageDialog() = delete;
MessageDialog(const MessageDialog&) = delete;
MessageDialog(MessageDialog&&) = delete;
MessageDialog& operator=(const MessageDialog&) = delete;
MessageDialog& operator=(MessageDialog&&) = delete;
private:
// Following constructors and assignment operators not supported
MessageDialog() = delete;
MessageDialog(const MessageDialog&) = delete;
MessageDialog(MessageDialog&&) = delete;
MessageDialog& operator=(const MessageDialog&) = delete;
MessageDialog& operator=(MessageDialog&&) = delete;
};
#endif

View File

@ -49,8 +49,8 @@
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"),
myBoss(boss),
myMode(mode)
myBoss{boss},
myMode{mode}
{
// do not show basic settings options in debugger
bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger;

View File

@ -71,7 +71,7 @@ class OptionsDialog : public Dialog
ButtonWidget* myGameInfoButton{nullptr};
ButtonWidget* myCheatCodeButton{nullptr};
GuiObject* myBoss;
GuiObject* myBoss{nullptr};
// Indicates if this dialog is used for global (vs. in-game) settings
Menu::AppMode myMode{Menu::AppMode::emulator};

View File

@ -29,8 +29,8 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const VariantList& list,
const string& label, int labelWidth, int cmd)
: EditableWidget(boss, font, x, y - 1, w, h + 2),
_label(label),
_labelWidth(labelWidth)
_label{label},
_labelWidth{labelWidth}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS
| Widget::FLAG_TRACK_MOUSE;

View File

@ -30,7 +30,7 @@
ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
const string& message)
: Dialog(boss->instance(), boss->parent()),
myFont(font)
myFont{font}
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),

View File

@ -29,7 +29,7 @@
QuadTariDialog::QuadTariDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h,
Properties& properties)
: Dialog(boss->instance(), boss->parent(), font, "QuadTari controllers", 0, 0, max_w, max_h),
myGameProperties(properties)
myGameProperties{properties}
{
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight(),

View File

@ -221,8 +221,8 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label,
RadioButtonGroup* group, int cmd)
: CheckboxWidget(boss, font, x, y, label, cmd),
myGroup(group),
_buttonSize(buttonSize(font)) // 14 | 22
myGroup{group},
_buttonSize{buttonSize(font)} // 14 | 22
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;

View File

@ -40,7 +40,7 @@ class RadioButtonWidget : public CheckboxWidget
protected:
void setFill(FillType type);
void drawWidget(bool hilite) override;
static int buttonSize(const GUI::Font& font)
static uInt32 buttonSize(const GUI::Font& font)
{
return font.getFontHeight() < 24 ? 14 : 22; // box is square
}

View File

@ -37,9 +37,9 @@
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Audit ROMs"),
myFont(font),
myMaxWidth(max_w),
myMaxHeight(max_h)
myFont{font},
myMaxWidth{max_w},
myMaxHeight{max_h}
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),

View File

@ -37,7 +37,7 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const Common::Size& imgSize)
: Widget(boss, font, x, y, w, h),
myAvail(imgSize)
myAvail{imgSize}
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = kDlgColor;

View File

@ -29,7 +29,7 @@
SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Snapshot settings"),
myFont(font)
myFont{font}
{
const int lineHeight = font.getLineHeight(),
fontHeight = _font.getFontHeight(),

View File

@ -32,7 +32,7 @@
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h, Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"),
myMode(mode)
myMode{mode}
{
const int buttonHeight = _font.getLineHeight() + _font.getLineHeight() / 5,
lineHeight = _font.getLineHeight(),

View File

@ -27,7 +27,7 @@ StringListWidget::StringListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, bool hilite,
bool useScrollbar)
: ListWidget(boss, font, x, y, w, h, useScrollbar),
_hilite(hilite)
_hilite{hilite}
{
_bgcolorlo = kDlgColor;

View File

@ -83,7 +83,7 @@ class TabWidget : public Widget, public CommandSender
explicit Tab(const string& t, int tw = NO_WIDTH,
Widget* first = nullptr, Widget* parent = nullptr, bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e), tabWidth(tw) { }
: title{t}, firstWidget{first}, parentWidget{parent}, enabled{e}, tabWidth{tw} { }
};
using TabList = vector<Tab>;

View File

@ -33,7 +33,7 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, uInt32 labelWidth, int cmd)
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
_labelWidth(labelWidth)
_labelWidth{labelWidth}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE
| Widget::FLAG_CLEARBG | Widget::FLAG_NOBG;
@ -205,13 +205,13 @@ void TimeLineWidget::drawWidget(bool hilite)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TimeLineWidget::valueToPos(uInt32 value)
uInt32 TimeLineWidget::valueToPos(uInt32 value) const
{
return _stepValue[BSPF::clamp(value, _valueMin, _valueMax)];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TimeLineWidget::posToValue(uInt32 pos)
uInt32 TimeLineWidget::posToValue(uInt32 pos) const
{
// Find the interval in which 'pos' falls, and then the endpoint which
// it is closest to

View File

@ -49,8 +49,8 @@ class TimeLineWidget : public ButtonWidget
void drawWidget(bool hilite) override;
uInt32 valueToPos(uInt32 value);
uInt32 posToValue(uInt32 pos);
uInt32 valueToPos(uInt32 value) const;
uInt32 posToValue(uInt32 pos) const;
protected:
uInt32 _value{0};

View File

@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimeMachine::TimeMachine(OSystem& osystem)
: DialogContainer(osystem),
myWidth(FBMinimum::Width)
myWidth{FBMinimum::Width}
{
myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth);
}

View File

@ -495,7 +495,7 @@ void TimeMachineDialog::initBar()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string TimeMachineDialog::getTimeString(uInt64 cycles)
string TimeMachineDialog::getTimeString(uInt64 cycles) const
{
const Int32 scanlines = std::max<Int32>(instance().console().tia().scanlinesLastFrame(), 240);
const bool isNTSC = scanlines <= 287;

View File

@ -33,7 +33,7 @@ class TimeMachineDialog : public Dialog
/** set/get number of winds when entering the dialog */
void setEnterWinds(Int32 numWinds) { _enterWinds = numWinds; }
Int32 getEnterWinds() { return _enterWinds; }
Int32 getEnterWinds() const { return _enterWinds; }
private:
void loadConfig() override;
@ -48,7 +48,7 @@ class TimeMachineDialog : public Dialog
void setPosition() override;
/** convert cycles into time */
string getTimeString(uInt64 cycles);
string getTimeString(uInt64 cycles) const;
/** re/unwind and update display */
void handleWinds(Int32 numWinds = 0);
/** toggle Time Machine mode */

View File

@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
: myDialog(dialog)
: myDialog{dialog}
{
myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
@ -179,5 +179,5 @@ void ToolTip::show(const string& tip)
void ToolTip::render()
{
if(myTipShown)
mySurface->render();
mySurface->render();
}

View File

@ -42,8 +42,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
: Dialog(osystem, parent, font, "User interface settings"),
CommandSender(boss),
myFont(font),
myIsGlobal(boss != nullptr)
myFont{font},
myIsGlobal{boss != nullptr}
{
const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(),

View File

@ -19,7 +19,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UndoHandler::UndoHandler(size_t size)
: mySize(size)
: mySize{size}
{
reset();
}

View File

@ -66,7 +66,7 @@ class VideoAudioDialog : public Dialog
void updateSettingsWithPreset(AudioSettings&);
private:
TabWidget* myTab;
TabWidget* myTab{nullptr};
// General options
PopUpWidget* myRenderer{nullptr};

View File

@ -32,8 +32,8 @@
Widget::Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: GuiObject(boss->instance(), boss->parent(), boss->dialog(), x, y, w, h),
_boss(boss),
_font(font)
_boss{boss},
_font{font}
{
// Insert into the widget list of the boss
_next = _boss->_firstWidget;
@ -395,8 +395,8 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
const string& text, TextAlign align,
ColorId shadowColor)
: Widget(boss, font, x, y, w, h),
_label(text),
_align(align)
_label{text},
_align{align}
{
_flags = Widget::FLAG_ENABLED | FLAG_CLEARBG;
@ -464,8 +464,8 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
const string& label, int cmd, bool repeat)
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
CommandSender(boss),
_cmd(cmd),
_repeat(repeat)
_cmd{cmd},
_repeat{repeat}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG;
_bgcolor = kBtnColor;
@ -739,11 +739,11 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
int valueLabelWidth, const string& valueUnit, int valueLabelGap,
bool forceLabelSign)
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
_labelWidth(labelWidth),
_valueUnit(valueUnit),
_valueLabelGap(valueLabelGap),
_valueLabelWidth(valueLabelWidth),
_forceLabelSign(forceLabelSign)
_labelWidth{labelWidth},
_valueUnit{valueUnit},
_valueLabelGap{valueLabelGap},
_valueLabelWidth{valueLabelWidth},
_forceLabelSign{forceLabelSign}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG;
_bgcolor = kDlgColor;

View File

@ -64,7 +64,7 @@ class FBSurfaceLIBRETRO : public FBSurface
void applyAttributes() override { }
private:
uInt32 myWidth, myHeight;
uInt32 myWidth{0}, myHeight{0};
unique_ptr<uInt32[]> myPixelData;
Common::Rect mySrcGUIR, myDstGUIR;

View File

@ -43,7 +43,7 @@ class StellaLIBRETRO
StellaLIBRETRO();
public:
OSystemLIBRETRO& osystem() { return *myOSystem; }
OSystemLIBRETRO& osystem() const { return *myOSystem; }
bool create(bool logging);
void destroy();

View File

@ -25,8 +25,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX()
: _path(ROOT_DIR),
_displayName(_path)
: _path{ROOT_DIR},
_displayName{_path}
{
}

View File

@ -175,7 +175,7 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
: _path(p.length() > 0 ? p : "~") // Default to home directory
: _path{p.length() > 0 ? p : "~"} // Default to home directory
{
// Expand '~' to the users 'home' directory
if(_path[0] == '~')