diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-05 18:29:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-05 18:29:07 +0300 |
commit | 71fd4e8d3255e15c16a4f4b51c87222c661a5b33 (patch) | |
tree | 3942aec29f33b5ea2aa2e353451e10648f1bbb82 /src/gui/widgets | |
parent | 45460ca58b3cbf6d92fe3cac1311bbfc9d00e841 (diff) | |
download | plus-71fd4e8d3255e15c16a4f4b51c87222c661a5b33.tar.gz plus-71fd4e8d3255e15c16a4f4b51c87222c661a5b33.tar.bz2 plus-71fd4e8d3255e15c16a4f4b51c87222c661a5b33.tar.xz plus-71fd4e8d3255e15c16a4f4b51c87222c661a5b33.zip |
Add strong typed bool type for modal bool flag.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_input.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_theme.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_video.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 8 |
7 files changed, 43 insertions, 18 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 4cb998c69..7008602de 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -67,7 +67,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) { ConfirmDialog *const confirmDlg = new ConfirmDialog( // TRANSLATORS: dialog message - _("Open url"), url, SOUND_REQUEST, false, true); + _("Open url"), url, SOUND_REQUEST, false, Modal_true); confirmDlg->postInit(); confirmDlg->addActionListener(&listener); } diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index 828030b9e..5422ea3b0 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -48,7 +48,7 @@ SellDialog::DialogList SellDialog::instances; SellDialog::SellDialog(const bool isSell) : // TRANSLATORS: sell dialog name - Window(_("Sell"), false, nullptr, "sell.xml"), + Window(_("Sell"), Modal_false, nullptr, "sell.xml"), ActionListener(), SelectionListener(), mSellButton(nullptr), diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 22dcc9e18..3328cdb28 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -163,7 +163,10 @@ void Setup_Input::apply() // TRANSLATORS: ok dialog button _("OK"), DialogType::ERROR, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } keyboard.setEnabled(true); inputManager.store(); diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index de4990e5c..e795b0928 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -311,7 +311,10 @@ void Setup_Theme::action(const ActionEvent &event) // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - false, true, nullptr, 600); + Modal_false, + true, + nullptr, + 600); } } @@ -342,7 +345,10 @@ void Setup_Theme::apply() // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } config.setValue("selectedSkin", ""); diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index caf12e4cd..8c4be5f85 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -249,7 +249,10 @@ void Setup_Video::apply() // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } #endif config.setValue("screen", fullscreen); @@ -273,7 +276,10 @@ void Setup_Video::apply() // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } mFps = mFpsCheckBox->isSelected() ? @@ -388,7 +394,10 @@ void Setup_Video::action(const ActionEvent &event) // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } else { @@ -400,7 +409,10 @@ void Setup_Video::action(const ActionEvent &event) // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, - true, true, nullptr, 260); + Modal_true, + true, + nullptr, + 260); } } #else diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index f29027566..c438b5475 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -98,8 +98,10 @@ const int resizeMask = 8 + 4 + 2 + 1; int Window::windowInstances = 0; int Window::mouseResize = 0; -Window::Window(const std::string &caption, const bool modal, - Window *const parent, std::string skin) : +Window::Window(const std::string &caption, + const Modal modal, + Window *const parent, + std::string skin) : BasicContainer2(nullptr), MouseListener(), WidgetListener(), @@ -137,8 +139,8 @@ Window::Window(const std::string &caption, const bool modal, mResizeHandles(-1), mOldResizeHandles(-1), mCaptionFont(getFont()), - mShowTitle(true), mModal(modal), + mShowTitle(true), mCloseWindowButton(false), mDefaultVisible(false), mSaveVisible(false), @@ -201,7 +203,7 @@ Window::Window(const std::string &caption, const bool modal, if (windowContainer) windowContainer->add(this); - if (mModal) + if (mModal == Modal_true) { gui->setCursorType(Cursor::CURSOR_POINTER); requestModalFocus(); @@ -938,12 +940,12 @@ void Window::mouseDragged(MouseEvent &event) } } -void Window::setModal(const bool modal) +void Window::setModal(const Modal modal) { if (mModal != modal) { mModal = modal; - if (mModal) + if (mModal == Modal_true) { if (gui) gui->setCursorType(Cursor::CURSOR_POINTER); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index d04b16cdf..2b2bdb261 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -66,6 +66,8 @@ #ifndef GUI_WIDGETS_WINDOW_H #define GUI_WIDGETS_WINDOW_H +#include "enums/simpletypes.h" + #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" @@ -105,7 +107,7 @@ class Window notfinal : public BasicContainer2, * @param skin The location where the window's skin XML can be found. */ explicit Window(const std::string &caption = "Window", - const bool modal = false, + const Modal modal = Modal_false, Window *const parent = nullptr, std::string skin = ""); @@ -448,7 +450,7 @@ class Window notfinal : public BasicContainer2, /** * Allows the windows modal status to change */ - void setModal(const bool modal); + void setModal(const Modal modal); Rect getWindowArea() const A_WARN_UNUSED; @@ -691,8 +693,8 @@ class Window notfinal : public BasicContainer2, int mResizeHandles; int mOldResizeHandles; Font *mCaptionFont; + Modal mModal; /**< Window is modal */ bool mShowTitle; /**< Window has a title bar */ - bool mModal; /**< Window is modal */ bool mCloseWindowButton; /**< Window has a close button */ bool mDefaultVisible; /**< Window's default visibility */ bool mSaveVisible; /**< Window will save visibility */ |