From b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 7 Sep 2012 22:09:11 +0300 Subject: Improve constructors in some classes. --- src/gui/serverdialog.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/gui/serverdialog.cpp') diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 0104e2aa5..472d01223 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -243,12 +243,23 @@ private: ServerDialog::ServerDialog(ServerInfo *const serverInfo, const std::string &dir) : Window(_("Choose Your Server"), false, nullptr, "server.xml"), + ActionListener(), + KeyListener(), + SelectionListener(), + mDescription(new Label(std::string())), + mQuitButton(new Button(_("Quit"), "quit", this)), + mConnectButton(new Button(_("Connect"), "connect", this)), + mAddEntryButton(new Button(_("Add"), "addEntry", this)), + mEditEntryButton(new Button(_("Edit"), "editEntry", this)), + mDeleteButton(new Button(_("Delete"), "remove", this)), + mLoadButton(new Button(_("Load"), "load", this)), + mServers(ServerInfos()), + mServersListModel(new ServersListModel(&mServers, this)), + mServersList(new ServersListBox(mServersListModel)), mDir(dir), -// mDownloadStatus(DOWNLOADING_PREPARING), mDownloadStatus(DOWNLOADING_UNKNOWN), mDownload(nullptr), mDownloadProgress(-1.0f), - mServers(ServerInfos()), mServerInfo(serverInfo), mPersistentIPCheckBox(nullptr) { @@ -263,29 +274,16 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, loadCustomServers(); - mServersListModel = new ServersListModel(&mServers, this); - - mServersList = new ServersListBox(mServersListModel); mServersList->addMouseListener(this); ScrollArea *const usedScroll = new ScrollArea(mServersList, getOptionBool("showbackground"), "server_background.xml"); usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - const int n = 0; - - mDescription = new Label(std::string()); - - mQuitButton = new Button(_("Quit"), "quit", this); - mLoadButton = new Button(_("Load"), "load", this); - mConnectButton = new Button(_("Connect"), "connect", this); - mAddEntryButton = new Button(_("Add"), "addEntry", this); - mEditEntryButton = new Button(_("Edit"), "editEntry", this); - mDeleteButton = new Button(_("Delete"), "remove", this); - mServersList->addSelectionListener(this); usedScroll->setVerticalScrollAmount(0); + const int n = 0; place(0, 0 + n, usedScroll, 7, 5).setPadding(3); place(0, 5 + n, mDescription, 7); place(0, 6 + n, mPersistentIPCheckBox, 7); -- cgit v1.2.3-60-g2f50