summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-19 12:44:17 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-19 15:12:22 +0300
commitd5bd11b08e4c49a22b40834c0607e3c9927aecd1 (patch)
tree5480ef3be37dd680a5ba6a0b20224711e3e56233 /src
parenta259a5380ca980da4fcfb866777192231aa9f854 (diff)
downloadplus-d5bd11b08e4c49a22b40834c0607e3c9927aecd1.tar.gz
plus-d5bd11b08e4c49a22b40834c0607e3c9927aecd1.tar.bz2
plus-d5bd11b08e4c49a22b40834c0607e3c9927aecd1.tar.xz
plus-d5bd11b08e4c49a22b40834c0607e3c9927aecd1.zip
move virtual member calls from textdialog constructor into postInit.
Diffstat (limited to 'src')
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp1
-rw-r--r--src/gui/windows/charselectdialog.cpp1
-rw-r--r--src/gui/windows/socialwindow.cpp4
-rw-r--r--src/gui/windows/textdialog.cpp7
-rw-r--r--src/gui/windows/textdialog.h2
6 files changed, 15 insertions, 2 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index daee76630..67310deef 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1329,6 +1329,7 @@ void PopupMenu::handleLink(const std::string &link,
mDialog = new TextDialog(_("Rename map sign "),
// TRANSLATORS: number of chars in string should be near original
_("Name: "));
+ mDialog->postInit();
mRenameListener.setDialog(mDialog);
mDialog->setText(mMapItem->getComment());
mDialog->setActionEventId("ok");
@@ -1354,6 +1355,7 @@ void PopupMenu::handleLink(const std::string &link,
_("Player comment "),
// TRANSLATORS: number of chars in string should be near original
_("Comment: "));
+ dialog->postInit();
mPlayerListener.setDialog(dialog);
mPlayerListener.setNick(mNick);
mPlayerListener.setType(mType);
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 884416be1..7ce063746 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -463,6 +463,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
_("Custom resolution (example: 1024x768)"),
// TRANSLATORS: resolution question dialog
_("Enter new resolution: "));
+ mDialog->postInit();
mDialog->setActionEventId("videomode");
mDialog->addActionListener(this);
return;
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index d99b973b3..763ddebd7 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -432,6 +432,7 @@ void CharSelectDialog::askPasswordForDeletion(const int index)
// TRANSLATORS: char deletion question.
_("Enter password for deleting character"), _("Enter password:"),
this, true);
+ mDeleteDialog->postInit();
mDeleteDialog->setActionEventId("try delete character");
mDeleteDialog->addActionListener(this);
}
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 3e00ee4ff..97f0211d8 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -252,6 +252,7 @@ public:
// TRANSLATORS: guild invite message
strprintf(_("Who would you like to invite to guild %s?"),
mGuild->getName().c_str()), socialWindow);
+ mInviteDialog->postInit();
mInviteDialog->setActionEventId("do invite");
mInviteDialog->addActionListener(this);
}
@@ -453,6 +454,7 @@ public:
// TRANSLATORS: party invite message
strprintf(_("Who would you like to invite to party %s?"),
mParty->getName().c_str()), socialWindow);
+ mInviteDialog->postInit();
mInviteDialog->setActionEventId("do invite");
mInviteDialog->addActionListener(this);
}
@@ -1609,6 +1611,7 @@ void SocialWindow::showGuildCreate()
mGuildCreateDialog = new TextDialog(_("Guild Name"),
// TRANSLATORS: guild creation message
_("Choose your guild's name."), this);
+ mGuildCreateDialog->postInit();
mGuildCreateDialog->setActionEventId("create guild");
mGuildCreateDialog->addActionListener(this);
}
@@ -1721,6 +1724,7 @@ void SocialWindow::showPartyCreate()
mPartyCreateDialog = new TextDialog(_("Party Name"),
// TRANSLATORS: party creation message
_("Choose your party's name."), this);
+ mPartyCreateDialog->postInit();
mPartyCreateDialog->setActionEventId("create party");
mPartyCreateDialog->addActionListener(this);
}
diff --git a/src/gui/windows/textdialog.cpp b/src/gui/windows/textdialog.cpp
index 3f62cef08..92cfa46d2 100644
--- a/src/gui/windows/textdialog.cpp
+++ b/src/gui/windows/textdialog.cpp
@@ -78,7 +78,10 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
{
reflowLayout(static_cast<int>(textLabel->getWidth() + 20));
}
+}
+void TextDialog::postInit()
+{
if (getParent())
{
setLocationRelativeTo(getParent());
@@ -86,9 +89,9 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
}
setVisible(true);
requestModalFocus();
- if (isPassword)
+ if (mPasswordField)
mPasswordField->requestFocus();
- else
+ else if (mTextField)
mTextField->requestFocus();
instances++;
diff --git a/src/gui/windows/textdialog.h b/src/gui/windows/textdialog.h
index f3f4612de..c783c6ed2 100644
--- a/src/gui/windows/textdialog.h
+++ b/src/gui/windows/textdialog.h
@@ -51,6 +51,8 @@ public:
~TextDialog();
+ void postInit() override;
+
/**
* Called when receiving actions from the widgets.
*/