diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-14 19:29:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-14 19:29:50 +0300 |
commit | a684227b26e1e4856e67fc6116b0e09cbffac1f4 (patch) | |
tree | 81a603933081a6e1463cfa45ff4909070335d9e4 /src/gui/windows/serverdialog.cpp | |
parent | 773a510e8a063962443a88633ffa226a989ba900 (diff) | |
download | manaverse-a684227b26e1e4856e67fc6116b0e09cbffac1f4.tar.gz manaverse-a684227b26e1e4856e67fc6116b0e09cbffac1f4.tar.bz2 manaverse-a684227b26e1e4856e67fc6116b0e09cbffac1f4.tar.xz manaverse-a684227b26e1e4856e67fc6116b0e09cbffac1f4.zip |
Use CREATEWIDGET macro in serverdialog.
Diffstat (limited to 'src/gui/windows/serverdialog.cpp')
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index bd0f992e8..135172f35 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -30,6 +30,7 @@ #include "net/download.h" #include "gui/widgets/checkbox.h" +#include "gui/widgets/createwidget.h" #include "gui/widgets/desktop.h" #include "gui/windows/editserverdialog.h" #include "gui/windows/logindialog.h" @@ -121,15 +122,13 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, // TRANSLATORS: servers dialog button mLoadButton(new Button(this, _("Load"), "load", this)), mServersListModel(new ServersListModel(&mServers, this)), - mServersList(new ServersListBox(this, mServersListModel)), + mServersList(CREATEWIDGETR(ServersListBox, this, mServersListModel)), mDownload(nullptr), mServerInfo(serverInfo), mPersistentIPCheckBox(nullptr), mDownloadProgress(-1.0F), mDownloadStatus(DOWNLOADING_UNKNOWN) { - mServersList->postInit(); - if (isSafeMode) { // TRANSLATORS: servers dialog name @@ -284,15 +283,17 @@ void ServerDialog::action(const ActionEvent &event) } else if (eventId == "addEntry") { - (new EditServerDialog(this, ServerInfo(), -1))->postInit(); + CREATEWIDGET(EditServerDialog, this, ServerInfo(), -1); } else if (eventId == "editEntry") { const int index = mServersList->getSelected(); if (index >= 0) { - (new EditServerDialog(this, mServers.at(index), - index))->postInit(); + CREATEWIDGET(EditServerDialog, + this, + mServers.at(index), + index); } } else if (eventId == "remove") @@ -324,7 +325,7 @@ void ServerDialog::keyPressed(KeyEvent &event) return; case InputAction::GUI_INSERT: - (new EditServerDialog(this, ServerInfo(), -1))->postInit(); + CREATEWIDGET(EditServerDialog, this, ServerInfo(), -1); return; case InputAction::GUI_DELETE: @@ -344,8 +345,8 @@ void ServerDialog::keyPressed(KeyEvent &event) const int index = mServersList->getSelected(); if (index >= 0) { - (new EditServerDialog(this, mServers.at(index), - index))->postInit(); + CREATEWIDGET(EditServerDialog, this, mServers.at(index), + index); } return; } |