From 6aed2d7d4c6a3cb181f053ba52488cb1a0ea232c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Jan 2014 01:32:53 +0300 Subject: Fix screenshot directory saving/loading. --- src/gui/widgets/setupitem.cpp | 24 ++++++++++++++++++++++++ src/gui/widgets/setupitem.h | 9 ++++++++- src/gui/widgets/tabs/setup_other.cpp | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 6ce8ce102..b9ea91f76 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -326,6 +326,30 @@ void SetupItemTextField::save() } } +void SetupItemTextField::cancel(const std::string &eventName A_UNUSED) +{ + load(); + if (mUseBase64) + mValue = decodeBase64String(mValue); + toWidget(); +} + +void SetupItemTextField::externalUpdated(const std::string &eventName A_UNUSED) +{ + load(); + if (mUseBase64) + mValue = decodeBase64String(mValue); + toWidget(); +} + +void SetupItemTextField::rereadValue() +{ + load(); + if (mUseBase64) + mValue = decodeBase64String(mValue); + toWidget(); +} + void SetupItemTextField::createControls() { load(); diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 91547733f..689f62fdf 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -96,7 +96,7 @@ class SetupItem : public gcn::ActionListener, void fixFirstItemSize(gcn::Widget *const widget); - void rereadValue(); + virtual void rereadValue(); void setValue(const std::string str) { mValue = str; } @@ -214,6 +214,13 @@ class SetupItemTextField final : public SetupItem void apply(const std::string &eventName) override final; + void cancel(const std::string &eventName A_UNUSED) override final; + + void externalUpdated(const std::string &eventName A_UNUSED) + override final; + + void rereadValue() override final; + void save() override final; void setUseBase64(const bool b) diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 9f3c30dec..985baa744 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -374,7 +374,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : #ifndef WIN32 // TRANSLATORS: settings option new SetupItemTextField(_("Screenshot directory"), "", - "screenshotDirectory2", this, "screenshotDirectory2Event", true, true); + "screenshotDirectory3", this, "screenshotDirectory3Event", true, true); #endif // TRANSLATORS: settings option -- cgit v1.2.3-60-g2f50