diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-18 01:33:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-19 15:12:19 +0300 |
commit | 9cbca4642e49aadb3e5e6b6055261590d754629d (patch) | |
tree | 0bd2b26926e079f209fa2d023530c416de3c64c4 | |
parent | 031a455d23a5b04bb2bcd32e43a946fd60be7c6a (diff) | |
download | manaverse-9cbca4642e49aadb3e5e6b6055261590d754629d.tar.gz manaverse-9cbca4642e49aadb3e5e6b6055261590d754629d.tar.bz2 manaverse-9cbca4642e49aadb3e5e6b6055261590d754629d.tar.xz manaverse-9cbca4642e49aadb3e5e6b6055261590d754629d.zip |
move virtual member calls from editserverdialog constuctor into postInit.
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.h | 2 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 14 |
3 files changed, 18 insertions, 7 deletions
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 2a6814525..1aafa11f0 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -185,9 +185,6 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, } setLocationRelativeTo(getParentWindow()); - setVisible(true); - - mNameField->requestFocus(); } EditServerDialog::~EditServerDialog() @@ -195,6 +192,12 @@ EditServerDialog::~EditServerDialog() delete mTypeListModel; } +void EditServerDialog::postInit() +{ + setVisible(true); + mNameField->requestFocus(); +} + void EditServerDialog::action(const gcn::ActionEvent &event) { const std::string &eventId = event.getId(); diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index 6ab784eb3..dd69b9771 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -85,6 +85,8 @@ class EditServerDialog final : public Window, ~EditServerDialog(); + void postInit() override; + /** * Called when receiving actions from the widgets. */ diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index d69471eac..3b0f9e6c9 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -414,13 +414,16 @@ void ServerDialog::action(const gcn::ActionEvent &event) } else if (eventId == "addEntry") { - new EditServerDialog(this, ServerInfo(), -1); + (new EditServerDialog(this, ServerInfo(), -1))->postInit(); } else if (eventId == "editEntry") { const int index = mServersList->getSelected(); if (index >= 0) - new EditServerDialog(this, mServers.at(index), index); + { + (new EditServerDialog(this, mServers.at(index), + index))->postInit(); + } } else if (eventId == "remove") { @@ -451,7 +454,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) return; case Input::KEY_GUI_INSERT: - new EditServerDialog(this, ServerInfo(), -1); + (new EditServerDialog(this, ServerInfo(), -1))->postInit(); return; case Input::KEY_GUI_DELETE: @@ -470,7 +473,10 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) { const int index = mServersList->getSelected(); if (index >= 0) - new EditServerDialog(this, mServers.at(index), index); + { + (new EditServerDialog(this, mServers.at(index), + index))->postInit(); + } return; } |