From 03f4d4beaaa2ea4ac99aa746460283d4ca644a3f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Dec 2017 21:50:46 +0300 Subject: Remove default parameters from dropdown. --- src/gui/models/playertablemodel.cpp | 7 ++++++- src/gui/widgets/dropdown.cpp | 2 +- src/gui/widgets/dropdown.h | 10 ++++----- src/gui/widgets/setupitem.cpp | 14 +++++++++++-- src/gui/widgets/setuptouchitem.cpp | 7 ++++++- src/gui/widgets/tabs/setup_joystick.cpp | 3 ++- src/gui/widgets/tabs/setup_relations.cpp | 3 ++- src/gui/widgets/tabs/setup_theme.cpp | 36 +++++++++++++++++++++----------- src/gui/widgets/tabs/setup_video.cpp | 3 ++- src/gui/windows/chatwindow.cpp | 3 ++- src/gui/windows/editserverdialog.cpp | 3 ++- src/gui/windows/inventorywindow.cpp | 2 +- src/gui/windows/itemamountwindow.cpp | 7 ++++++- src/gui/windows/logindialog.cpp | 3 ++- src/gui/windows/textcommandeditor.cpp | 9 +++++--- 15 files changed, 79 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp index 161e82dc2..6192f8d21 100644 --- a/src/gui/models/playertablemodel.cpp +++ b/src/gui/models/playertablemodel.cpp @@ -105,7 +105,12 @@ void PlayerTableModel::playerRelationsUpdated() Widget *const widget = new Label(this, name); mWidgets.push_back(widget); - DropDown *const choicebox = new DropDown(this, mListModel); + DropDown *const choicebox = new DropDown(this, + mListModel, + false, + Modal_false, + nullptr, + std::string()); choicebox->setSelected(CAST_S32( playerRelations.getRelation(name))); mWidgets.push_back(choicebox); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 0a42404a7..7e9de9b53 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -393,7 +393,7 @@ void DropDown::mousePressed(MouseEvent& event) { mPushed = false; foldUp(); - hideDrop(); + hideDrop(true); } } diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 029850766..ec2e2136e 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -57,10 +57,10 @@ class DropDown final : public ActionListener, public: DropDown(const Widget2 *const widget, ListModel *const listModel, - const bool extended = false, - const Modal modal = Modal_false, - ActionListener *const listener = nullptr, - const std::string &eventId = ""); + const bool extended, + const Modal modal, + ActionListener *const listener, + const std::string &eventId); A_DELETE_COPY(DropDown) @@ -110,7 +110,7 @@ class DropDown final : public ActionListener, void foldUp(); - void hideDrop(bool event = true); + void hideDrop(bool event); int getSelected() const; diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 06f895f83..018ed30d8 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -697,7 +697,12 @@ void SetupItemDropDown::createControls() mLabel = new Label(this, mText); mLabel->setToolTip(mDescription); - mDropDown = new DropDown(this, mModel); + mDropDown = new DropDown(this, + mModel, + false, + Modal_false, + nullptr, + std::string()); mDropDown->setActionEventId(mEventName); mDropDown->addActionListener(mParent); mDropDown->setWidth(mWidth); @@ -798,7 +803,12 @@ void SetupItemDropDownStr::createControls() mLabel = new Label(this, mText); mLabel->setToolTip(mDescription); - mDropDown = new DropDown(this, mModel); + mDropDown = new DropDown(this, + mModel, + false, + Modal_false, + nullptr, + std::string()); mDropDown->setActionEventId(mEventName); mDropDown->addActionListener(mParent); mDropDown->setWidth(mWidth); diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index 122853c7e..13580c222 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -95,7 +95,12 @@ void SetupActionDropDown::createControls() mLabel = new Label(this, mText); mLabel->setToolTip(mDescription); - mDropDown = new DropDown(this, mModel); + mDropDown = new DropDown(this, + mModel, + false, + Modal_false, + nullptr, + std::string()); mDropDown->setActionEventId(mEventName); mDropDown->addActionListener(mParent); mDropDown->setWidth(mWidth); diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index 927215e1e..04ec3eee4 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -53,7 +53,8 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : mJoystickEnabled(new CheckBox(this, _("Enable joystick"), false, nullptr, std::string())), mNamesModel(new NamesModel), - mNamesDropDown(new DropDown(this, mNamesModel)), + mNamesDropDown(new DropDown(this, mNamesModel, + false, Modal_false, nullptr, std::string())), mUseInactiveCheckBox(new CheckBox(this, // TRANSLATORS: joystick settings tab checkbox _("Use joystick if client window inactive"), diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 80e9526f0..c922d210c 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -80,7 +80,8 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : // TRANSLATORS: relation dialog button mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, this)), mIgnoreActionChoicesModel(new IgnoreChoicesListModel), - mIgnoreActionChoicesBox(new DropDown(widget, mIgnoreActionChoicesModel)) + mIgnoreActionChoicesBox(new DropDown(widget, mIgnoreActionChoicesModel, + false, Modal_false, nullptr, std::string())) { // TRANSLATORS: relation dialog name setName(_("Relations")); diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index e8baed86f..6f4e237a6 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -62,57 +62,69 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : // TRANSLATORS: theme settings label mThemeLabel(new Label(this, _("Gui theme"))), mThemesModel(new ThemesModel), - mThemeDropDown(new DropDown(this, mThemesModel)), + mThemeDropDown(new DropDown(this, mThemesModel, + false, Modal_false, nullptr, std::string())), mTheme(config.getStringValue("theme")), mInfo(Theme::loadInfo(mTheme)), mFontsModel(new FontsModel), // TRANSLATORS: theme settings label mFontLabel(new Label(this, _("Main Font"))), - mFontDropDown(new DropDown(this, mFontsModel)), + mFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mFont(config.getStringValue("font")), mLangListModel(new LangListModel), // TRANSLATORS: theme settings label mLangLabel(new Label(this, _("Language"))), - mLangDropDown(new DropDown(this, mLangListModel, true)), + mLangDropDown(new DropDown(this, mLangListModel, + true, Modal_false, nullptr, std::string())), mLang(config.getStringValue("lang")), // TRANSLATORS: theme settings label mBoldFontLabel(new Label(this, _("Bold font"))), - mBoldFontDropDown(new DropDown(this, mFontsModel)), + mBoldFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mBoldFont(config.getStringValue("boldFont")), // TRANSLATORS: theme settings label mParticleFontLabel(new Label(this, _("Particle font"))), - mParticleFontDropDown(new DropDown(this, mFontsModel)), + mParticleFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mParticleFont(config.getStringValue("particleFont")), // TRANSLATORS: theme settings label mHelpFontLabel(new Label(this, _("Help font"))), - mHelpFontDropDown(new DropDown(this, mFontsModel)), + mHelpFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mHelpFont(config.getStringValue("helpFont")), // TRANSLATORS: theme settings label mSecureFontLabel(new Label(this, _("Secure font"))), - mSecureFontDropDown(new DropDown(this, mFontsModel)), + mSecureFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mSecureFont(config.getStringValue("secureFont")), // TRANSLATORS: theme settings label mNpcFontLabel(new Label(this, _("Npc font"))), - mNpcFontDropDown(new DropDown(this, mFontsModel)), + mNpcFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mNpcFont(config.getStringValue("npcFont")), // TRANSLATORS: theme settings label mJapanFontLabel(new Label(this, _("Japanese font"))), - mJapanFontDropDown(new DropDown(this, mFontsModel)), + mJapanFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mJapanFont(config.getStringValue("japanFont")), // TRANSLATORS: theme settings label mChinaFontLabel(new Label(this, _("Chinese font"))), - mChinaFontDropDown(new DropDown(this, mFontsModel)), + mChinaFontDropDown(new DropDown(this, mFontsModel, + false, Modal_false, nullptr, std::string())), mChinaFont(config.getStringValue("chinaFont")), mFontSizeListModel(new FontSizeChoiceListModel), // TRANSLATORS: theme settings label mFontSizeLabel(new Label(this, _("Font size"))), mFontSize(config.getIntValue("fontSize")), - mFontSizeDropDown(new DropDown(this, mFontSizeListModel)), + mFontSizeDropDown(new DropDown(this, mFontSizeListModel, + false, Modal_false, nullptr, std::string())), mNpcFontSizeListModel(new FontSizeChoiceListModel), // TRANSLATORS: theme settings label mNpcFontSizeLabel(new Label(this, _("Npc font size"))), mNpcFontSize(config.getIntValue("npcfontSize")), - mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel)), + mNpcFontSizeDropDown(new DropDown(this, mNpcFontSizeListModel, + false, Modal_false, nullptr, std::string())), // TRANSLATORS: button name with information about selected theme mInfoButton(new Button(this, _("i"), ACTION_INFO, this)), mThemeInfo() diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 7d8e474ea..3404f5fcc 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -74,7 +74,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : // TRANSLATORS: video settings checkbox mFsCheckBox(new CheckBox(this, _("Full screen"), mFullScreenEnabled, nullptr, std::string())), - mOpenGLDropDown(new DropDown(widget, mOpenGLListModel)), + mOpenGLDropDown(new DropDown(widget, mOpenGLListModel, + false, Modal_false, nullptr, std::string())), // TRANSLATORS: video settings checkbox mFpsCheckBox(new CheckBox(this, _("FPS limit:"), false, nullptr, std::string())), diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 9eb01a3ad..b3d1679a2 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -107,7 +107,8 @@ ChatWindow::ChatWindow(const std::string &name) : mCustomWords(), mTradeFilter(), mColorListModel(new ColorListModel), - mColorPicker(new DropDown(this, mColorListModel)), + mColorPicker(new DropDown(this, mColorListModel, + false, Modal_false, nullptr, std::string())), mChatButton(new Button(this, ":)", "openemote", this)), mAwayLog(), mHighlights(), diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index a659612fb..4354a5b29 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -69,7 +69,8 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPersistentIp(new CheckBox(this, _("Use same ip"), true, this, "persistentIp")), mTypeListModel(new TypeListModel), - mTypeField(new DropDown(this, mTypeListModel, false, Modal_true)), + mTypeField(new DropDown(this, mTypeListModel, + false, Modal_true, nullptr, std::string())), mServerDialog(parent), mServer(server), mIndex(index) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 00ce036e8..088f67c42 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -1028,7 +1028,7 @@ void InventoryWindow::widgetResized(const Event &event) void InventoryWindow::setVisible(Visible visible) { if (visible == Visible_false) - mSortDropDown->hideDrop(); + mSortDropDown->hideDrop(true); Window::setVisible(visible); } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 773e53e82..1e568572a 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -187,7 +187,12 @@ ItemAmountWindow::ItemAmountWindow(const ItemAmountWindowUsageT usage, if (mUsage == ItemAmountWindowUsage::ShopBuyAdd) { mItemsModal = new ItemsModal; - mItemDropDown = new DropDown(this, mItemsModal); + mItemDropDown = new DropDown(this, + mItemsModal, + false, + Modal_false, + nullptr, + std::string()); mItemDropDown->setActionEventId("itemType"); mItemDropDown->addActionListener(this); } diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 076ce14df..0f9829ae5 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -78,7 +78,8 @@ LoginDialog::LoginDialog(LoginData &data, // TRANSLATORS: login dialog label mUpdateTypeLabel(new Label(this, _("Update:"))), mUpdateTypeModel(new UpdateTypeModel), - mUpdateTypeDropDown(new DropDown(this, mUpdateTypeModel)), + mUpdateTypeDropDown(new DropDown(this, mUpdateTypeModel, + false, Modal_false, nullptr, std::string())), // TRANSLATORS: login dialog button mServerButton(new Button(this, _("Change Server"), "server", this)), // TRANSLATORS: login dialog button diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 1e6407a85..d59868131 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -81,11 +81,13 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mTargetTypeModel(new TargetTypeModel), // TRANSLATORS: command editor label mTypeLabel(new Label(this, _("Target Type:"))), - mTypeDropDown(new DropDown(this, mTargetTypeModel)), + mTypeDropDown(new DropDown(this, mTargetTypeModel, + false, Modal_false, nullptr, std::string())), mIconsModel(new IconsModel), // TRANSLATORS: command editor label mIconLabel(new Label(this, _("Icon:"))), - mIconDropDown(new DropDown(this, mIconsModel)), + mIconDropDown(new DropDown(this, mIconsModel, + false, Modal_false, nullptr, std::string())), #ifdef TMWA_SUPPORT // TRANSLATORS: command editor label mManaLabel(new Label(this, _("Mana:"))), @@ -96,7 +98,8 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mMagicSchoolModel(new MagicSchoolModel), // TRANSLATORS: command editor label mSchoolLabel(new Label(this, _("Magic School:"))), - mSchoolDropDown(new DropDown(this, mMagicSchoolModel)), + mSchoolDropDown(new DropDown(this, mMagicSchoolModel, + false, Modal_false, nullptr, std::string())), // TRANSLATORS: command editor label mSchoolLvlLabel(new Label(this, _("School level:"))), mSchoolLvlField(new IntTextField(this, 0, 0, 0, Enable_true, 0)), -- cgit v1.2.3-60-g2f50