summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/simpletypes/onthefly.h28
-rw-r--r--src/gui/widgets/setupitem.cpp23
-rw-r--r--src/gui/widgets/setupitem.h23
-rw-r--r--src/gui/widgets/tabs/setup_audio.cpp9
-rw-r--r--src/gui/widgets/tabs/setup_visual.cpp12
7 files changed, 68 insertions, 29 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ced451f85..7a42d758b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1122,6 +1122,7 @@ SET(SRCS
enums/simpletypes/notify.h
enums/simpletypes/npcnames.h
enums/simpletypes/online.h
+ enums/simpletypes/onthefly.h
enums/simpletypes/protected.h
enums/simpletypes/separator.h
enums/simpletypes/sfx.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 277b33976..a436642f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -585,6 +585,7 @@ SRC += events/actionevent.h \
enums/simpletypes/notify.h \
enums/simpletypes/npcnames.h \
enums/simpletypes/online.h \
+ enums/simpletypes/onthefly.h \
enums/simpletypes/protected.h \
enums/simpletypes/separator.h \
enums/simpletypes/sfx.h \
diff --git a/src/enums/simpletypes/onthefly.h b/src/enums/simpletypes/onthefly.h
new file mode 100644
index 000000000..2d139a121
--- /dev/null
+++ b/src/enums/simpletypes/onthefly.h
@@ -0,0 +1,28 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_SIMPLETYPES_ONTHEFLY_H
+#define ENUMS_SIMPLETYPES_ONTHEFLY_H
+
+#include "enums/simpletypes/booldefines.h"
+
+defBoolEnum(OnTheFly);
+
+#endif // ENUMS_SIMPLETYPES_ONTHEFLY_H
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 94e6231f9..be26265c3 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -728,7 +728,7 @@ SetupItemSlider::SetupItemSlider(const std::string &restrict text,
const double max,
const double step,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
@@ -754,7 +754,7 @@ SetupItemSlider::SetupItemSlider(const std::string &restrict text,
const double step,
const std::string &restrict def,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
@@ -823,7 +823,7 @@ void SetupItemSlider::toWidget()
void SetupItemSlider::action(const ActionEvent &event A_UNUSED)
{
fromWidget();
- if (mOnTheFly)
+ if (mOnTheFly == OnTheFly_true)
save();
}
@@ -846,7 +846,7 @@ SetupItemSlider2::SetupItemSlider2(const std::string &restrict text,
const int max,
const int step,
SetupItemNames *restrict const values,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig,
const bool doNotAlign) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
@@ -877,7 +877,7 @@ SetupItemSlider2::SetupItemSlider2(const std::string &restrict text,
const int step,
SetupItemNames *restrict const values,
const std::string &restrict def,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig,
const bool doNotAlign) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
@@ -987,7 +987,7 @@ void SetupItemSlider2::action(const ActionEvent &event A_UNUSED)
{
fromWidget();
updateLabel();
- if (mOnTheFly)
+ if (mOnTheFly == OnTheFly_true)
save();
}
@@ -1033,7 +1033,7 @@ SetupItemSliderList::SetupItemSliderList(const std::string &restrict text,
const std::string &restrict eventName,
ListModel *restrict const model,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
@@ -1055,7 +1055,7 @@ SetupItemSliderList::SetupItemSliderList(const std::string &restrict text,
ListModel *restrict const model,
const std::string &restrict def,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
@@ -1120,7 +1120,7 @@ void SetupItemSliderList::toWidget()
void SetupItemSliderList::action(const ActionEvent &event A_UNUSED)
{
fromWidget();
- if (mOnTheFly)
+ if (mOnTheFly == OnTheFly_true)
save();
}
@@ -1139,7 +1139,8 @@ SetupItemSound::SetupItemSound(const std::string &restrict text,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
ListModel *restrict const model,
- const int width, const bool onTheFly,
+ const int width,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItemSliderList(text, description, keyName, parent, eventName,
model, width, onTheFly, mainConfig),
@@ -1179,7 +1180,7 @@ SetupItemSliderInt::SetupItemSliderInt(const std::string &restrict text,
ListModel *restrict const model,
const int min,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig) :
SetupItemSliderList(text, description, keyName, parent, eventName,
model, width, onTheFly, mainConfig),
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 0d817a4b4..2bfa9e04c 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -22,6 +22,7 @@
#define GUI_WIDGETS_SETUPITEM_H
#include "enums/simpletypes/mainconfig.h"
+#include "enums/simpletypes/onthefly.h"
#include "enums/simpletypes/usebase64.h"
#include "enums/simpletypes/separator.h"
@@ -358,7 +359,7 @@ class SetupItemSlider final : public SetupItem
const double max,
const double step,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig);
SetupItemSlider(const std::string &restrict text,
@@ -371,7 +372,7 @@ class SetupItemSlider final : public SetupItem
const double step,
const std::string &restrict def,
const int width,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig);
A_DELETE_COPY(SetupItemSlider)
@@ -398,7 +399,7 @@ class SetupItemSlider final : public SetupItem
double mMax;
double mStep;
int mWidth;
- bool mOnTheFly;
+ OnTheFly mOnTheFly;
};
typedef std::vector<std::string> SetupItemNames;
@@ -415,7 +416,7 @@ class SetupItemSlider2 final : public SetupItem
const std::string &restrict eventName,
const int min, const int max, const int step,
SetupItemNames *restrict const values,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig,
const bool doNotAlign);
@@ -427,7 +428,7 @@ class SetupItemSlider2 final : public SetupItem
const int min, const int max, const int step,
SetupItemNames *restrict const values,
const std::string &restrict def,
- const bool onTheFly,
+ const OnTheFly onTheFly,
const MainConfig mainConfig,
const bool doNotAlign);
@@ -462,7 +463,7 @@ class SetupItemSlider2 final : public SetupItem
int mStep;
int mInvertValue;
bool mInvert;
- bool mOnTheFly;
+ OnTheFly mOnTheFly;
bool mDoNotAlign;
};
@@ -493,7 +494,7 @@ class SetupItemSliderList notfinal : public SetupItem
const std::string &restrict eventName,
ListModel *restrict const model,
const int width = 150,
- const bool onTheFly = false,
+ const OnTheFly onTheFly = OnTheFly_false,
const MainConfig mainConfig = MainConfig_true);
SetupItemSliderList(const std::string &restrict text,
@@ -504,7 +505,7 @@ class SetupItemSliderList notfinal : public SetupItem
ListModel *restrict const model,
const std::string &restrict def,
const int width = 150,
- const bool onTheFly = false,
+ const OnTheFly onTheFly = OnTheFly_false,
const MainConfig mainConfig = MainConfig_true);
HorizontContainer *mHorizont;
@@ -512,7 +513,7 @@ class SetupItemSliderList notfinal : public SetupItem
SliderList *mSlider;
ListModel *mModel;
int mWidth;
- bool mOnTheFly;
+ OnTheFly mOnTheFly;
};
class SetupItemSound final : public SetupItemSliderList
@@ -525,7 +526,7 @@ class SetupItemSound final : public SetupItemSliderList
const std::string &restrict eventName,
ListModel *restrict const model,
const int width = 150,
- const bool onTheFly = false,
+ const OnTheFly onTheFly = OnTheFly_false,
const MainConfig mainConfig = MainConfig_true);
A_DELETE_COPY(SetupItemSound)
@@ -549,7 +550,7 @@ class SetupItemSliderInt final : public SetupItemSliderList
ListModel *restrict const model,
const int min,
const int width = 150,
- const bool onTheFly = false,
+ const OnTheFly onTheFly = OnTheFly_false,
const MainConfig mainConfig = MainConfig_true);
A_DELETE_COPY(SetupItemSliderInt)
diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp
index 32445f1c6..0aa824813 100644
--- a/src/gui/widgets/tabs/setup_audio.cpp
+++ b/src/gui/widgets/tabs/setup_audio.cpp
@@ -73,13 +73,15 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) :
// TRANSLATORS: settings option
new SetupItemSlider(_("Sfx volume"), "", "sfxVolume",
this, "sfxVolumeEvent", 0, soundManager.getMaxVolume(), 1,
- 150, true,
+ 150,
+ OnTheFly_true,
MainConfig_true);
// TRANSLATORS: settings option
new SetupItemSlider(_("Music volume"), "", "musicVolume",
this, "musicVolumeEvent", 0, soundManager.getMaxVolume(), 1,
- 150, true,
+ 150,
+ OnTheFly_true,
MainConfig_true);
// TRANSLATORS: settings option
@@ -100,7 +102,8 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) :
mChannelsList->push_back(_("surround+center+lfe"));
// TRANSLATORS: settings option
new SetupItemSlider2(_("Audio channels"), "", "audioChannels", this,
- "audioChannels", 1, 4, 1, mChannelsList, false,
+ "audioChannels", 1, 4, 1, mChannelsList,
+ OnTheFly_false,
MainConfig_true,
false);
diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp
index 4bcb041ca..f33a9a5d3 100644
--- a/src/gui/widgets/tabs/setup_visual.cpp
+++ b/src/gui/widgets/tabs/setup_visual.cpp
@@ -141,7 +141,8 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
// TRANSLATORS: settings option
new SetupItemSlider(_("Gui opacity"), "", "guialpha",
- this, "guialphaEvent", 0.1, 1.01, 0.1, 150, true,
+ this, "guialphaEvent", 0.1, 1.01, 0.1, 150,
+ OnTheFly_true,
MainConfig_true);
// TRANSLATORS: settings option
@@ -171,8 +172,10 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
// TRANSLATORS: particle details
mParticleList->push_back(_("max"));
(new SetupItemSlider2(_("Particle detail"), "", "particleEmitterSkip",
- this, "particleEmitterSkipEvent", 0, 3, 1,
- mParticleList, true, MainConfig_true, false))->setInvertValue(3);
+ this, "particleEmitterSkipEvent", 0, 3, 1, mParticleList,
+ OnTheFly_true,
+ MainConfig_true,
+ false))->setInvertValue(3);
mParticleTypeList->fillFromArray(&particleTypeList[0],
particleTypeListSize);
@@ -190,7 +193,8 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
// TRANSLATORS: settings option
new SetupItemSlider(_("Gamma"), "", "gamma",
- this, "gammeEvent", 1, 20, 1, 350, true,
+ this, "gammeEvent", 1, 20, 1, 350,
+ OnTheFly_true,
MainConfig_true);