summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-31 22:20:54 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-31 22:20:54 +0300
commit8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5 (patch)
treec800007dc9b9904b3b235c4663abda8b14c8e94c /src/gui/widgets
parent06720edd93b51a84650e2d385a24043cc4fb932e (diff)
downloadmanaverse-8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5.tar.gz
manaverse-8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5.tar.bz2
manaverse-8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5.tar.xz
manaverse-8c11a0235e6ed4e3ed6370014cff3cd0322ed6c5.zip
Add strong typed bool enum usebase64.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/setupitem.cpp14
-rw-r--r--src/gui/widgets/setupitem.h9
-rw-r--r--src/gui/widgets/tabs/setup_chat.cpp6
-rw-r--r--src/gui/widgets/tabs/setup_other.cpp2
4 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index c066c55eb..6e9e2bf96 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -275,7 +275,7 @@ SetupItemTextField::SetupItemTextField(const std::string &restrict text,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
const MainConfig mainConfig,
- const bool useBase64) :
+ const UseBase64 useBase64) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -295,7 +295,7 @@ SetupItemTextField::SetupItemTextField(const std::string &restrict text,
const std::string &restrict eventName,
const std::string &restrict def,
const MainConfig mainConfig,
- const bool useBase64) :
+ const UseBase64 useBase64) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -319,7 +319,7 @@ SetupItemTextField::~SetupItemTextField()
void SetupItemTextField::save()
{
- if (mUseBase64)
+ if (mUseBase64 == UseBase64_true)
{
std::string normalValue = mValue;
mValue = encodeBase64String(mValue);
@@ -335,7 +335,7 @@ void SetupItemTextField::save()
void SetupItemTextField::cancel(const std::string &eventName A_UNUSED)
{
load();
- if (mUseBase64)
+ if (mUseBase64 == UseBase64_true)
mValue = decodeBase64String(mValue);
toWidget();
}
@@ -343,7 +343,7 @@ void SetupItemTextField::cancel(const std::string &eventName A_UNUSED)
void SetupItemTextField::externalUpdated(const std::string &eventName A_UNUSED)
{
load();
- if (mUseBase64)
+ if (mUseBase64 == UseBase64_true)
mValue = decodeBase64String(mValue);
toWidget();
}
@@ -351,7 +351,7 @@ void SetupItemTextField::externalUpdated(const std::string &eventName A_UNUSED)
void SetupItemTextField::rereadValue()
{
load();
- if (mUseBase64)
+ if (mUseBase64 == UseBase64_true)
mValue = decodeBase64String(mValue);
toWidget();
}
@@ -359,7 +359,7 @@ void SetupItemTextField::rereadValue()
void SetupItemTextField::createControls()
{
load();
- if (mUseBase64)
+ if (mUseBase64 == UseBase64_true)
mValue = decodeBase64String(mValue);
mHorizont = new HorizontContainer(this, 32, 2);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index f1a2b9484..80b7658ba 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/usebase64.h"
#include "gui/widgets/widget2.h"
@@ -187,7 +188,7 @@ class SetupItemTextField final : public SetupItem
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
const MainConfig mainConfig = MainConfig_true,
- const bool useBase64 = false);
+ const UseBase64 useBase64 = UseBase64_false);
SetupItemTextField(const std::string &restrict text,
const std::string &restrict description,
@@ -196,7 +197,7 @@ class SetupItemTextField final : public SetupItem
const std::string &restrict eventName,
const std::string &restrict def,
const MainConfig mainConfig = MainConfig_true,
- const bool useBase64 = false);
+ const UseBase64 useBase64 = UseBase64_false);
A_DELETE_COPY(SetupItemTextField)
@@ -221,7 +222,7 @@ class SetupItemTextField final : public SetupItem
void save() override final;
- void setUseBase64(const bool b)
+ void setUseBase64(const UseBase64 b)
{ mUseBase64 = b; }
protected:
@@ -230,7 +231,7 @@ class SetupItemTextField final : public SetupItem
TextField *mTextField;
Button *mButton;
EditDialog *mEditDialog;
- bool mUseBase64;
+ UseBase64 mUseBase64;
};
class SetupItemIntTextField final : public SetupItem
diff --git a/src/gui/widgets/tabs/setup_chat.cpp b/src/gui/widgets/tabs/setup_chat.cpp
index c82bc64d9..ce14d3ceb 100644
--- a/src/gui/widgets/tabs/setup_chat.cpp
+++ b/src/gui/widgets/tabs/setup_chat.cpp
@@ -213,7 +213,8 @@ Setup_Chat::Setup_Chat(const Widget2 *const widget) :
new SetupItemCheckBox(_("Enable language tab"),
_("If this feature enabled, language tab will appear if server "
"supports this feature.\n\nNote: only supported by Evol server yet."),
- "enableLangTab", this, "enableLangTabEvent", false);
+ "enableLangTab", this, "enableLangTabEvent",
+ MainConfig_false);
// TRANSLATORS: settings option
new SetupItemCheckBox(_("Show all languages messages"),
@@ -221,7 +222,8 @@ Setup_Chat::Setup_Chat(const Widget2 *const widget) :
"for different languages, you will see messages for all languages, "
"regardless of your language preferences.\n\nNote: it only works "
"on servers supporting language tabs feature, like Evol."),
- "showAllLang", this, "showAllLangEvent", false);
+ "showAllLang", this, "showAllLangEvent",
+ MainConfig_false);
// TRANSLATORS: settings option
new SetupItemCheckBox(_("Enable battle tab"),
diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp
index 4a1fc1302..8a8705b38 100644
--- a/src/gui/widgets/tabs/setup_other.cpp
+++ b/src/gui/widgets/tabs/setup_other.cpp
@@ -410,7 +410,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) :
new SetupItemTextField(_("Screenshot directory"), "",
"screenshotDirectory3", this, "screenshotDirectory3Event",
MainConfig_true,
- true);
+ UseBase64_true);
#endif
// TRANSLATORS: settings option