From 7aa0b5cadf9f37c7d9395aa44e0c461e2b539763 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Mon, 29 Sep 2008 23:03:41 +0000 Subject: Modified the client so that it displays both servers as server choices, as well as changing the default server to point to www.aethyra.org instead of Slinker's IP address now. --- src/gui/login.cpp | 26 +++++++++++++++----------- src/gui/login.h | 4 ++-- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'src/gui') diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 6a4cfeb7..c553d56e 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -24,6 +24,7 @@ #include "login.h" #include +#include #include @@ -50,9 +51,13 @@ LoginDialog::LoginDialog(LoginData *loginData): gcn::Label *passLabel = new gcn::Label("Password:"); gcn::Label *serverLabel = new gcn::Label("Server:"); gcn::Label *portLabel = new gcn::Label("Port:"); - mServerList = new DropDownList("MostRecent00", - "209.168.213.109", - "21001", + std::vector dfltServer; + dfltServer.push_back("www.aethyra.org"); + dfltServer.push_back("www.aethyra.org"); + std::vector dfltPort; + dfltPort.push_back("22001"); + dfltPort.push_back("21001"); + mServerList = new DropDownList("MostRecent00", dfltServer, dfltPort, MAX_SERVER_LIST_SIZE); mServerListBox = new gcn::ListBox(mServerList); mServerScrollArea = new ScrollArea(); @@ -193,8 +198,8 @@ LoginDialog::action(const gcn::ActionEvent &event) } else { - mLoginData->port = 6901; - } + mLoginData->port = 6901; + } mLoginData->username = mUserField->getText(); mLoginData->password = mPassField->getText(); @@ -271,8 +276,8 @@ LoginDialog::DropDownList::saveEntry(const std::string &server, } LoginDialog::DropDownList::DropDownList(std::string prefix, - std::string dflt, - std::string dfltPort, + std::vector dflt, + std::vector dfltPort, int maxEntries) : mConfigPrefix(prefix), mMaxEntries(maxEntries) @@ -287,7 +292,7 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, toString(i), ""); } std::string port = config.getValue(mConfigPrefix + "Port" + - toString(i), dfltPort); + toString(i), dfltPort.front()); if (server != "") { @@ -297,10 +302,9 @@ LoginDialog::DropDownList::DropDownList(std::string prefix, } if (mServers.size() == 0) { - mServers.push_back(dflt); - mPorts.push_back(dfltPort); + mServers.assign(dflt.begin(), dflt.end()); + mPorts.assign(dfltPort.begin(), dfltPort.end()); } - } void diff --git a/src/gui/login.h b/src/gui/login.h index 8a228b5f..3550d82b 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -124,8 +124,8 @@ class LoginDialog : public Window, public gcn::ActionListener, const std::string &port, int &saved); public: DropDownList(std::string prefix, - std::string dfltServer, - std::string dfltPort, + std::vector dfltServer, + std::vector dfltPort, int maxEntries); void save(const std::string &server, const std::string &port); int getNumberOfElements(); -- cgit v1.2.3-70-g09d2