summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/login.cpp26
-rw-r--r--src/gui/login.h4
2 files changed, 17 insertions, 13 deletions
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 <string>
+#include <vector>
#include <guichan/widgets/label.hpp>
@@ -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<std::string> dfltServer;
+ dfltServer.push_back("www.aethyra.org");
+ dfltServer.push_back("www.aethyra.org");
+ std::vector<std::string> 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<std::string> dflt,
+ std::vector<std::string> 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<std::string> dfltServer,
+ std::vector<std::string> dfltPort,
int maxEntries);
void save(const std::string &server, const std::string &port);
int getNumberOfElements();