summaryrefslogtreecommitdiff
path: root/src/gui
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
parent1b7fa30e602ae18a68153d4e5acec8e4d9ea9e33 (diff)
downloadmv-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.gz
mv-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.bz2
mv-c3b87f283a5a99ed8bac513c516bc5a184406391.tar.xz
mv-c3b87f283a5a99ed8bac513c516bc5a184406391.zip
add option for edit screenshot dir.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/setupitem.cpp32
-rw-r--r--src/gui/widgets/setupitem.h14
-rw-r--r--src/gui/widgets/tabs/setup_other.cpp4
3 files changed, 42 insertions, 8 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);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 40a20a985..91547733f 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -63,7 +63,7 @@ class SetupItem : public gcn::ActionListener,
void load();
- void save() const;
+ virtual void save();
virtual void fromWidget() = 0;
@@ -188,7 +188,8 @@ class SetupItemTextField final : public SetupItem
const std::string &restrict keyName,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
- const bool mainConfig = true);
+ const bool mainConfig = true,
+ const bool useBase64 = false);
SetupItemTextField(const std::string &restrict text,
const std::string &restrict description,
@@ -196,7 +197,8 @@ class SetupItemTextField final : public SetupItem
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
const std::string &restrict def,
- const bool mainConfig = true);
+ const bool mainConfig = true,
+ const bool useBase64 = false);
A_DELETE_COPY(SetupItemTextField)
@@ -212,12 +214,18 @@ class SetupItemTextField final : public SetupItem
void apply(const std::string &eventName) override final;
+ void save() override final;
+
+ void setUseBase64(const bool b)
+ { mUseBase64 = b; }
+
protected:
HorizontContainer *mHorizont;
Label *mLabel;
TextField *mTextField;
Button *mButton;
EditDialog *mEditDialog;
+ bool mUseBase64;
};
class SetupItemIntTextField final : public SetupItem
diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp
index 7dea0021f..940623379 100644
--- a/src/gui/widgets/tabs/setup_other.cpp
+++ b/src/gui/widgets/tabs/setup_other.cpp
@@ -372,6 +372,10 @@ Setup_Other::Setup_Other(const Widget2 *const widget) :
#endif
// TRANSLATORS: settings option
+ new SetupItemTextField(_("Screenshot directory"), "",
+ "screenshotDirectory2", this, "screenshotDirectory2Event", true, true);
+
+ // TRANSLATORS: settings option
new SetupItemIntTextField(_("Network delay between sub servers"),
"", "networksleep", this, "networksleepEvent", 0, 10000);