summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2011-04-30 14:52:03 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2011-04-30 14:52:03 +0200
commitfe87acd14acd2aa33c9b8a03a77d80d6a7648f1b (patch)
treedbf7b84349728b3abcf88fade6ea3d3f5da1ecc8
parenta4d74829e50d9082deb1a9973bd3360d6babd147 (diff)
downloadmana-fe87acd14acd2aa33c9b8a03a77d80d6a7648f1b.tar.gz
mana-fe87acd14acd2aa33c9b8a03a77d80d6a7648f1b.tar.bz2
mana-fe87acd14acd2aa33c9b8a03a77d80d6a7648f1b.tar.xz
mana-fe87acd14acd2aa33c9b8a03a77d80d6a7648f1b.zip
Revert "Add option for sorting servers list"
This reverts commits e35b3bdd0a74464e4b4d3b931ca416f0c7864ba6 and e35b3bdd0a74464e4b4d3b931ca416f0c7864ba6. Sometimes the text fields and the list show different server selected, so you don't see to what server you connect. It is a big security risk sending your user name and password to the wrong server. Reviewed-by: Freeyorp, Bertram
-rw-r--r--src/gui/serverdialog.cpp53
-rw-r--r--src/gui/serverdialog.h5
-rw-r--r--src/gui/setup_video.cpp38
-rw-r--r--src/gui/setup_video.h6
4 files changed, 0 insertions, 102 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index d68e2eca..2994cbaf 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -52,7 +52,6 @@
#include <cstdlib>
#include <iostream>
#include <string>
-#include <algorithm>
static const int MAX_SERVERLIST = 6;
@@ -592,58 +591,6 @@ void ServerDialog::loadServers()
if (!found)
mServers.push_back(server);
}
-
- reorderList(config.getIntValue("serverListOrder"));
-}
-
-/**
- * Returns true if serv1 must appear before serv2
- */
-bool ServerDialog::sortByLastUsage(const ServerInfo& serv1, const ServerInfo& serv2)
-{
- int rank1 = -1;
- int rank2 = -1;
-
- for (int i = 0; i < MAX_SERVERLIST; ++i)
- {
- const std::string index = toString(i);
- const std::string nameKey = "MostUsedServerName" + index;
- std::string serv = config.getValue(nameKey, "");
- if (serv == serv1.hostname)
- rank1 = i;
- else if (serv == serv2.hostname)
- rank2 = i;
- }
-
- if (rank1 > rank2)
- return true;
-
- if (rank2 > rank1)
- return false;
-
- return ServerDialog::sortByName(serv1, serv2);
-}
-
-/**
- * Returns true if serv1 must appear before serv2
- */
-bool ServerDialog::sortByName(const ServerInfo& serv1, const ServerInfo& serv2)
-{
- return compareStrI(serv1.name, serv2.name) < 0;
-}
-
-/**
- * Reorders the server list
- * @param orderBy
- * - 0 : Order by last change (default)
- * - 1 : Order by name
- */
-void ServerDialog::reorderList(int orderBy)
-{
- if (orderBy == 0)
- std::sort(mServers.begin(), mServers.end(), ServerDialog::sortByLastUsage);
- else
- std::sort(mServers.begin(), mServers.end(), ServerDialog::sortByName);
}
void ServerDialog::loadCustomServers()
diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h
index d34fbb9f..bf0a43d6 100644
--- a/src/gui/serverdialog.h
+++ b/src/gui/serverdialog.h
@@ -150,11 +150,6 @@ class ServerDialog : public Window,
void setFieldsReadOnly(bool readOnly);
- static bool sortByLastUsage(const ServerInfo& serv1, const ServerInfo& serv2);
- static bool sortByName(const ServerInfo& serv1, const ServerInfo& serv2);
-
- void reorderList(int orderBy);
-
TextField *mServerNameField;
TextField *mPortField;
Label *mDescription;
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 0c2ebf83..7f6aecb3 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -150,31 +150,6 @@ public:
}
};
-const char *SERVLIST_ORDER_BY[2] =
-{
- N_("Last usage"),
- N_("Name")
-};
-
-class ServerListOrderListModel : public gcn::ListModel
-{
-public:
- virtual ~ServerListOrderListModel() { }
-
- virtual int getNumberOfElements()
- {
- return 2;
- }
-
- virtual std::string getElementAt(int i)
- {
- if (i >= getNumberOfElements())
- return _("???");
-
- return SERVLIST_ORDER_BY[i];
- }
-};
-
static const char *speechModeToString(Being::Speech mode)
{
switch (mode)
@@ -262,7 +237,6 @@ Setup_Video::Setup_Video():
mParticleDetailSlider(new Slider(0, 3)),
mParticleDetailField(new Label),
mFontSize(config.getIntValue("fontSize")),
- mServerListOrder(config.getIntValue("serverListOrder")),
mDisableSDLTransparencyCheckBox(
new CheckBox(_("Disable transparency (Low CPU mode)"),
mSDLTransparencyDisabled))
@@ -280,14 +254,10 @@ Setup_Video::Setup_Video():
overlayDetailLabel = new Label(_("Ambient FX"));
particleDetailLabel = new Label(_("Particle detail"));
fontSizeLabel = new Label(_("Font size"));
- serverListOrderLabel = new Label(_("Order servers by"));
mFontSizeListModel = new FontSizeChoiceListModel;
mFontSizeDropDown = new DropDown(mFontSizeListModel);
- mServerListOrderListModel = new ServerListOrderListModel;
- mServerListOrderDropDown = new DropDown(mServerListOrderListModel);
-
mModeList->setEnabled(true);
#ifndef USE_OPENGL
@@ -365,9 +335,6 @@ Setup_Video::Setup_Video():
mFontSizeDropDown->setSelected(mFontSize - 10);
mFontSizeDropDown->adjustHeight();
- mServerListOrderDropDown->setSelected(mServerListOrder);
- mServerListOrderDropDown->adjustHeight();
-
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -414,9 +381,6 @@ Setup_Video::Setup_Video():
place(0, 12, mDisableSDLTransparencyCheckBox, 4);
- place(0, 13, serverListOrderLabel, 3);
- place(1, 13, mServerListOrderDropDown, 2);
-
setDimension(gcn::Rectangle(0, 0, 365, 300));
}
@@ -425,7 +389,6 @@ Setup_Video::~Setup_Video()
delete mModeListModel;
delete mModeList;
delete mFontSizeListModel;
- delete mServerListOrderListModel;
}
void Setup_Video::apply()
@@ -524,7 +487,6 @@ void Setup_Video::apply()
// FPS change
config.setValue("fpslimit", mFps);
config.setValue("fontSize", mFontSizeDropDown->getSelected() + 10);
- config.setValue("serverListOrder", mServerListOrderDropDown->getSelected());
// We sync old and new values at apply time
mFullScreenEnabled = config.getBoolValue("screen");
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 15a0387e..d0e2c492 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -32,7 +32,6 @@
class ModeListModel;
class FontSizeChoiceListModel;
-class ServerListOrderListModel;
class Setup_Video : public SetupTab, public gcn::ActionListener,
public gcn::KeyListener
@@ -68,7 +67,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
ModeListModel *mModeListModel;
FontSizeChoiceListModel *mFontSizeListModel;
- ServerListOrderListModel *mServerListOrderListModel;
gcn::Label *speechLabel;
gcn::Label *alphaLabel;
@@ -77,7 +75,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
gcn::Label *overlayDetailLabel;
gcn::Label *particleDetailLabel;
gcn::Label *fontSizeLabel;
- gcn::Label *serverListOrderLabel;
gcn::ListBox *mModeList;
gcn::CheckBox *mFsCheckBox;
@@ -111,9 +108,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
int mFontSize;
gcn::DropDown *mFontSizeDropDown;
- int mServerListOrder;
- gcn::DropDown *mServerListOrderDropDown;
-
gcn::CheckBox *mDisableSDLTransparencyCheckBox;
};