From 81145e509cdba68c94c4173e16ddd492cd813db8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Dec 2017 19:34:40 +0300 Subject: Remove default parameters from textfield. --- src/gui/widgets/chatinput.h | 3 ++- src/gui/widgets/inttextfield.cpp | 3 ++- src/gui/widgets/passwordfield.cpp | 6 +++--- src/gui/widgets/setupitem.cpp | 3 ++- src/gui/widgets/tabs/setup_colors.cpp | 12 ++++++++---- src/gui/widgets/textfield.h | 14 ++++++-------- src/gui/windows/changeemaildialog.cpp | 6 ++++-- src/gui/windows/charcreatedialog.cpp | 3 ++- src/gui/windows/editdialog.cpp | 3 ++- src/gui/windows/editserverdialog.cpp | 15 ++++++++++----- src/gui/windows/logindialog.cpp | 6 ++++-- src/gui/windows/maileditwindow.cpp | 9 ++++++--- src/gui/windows/npcdialog.cpp | 3 ++- src/gui/windows/registerdialog.cpp | 10 ++++++++-- src/gui/windows/textcommandeditor.cpp | 9 ++++++--- src/gui/windows/textdialog.cpp | 7 ++++++- src/gui/windows/tradewindow.cpp | 3 ++- 17 files changed, 75 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/chatinput.h b/src/gui/widgets/chatinput.h index 92c7dc341..286589ade 100644 --- a/src/gui/widgets/chatinput.h +++ b/src/gui/widgets/chatinput.h @@ -40,7 +40,8 @@ class ChatInput final : public TextField { public: explicit ChatInput(ChatWindow *const window) : - TextField(window, "", LoseFocusOnTab_false), + TextField(window, std::string(), + LoseFocusOnTab_false, nullptr, std::string(), false), mWindow(window), mFocusGaining(false) { diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index 41436d310..d67520c2b 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -38,7 +38,8 @@ IntTextField::IntTextField(const Widget2 *const widget, const int max, const Enable enabled, const int width) : - TextField(widget, toString(def)), + TextField(widget, toString(def), + LoseFocusOnTab_true, nullptr, std::string(), false), mMin(0), mMax(0), mDefault(def), diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index bc2ca4827..faa5bb876 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -28,10 +28,10 @@ PasswordField::PasswordField(const Widget2 *const widget, const std::string &text) : - TextField(widget, text), + TextField(widget, text, + LoseFocusOnTab_true, nullptr, std::string(), false), mPasswordChar(mSkin != nullptr ? CAST_8( - mSkin->getOption("passwordChar", 42)) - : CAST_8(42)) + mSkin->getOption("passwordChar", 42)) : CAST_8(42)) { } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 9a2bb663f..06f895f83 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -371,7 +371,8 @@ void SetupItemTextField::createControls() mValue, LoseFocusOnTab_true, mParent, - mEventName); + mEventName, + false); // TRANSLATORS: setup item button mButton = new Button(this, _("Edit"), mEventName + "_EDIT", mParent); mWidget = mTextField; diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index cdbda9415..d15fdc1b1 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -68,19 +68,23 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : // TRANSLATORS: colors tab. label. mGradDelayLabel(new Label(this, _("Delay:"))), mGradDelaySlider(new Slider(this, 20.0, 100.0, 1.0)), - mGradDelayText(new TextField(this)), + mGradDelayText(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), // TRANSLATORS: colors tab. label. mRedLabel(new Label(this, _("Red:"))), mRedSlider(new Slider(this, 0.0, 255.0, 1.0)), - mRedText(new TextField(this)), + mRedText(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), // TRANSLATORS: colors tab. label. mGreenLabel(new Label(this, _("Green:"))), mGreenSlider(new Slider(this, 0.0, 255.0, 1.0)), - mGreenText(new TextField(this)), + mGreenText(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), // TRANSLATORS: colors tab. label. mBlueLabel(new Label(this, _("Blue:"))), mBlueSlider(new Slider(this, 0.0, 255.0, 1.0)), - mBlueText(new TextField(this)) + mBlueText(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)) { // TRANSLATORS: settings colors tab name setName(_("Colors")); diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 8001008a1..73ce0c525 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -94,14 +94,12 @@ class TextField notfinal : public Widget, /** * Constructor, initializes the text field with the given string. */ - explicit TextField(const Widget2 *restrict const widget, - const std::string &restrict text = "", - const LoseFocusOnTab loseFocusOnTab = - LoseFocusOnTab_true, - ActionListener *restrict - const listener = nullptr, - const std::string &restrict eventId = "", - const bool sendAlwaysEvents = false); + TextField(const Widget2 *restrict const widget, + const std::string &restrict text, + const LoseFocusOnTab loseFocusOnTab, + ActionListener *restrict const listener, + const std::string &restrict eventId, + const bool sendAlwaysEvents); A_DELETE_COPY(TextField) diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp index 9d9358967..efb8bbcab 100644 --- a/src/gui/windows/changeemaildialog.cpp +++ b/src/gui/windows/changeemaildialog.cpp @@ -47,8 +47,10 @@ ChangeEmailDialog::ChangeEmailDialog(LoginData &data) : // TRANSLATORS: change email dialog header Window(_("Change Email Address"), Modal_true, nullptr, "changeemail.xml"), ActionListener(), - mFirstEmailField(new TextField(this)), - mSecondEmailField(new TextField(this)), + mFirstEmailField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), + mSecondEmailField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), // TRANSLATORS: button in change email dialog mChangeEmailButton(new Button(this, _("Change Email Address"), "change_email", this)), diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 4f9c82fe2..3a760e9a3 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -79,7 +79,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, ActionListener(), KeyListener(), mCharSelectDialog(parent), - mNameField(new TextField(this, "")), + mNameField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), // TRANSLATORS: char create dialog label mNameLabel(new Label(this, _("Name:"))), mNextHairColorButton(nullptr), diff --git a/src/gui/windows/editdialog.cpp b/src/gui/windows/editdialog.cpp index e14b96191..491e23b5f 100644 --- a/src/gui/windows/editdialog.cpp +++ b/src/gui/windows/editdialog.cpp @@ -38,7 +38,8 @@ EditDialog::EditDialog(const std::string &restrict title, Window(title, modal, parent, "edit.xml"), ActionListener(), mEventOk(eventOk), - mTextField(new TextField(this)) + mTextField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)) { mDefaultWidth = width; mTextField->setText(msg); diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 3b454466f..a659612fb 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -47,11 +47,16 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, Window(_("Edit Server"), Modal_true, parent), ActionListener(), KeyListener(), - mServerAddressField(new TextField(this, std::string())), - mPortField(new TextField(this, std::string())), - mNameField(new TextField(this, std::string())), - mDescriptionField(new TextField(this, std::string())), - mOnlineListUrlField(new TextField(this, std::string())), + mServerAddressField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), + mPortField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), + mNameField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), + mDescriptionField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), + mOnlineListUrlField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), mPacketVersionField(new IntTextField(this, 0, 0, maxPacketVersion, Enable_true, 0)), // TRANSLATORS: edit server dialog button diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index f9f63fef3..f43921328 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -69,7 +69,8 @@ LoginDialog::LoginDialog(LoginData &data, KeyListener(), mLoginData(&data), mServer(server), - mUserField(new TextField(this, mLoginData->username)), + mUserField(new TextField(this, mLoginData->username, + LoseFocusOnTab_true, nullptr, std::string(), false)), mPassField(new PasswordField(this, mLoginData->password)), // TRANSLATORS: login dialog label mKeepCheck(new CheckBox(this, _("Remember username"), @@ -89,7 +90,8 @@ LoginDialog::LoginDialog(LoginData &data, (mLoginData->updateType & UpdateType::Custom) != 0, this, "customhost")), mUpdateHostText(new TextField(this, serverConfig.getValue( - "customUpdateHost", ""))), + "customUpdateHost", ""), + LoseFocusOnTab_true, nullptr, std::string(), false)), mUpdateListModel(nullptr), mUpdateHostDropDown(nullptr), mUpdateHost(updateHost), diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index 1da222b30..b70188786 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -69,11 +69,14 @@ MailEditWindow::MailEditWindow() : mItemLabel(new Label(this, _("Item:"))), // TRANSLATORS: mail edit window label mMessageLabel(new Label(this, _("Message:"))), - mToField(new TextField(this)), - mSubjectField(new TextField(this)), + mToField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), + mSubjectField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), mMoneyField(new IntTextField(this, 0, 0, settings.enableNewMailSystem ? INT_MAX : 10000000, Enable_true, 0)), - mMessageField(new TextField(this)), + mMessageField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), mInventory(new Inventory(InventoryType::MailEdit, settings.enableNewMailSystem ? -1 : 1)), mItemContainer(new ItemContainer(this, mInventory, 100000, diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index c59d66b48..e3a8a0292 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -120,7 +120,8 @@ NpcDialog::NpcDialog(const BeingId npcId) : fromBool(getOptionBool("showlistbackground"), Opaque), "npc_listbackground.xml")), mItemLinkHandler(new ItemLinkHandler), - mTextField(new TextField(this, "")), + mTextField(new TextField(this, std::string(), LoseFocusOnTab_true, + nullptr, std::string(), false)), mIntField(new IntTextField(this, 0, 0, 0, Enable_true, 0)), // TRANSLATORS: npc dialog button mPlusButton(new Button(this, _("+"), "inc", this)), diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 0f19e572e..1551ec449 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -54,7 +54,8 @@ RegisterDialog::RegisterDialog(LoginData &data) : ActionListener(), KeyListener(), mLoginData(&data), - mUserField(new TextField(this, mLoginData->username)), + mUserField(new TextField(this, mLoginData->username, LoseFocusOnTab_true, + nullptr, std::string(), false)), mPasswordField(new PasswordField(this, mLoginData->password)), mConfirmField(new PasswordField(this, std::string())), mEmailField(nullptr), @@ -103,7 +104,12 @@ RegisterDialog::RegisterDialog(LoginData &data) : { // TRANSLATORS: register dialog. label. Label *const emailLabel = new Label(this, _("Email:")); - mEmailField = new TextField(this); + mEmailField = new TextField(this, + std::string(), + LoseFocusOnTab_true, + nullptr, + std::string(), + false); placer(0, row, emailLabel, 1, 1); placer(1, row, mEmailField, 3, 1).setPadding(2); mEmailField->addKeyListener(this); diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 62ffc36f8..1e6407a85 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -68,13 +68,16 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : #endif // TMWA_SUPPORT // TRANSLATORS: command editor label mSymbolLabel(new Label(this, _("Symbol:"))), - mSymbolTextField(new TextField(this)), + mSymbolTextField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), // TRANSLATORS: command editor label mCommandLabel(new Label(this, _("Command:"))), - mCommandTextField(new TextField(this)), + mCommandTextField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), // TRANSLATORS: command editor label mCommentLabel(new Label(this, _("Comment:"))), - mCommentTextField(new TextField(this)), + mCommentTextField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), mTargetTypeModel(new TargetTypeModel), // TRANSLATORS: command editor label mTypeLabel(new Label(this, _("Target Type:"))), diff --git a/src/gui/windows/textdialog.cpp b/src/gui/windows/textdialog.cpp index d73c056d0..405e4667c 100644 --- a/src/gui/windows/textdialog.cpp +++ b/src/gui/windows/textdialog.cpp @@ -67,7 +67,12 @@ TextDialog::TextDialog(const std::string &restrict title, } else { - mTextField = new TextField(this); + mTextField = new TextField(this, + std::string(), + LoseFocusOnTab_true, + nullptr, + std::string(), + false); place(0, 1, mTextField, 4, 1); } place(2, 2, mOkButton, 1, 1); diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 8b730218c..b264fc7fc 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -90,7 +90,8 @@ TradeWindow::TradeWindow() : mOkButton(new Button(this, "", "", this)), // Will be filled in later // TRANSLATORS: trade window money change button mMoneyChangeButton(new Button(this, _("Change"), "money", this)), - mMoneyField(new TextField(this)), + mMoneyField(new TextField(this, std::string(), + LoseFocusOnTab_true, nullptr, std::string(), false)), mAutoAddItem(nullptr), mAutoAddToNick(""), mGotMoney(0), -- cgit v1.2.3-70-g09d2