diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-20 21:28:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-21 00:02:09 +0300 |
commit | 61fe8be42f900b601a7fb757ebcb774a13aa429f (patch) | |
tree | 3604047fc714da4e9a587b4bf2383609839bd3a8 /src/gui | |
parent | 88dce37e55491ec916fef8fe6cf082c88fcd0550 (diff) | |
download | mv-61fe8be42f900b601a7fb757ebcb774a13aa429f.tar.gz mv-61fe8be42f900b601a7fb757ebcb774a13aa429f.tar.bz2 mv-61fe8be42f900b601a7fb757ebcb774a13aa429f.tar.xz mv-61fe8be42f900b601a7fb757ebcb774a13aa429f.zip |
improve setup video tab.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/setup_video.cpp | 39 | ||||
-rw-r--r-- | src/gui/setup_video.h | 18 |
2 files changed, 16 insertions, 41 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 65e06d271..4e62d5445 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -62,31 +62,20 @@ extern Graphics *mainGraphics; -/** - * The list model for mode list. - * - * \ingroup Interface - */ class ModeListModel final : public gcn::ListModel { public: - /** - * Constructor. - */ ModeListModel(); A_DELETE_COPY(ModeListModel) - /** - * Destructor. - */ virtual ~ModeListModel() { } /** * Returns the number of elements in container. */ - int getNumberOfElements() + int getNumberOfElements() override { return static_cast<int>(mVideoModes.size()); } /** @@ -103,15 +92,13 @@ class ModeListModel final : public gcn::ListModel int getIndexOf(const std::string &widthXHeightMode); private: - void addCustomMode(std::string mode); + void addCustomMode(const std::string &mode); StringVect mVideoModes; }; #ifndef ANDROID -static bool modeSorter(std::string mode1, std::string mode2); - -static bool modeSorter(std::string mode1, std::string mode2) +static bool modeSorter(const std::string &mode1, const std::string &mode2) { const int width1 = atoi(mode1.substr(0, mode1.find("x")).c_str()); const int height1 = atoi(mode1.substr(mode1.find("x") + 1).c_str()); @@ -151,7 +138,7 @@ ModeListModel::ModeListModel() : #endif } -void ModeListModel::addCustomMode(std::string mode) +void ModeListModel::addCustomMode(const std::string &mode) { StringVectCIter it = mVideoModes.begin(); const StringVectCIter it_end = mVideoModes.end(); @@ -196,14 +183,14 @@ public: virtual ~OpenGLListModel() { } - virtual int getNumberOfElements() + virtual int getNumberOfElements() override #ifdef ANDROID { return 2; } #else { return 4; } #endif - virtual std::string getElementAt(int i) + virtual std::string getElementAt(int i) override { if (i >= getNumberOfElements() || i < 0) return "???"; @@ -216,11 +203,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : gcn::KeyListener(), mFullScreenEnabled(config.getBoolValue("screen")), mOpenGLEnabled(config.getIntValue("opengl")), - mCustomCursorEnabled(config.getBoolValue("customcursor")), mFps(config.getIntValue("fpslimit")), mAltFps(config.getIntValue("altfpslimit")), - mEnableResize(config.getBoolValue("enableresize")), - mNoFrame(config.getBoolValue("noframe")), mModeListModel(new ModeListModel), mOpenGLListModel(new OpenGLListModel), mModeList(new ListBox(widget, mModeListModel, "")), @@ -252,7 +236,10 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : // TRANSLATORS: video settings button mDetectButton(new Button(this, _("Detect best mode"), "detect", this)), #endif - mDialog(nullptr) + mDialog(nullptr), + mCustomCursorEnabled(config.getBoolValue("customcursor")), + mEnableResize(config.getBoolValue("enableresize")), + mNoFrame(config.getBoolValue("noframe")) { // TRANSLATORS: video settings tab name setName(_("Video")); @@ -288,7 +275,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : mFpsCheckBox->setSelected(mFps > 0); // Pre-select the current video mode. - std::string videoMode = toString(mainGraphics->mWidth).append("x") + const std::string videoMode = toString(mainGraphics->mWidth).append("x") .append(toString(mainGraphics->mHeight)); mModeList->setSelected(mModeListModel->getIndexOf(videoMode)); @@ -617,7 +604,3 @@ void Setup_Video::action(const gcn::ActionEvent &event) } #endif } - -void Setup_Video::externalUpdated() -{ -} diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 45fcd65cf..86d60987a 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -48,45 +48,37 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener ~Setup_Video(); - void apply(); + void apply() override; - void cancel(); + void cancel() override; void action(const gcn::ActionEvent &event) override; - virtual void externalUpdated(); - private: bool mFullScreenEnabled; int mOpenGLEnabled; - bool mCustomCursorEnabled; int mFps; int mAltFps; - bool mEnableResize; - bool mNoFrame; - ModeListModel *mModeListModel; - OpenGLListModel *mOpenGLListModel; - ListBox *mModeList; CheckBox *mFsCheckBox; DropDown *mOpenGLDropDown; CheckBox *mCustomCursorCheckBox; - CheckBox *mEnableResizeCheckBox; CheckBox *mNoFrameCheckBox; - CheckBox *mFpsCheckBox; Slider *mFpsSlider; Label *mFpsLabel; Slider *mAltFpsSlider; Label *mAltFpsLabel; - #if !defined(ANDROID) && !defined(__APPLE__) Button *mDetectButton; #endif TextDialog *mDialog; + bool mCustomCursorEnabled; + bool mEnableResize; + bool mNoFrame; }; #endif |