summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/setup_visual.cpp80
-rw-r--r--src/gui/setup_visual.h10
-rw-r--r--src/gui/widgets/namesmodel.cpp6
-rw-r--r--src/gui/widgets/namesmodel.h2
4 files changed, 69 insertions, 29 deletions
diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp
index 835c3640f..ca4ec43dd 100644
--- a/src/gui/setup_visual.cpp
+++ b/src/gui/setup_visual.cpp
@@ -22,6 +22,7 @@
#include "gui/setup_visual.h"
#include "gui/widgets/layouthelper.h"
+#include "gui/widgets/namesmodel.h"
#include "gui/widgets/scrollarea.h"
#include "client.h"
@@ -30,13 +31,50 @@
#include "debug.h"
+static const int speachListSize = 4;
+
+static const char *const speachList[] =
+{
+ N_("No text"),
+ N_("Text"),
+ N_("Bubbles, no names"),
+ N_("Bubbles with names")
+};
+
+static const int ambientFxListSize = 3;
+
+static const char *const ambientFxList[] =
+{
+ N_("off"),
+ N_("low"),
+ N_("high")
+};
+
+static const int particleTypeListSize = 3;
+
+static const char *const particleTypeList[] =
+{
+ N_("best quality"),
+ N_("normal"),
+ N_("best perfomance")
+};
+
+static const int vSyncListSize = 3;
+
+static const char *const vSyncList[] =
+{
+ N_("default"),
+ N_("off"),
+ N_("on")
+};
+
Setup_Visual::Setup_Visual(const Widget2 *const widget) :
SetupTabScroll(widget),
- mSpeachList(new SetupItemNames),
- mAmbientFxList(new SetupItemNames),
+ mSpeachList(new NamesModel),
+ mAmbientFxList(new NamesModel),
mParticleList(new SetupItemNames),
- mParticleTypeList(new SetupItemNames),
- mVSyncList(new SetupItemNames)
+ mParticleTypeList(new NamesModel),
+ mVSyncList(new NamesModel)
{
setName(_("Visual"));
// Do the layout
@@ -67,18 +105,13 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
new SetupItemSlider(_("Gui opacity"), "", "guialpha",
this, "guialphaEvent", 0.1, 1.0, 150, true);
- mSpeachList->push_back(_("No text"));
- mSpeachList->push_back(_("Text"));
- mSpeachList->push_back(_("Bubbles, no names"));
- mSpeachList->push_back(_("Bubbles with names"));
- new SetupItemSlider2(_("Overhead text"), "", "speech", this,
- "speechEvent", 0, 3, mSpeachList);
+ mSpeachList->fillFromArray(&speachList[0], speachListSize);
+ new SetupItemDropDown(_("Overhead text"), "", "speech", this,
+ "speechEvent", mSpeachList, 200);
- mAmbientFxList->push_back(_("off"));
- mAmbientFxList->push_back(_("low"));
- mAmbientFxList->push_back(_("high"));
- new SetupItemSlider2(_("Ambient FX"), "", "OverlayDetail", this,
- "OverlayDetailEvent", 0, 2, mAmbientFxList);
+ mAmbientFxList->fillFromArray(&ambientFxList[0], ambientFxListSize);
+ new SetupItemDropDown(_("Ambient FX"), "", "OverlayDetail", this,
+ "OverlayDetailEvent", mAmbientFxList, 100);
new SetupItemCheckBox(_("Particle effects"), "",
"particleeffects", this, "particleeffectsEvent");
@@ -91,11 +124,10 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
this, "particleEmitterSkipEvent", 0, 3,
mParticleList, true))->setInvertValue(3);
- mParticleTypeList->push_back(_("best quality"));
- mParticleTypeList->push_back(_("normal"));
- mParticleTypeList->push_back(_("best perfomance"));
- new SetupItemSlider2(_("Particle physics"), "", "particleFastPhysics",
- this, "particleFastPhysicsEvent", 0, 2, mParticleTypeList);
+ mParticleTypeList->fillFromArray(&particleTypeList[0],
+ particleTypeListSize);
+ new SetupItemDropDown(_("Particle physics"), "", "particleFastPhysics",
+ this, "particleFastPhysicsEvent", mParticleTypeList, 200);
new SetupItemLabel(_("Gamma"), "", this);
@@ -109,11 +141,9 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
new SetupItemLabel(_("Other"), "", this);
- mVSyncList->push_back(_("default"));
- mVSyncList->push_back(_("off"));
- mVSyncList->push_back(_("on"));
- new SetupItemSlider2(_("Vsync"), "", "vsync", this,
- "vsyncEvent", 0, 2, mVSyncList);
+ mVSyncList->fillFromArray(&vSyncList[0], vSyncListSize);
+ new SetupItemDropDown(_("Vsync"), "", "vsync", this,
+ "vsyncEvent", mVSyncList, 100);
#if defined(WIN32) || defined(__APPLE__)
new SetupItemCheckBox(_("Center game window"),
diff --git a/src/gui/setup_visual.h b/src/gui/setup_visual.h
index ef0ade052..f80e219b9 100644
--- a/src/gui/setup_visual.h
+++ b/src/gui/setup_visual.h
@@ -24,6 +24,8 @@
#include "gui/widgets/setupitem.h"
+class NamesModel;
+
class Setup_Visual final : public SetupTabScroll
{
public:
@@ -36,11 +38,11 @@ class Setup_Visual final : public SetupTabScroll
void apply();
private:
- SetupItemNames *mSpeachList;
- SetupItemNames *mAmbientFxList;
+ NamesModel *mSpeachList;
+ NamesModel *mAmbientFxList;
SetupItemNames *mParticleList;
- SetupItemNames *mParticleTypeList;
- SetupItemNames *mVSyncList;
+ NamesModel *mParticleTypeList;
+ NamesModel *mVSyncList;
};
#endif
diff --git a/src/gui/widgets/namesmodel.cpp b/src/gui/widgets/namesmodel.cpp
index abfcd6def..299eed355 100644
--- a/src/gui/widgets/namesmodel.cpp
+++ b/src/gui/widgets/namesmodel.cpp
@@ -49,3 +49,9 @@ std::string NamesModel::getElementAt(int i)
return mNames[i];
}
+
+void NamesModel::fillFromArray(const char *const *const arr, std::size_t sz)
+{
+ for (int f = 0; f < sz; f ++)
+ mNames.push_back(gettext(arr[f]));
+}
diff --git a/src/gui/widgets/namesmodel.h b/src/gui/widgets/namesmodel.h
index 7f3ba934d..eab9983f3 100644
--- a/src/gui/widgets/namesmodel.h
+++ b/src/gui/widgets/namesmodel.h
@@ -49,6 +49,8 @@ class NamesModel : public gcn::ListModel
void clear()
{ mNames.clear(); }
+ void fillFromArray(const char *const *const arr, std::size_t size);
+
protected:
StringVect mNames;
};