summaryrefslogtreecommitdiff
path: root/src/gui/widgets/setupitem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-15 01:16:34 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-15 01:16:34 +0300
commitc3b87f283a5a99ed8bac513c516bc5a184406391 (patch)
tree78cce6c60cb82b8e191e633ec2c4fce1e1672708 /src/gui/widgets/setupitem.cpp
parent1b7fa30e602ae18a68153d4e5acec8e4d9ea9e33 (diff)
downloadmanaverse-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.gz
manaverse-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.bz2
manaverse-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.xz
manaverse-c3b87f283a5a99ed8bac513c516bc5a184406391.zip
add option for edit screenshot dir.
Diffstat (limited to 'src/gui/widgets/setupitem.cpp')
-rw-r--r--src/gui/widgets/setupitem.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index e8bec1db6..6ce8ce102 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -37,6 +37,7 @@
#include "gui/widgets/sliderlist.h"
#include "gui/widgets/vertcontainer.h"
+#include "utils/base64.h"
#include "utils/gettext.h"
#include "utils/mathutils.h"
@@ -136,7 +137,7 @@ void SetupItem::load()
}
}
-void SetupItem::save() const
+void SetupItem::save()
{
if (mKeyName.empty())
return;
@@ -267,13 +268,15 @@ SetupItemTextField::SetupItemTextField(const std::string &restrict text,
const std::string &restrict keyName,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
- const bool mainConfig) :
+ const bool mainConfig,
+ const bool useBase64) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
mTextField(nullptr),
mButton(nullptr),
- mEditDialog(nullptr)
+ mEditDialog(nullptr),
+ mUseBase64(useBase64)
{
mValueType = VSTR;
createControls();
@@ -285,13 +288,15 @@ SetupItemTextField::SetupItemTextField(const std::string &restrict text,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
const std::string &restrict def,
- const bool mainConfig) :
+ const bool mainConfig,
+ const bool useBase64) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
mTextField(nullptr),
mButton(nullptr),
- mEditDialog(nullptr)
+ mEditDialog(nullptr),
+ mUseBase64(useBase64)
{
mValueType = VSTR;
createControls();
@@ -306,9 +311,26 @@ SetupItemTextField::~SetupItemTextField()
mButton = nullptr;
}
+void SetupItemTextField::save()
+{
+ if (mUseBase64)
+ {
+ std::string normalValue = mValue;
+ mValue = encodeBase64String(mValue);
+ SetupItem::save();
+ mValue = normalValue;
+ }
+ else
+ {
+ SetupItem::save();
+ }
+}
+
void SetupItemTextField::createControls()
{
load();
+ if (mUseBase64)
+ mValue = decodeBase64String(mValue);
mHorizont = new HorizontContainer(this, 32, 2);
mLabel = new Label(this, mText);