summaryrefslogtreecommitdiff
path: root/src/gui/setup_video.cpp
diff options
context:
space:
mode:
authorBlue Sans Douze <bluesansdouze@gmail.com>2011-03-21 01:37:14 +0100
committerBlue Sans Douze <bluesansdouze@gmail.com>2011-03-22 00:13:11 +0100
commit5e7c538997a2a01c5139ed315b53a1fe5d7cb90c (patch)
tree2b156c885b4de0f5c565a2e96ec53a7c72ec7ed5 /src/gui/setup_video.cpp
parent935d35a14fb0f5a635154e032cc113d7b6740976 (diff)
downloadmana-client-5e7c538997a2a01c5139ed315b53a1fe5d7cb90c.tar.gz
mana-client-5e7c538997a2a01c5139ed315b53a1fe5d7cb90c.tar.bz2
mana-client-5e7c538997a2a01c5139ed315b53a1fe5d7cb90c.tar.xz
mana-client-5e7c538997a2a01c5139ed315b53a1fe5d7cb90c.zip
Add option for sorting servers list (issue 316)
Diffstat (limited to 'src/gui/setup_video.cpp')
-rw-r--r--src/gui/setup_video.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index c8af218f..2ef7ce6c 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -156,6 +156,31 @@ 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)
@@ -243,6 +268,7 @@ 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))
@@ -260,10 +286,14 @@ 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
@@ -341,6 +371,9 @@ 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);
@@ -387,6 +420,9 @@ 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));
}
@@ -395,6 +431,7 @@ Setup_Video::~Setup_Video()
delete mModeListModel;
delete mModeList;
delete mFontSizeListModel;
+ delete mServerListOrderListModel;
}
void Setup_Video::apply()
@@ -493,6 +530,7 @@ 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");