diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-21 03:33:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-21 03:33:54 +0300 |
commit | e4dabfe2b75a20378bdb1bf32b53249b5d55740b (patch) | |
tree | 8c14cc39a4f0a5b730d377a1d89b0304c9b8122d /src/gui/widgets | |
parent | 2eef004b8b70861fd377ad50393a9a0ccbbbc152 (diff) | |
download | ManaVerse-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.gz ManaVerse-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.bz2 ManaVerse-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.tar.xz ManaVerse-e4dabfe2b75a20378bdb1bf32b53249b5d55740b.zip |
Bit cleanup visual settings page.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/setupitem.cpp | 30 | ||||
-rw-r--r-- | src/gui/widgets/setupitem.h | 12 |
2 files changed, 30 insertions, 12 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 581d9f239..490c046c3 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -597,13 +597,15 @@ void SetupItemDropDown::toWidget() SetupItemSlider::SetupItemSlider(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, double min, double max, - bool mainConfig) : + int width, bool onTheFly, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), mHorizont(nullptr), mLabel(nullptr), mSlider(nullptr), mMin(min), - mMax(max) + mMax(max), + mWidth(width), + mOnTheFly(onTheFly) { mValueType = VSTR; createControls(); @@ -612,13 +614,16 @@ SetupItemSlider::SetupItemSlider(std::string text, std::string description, SetupItemSlider::SetupItemSlider(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, double min, double max, - std::string def, bool mainConfig) : + std::string def, int width, bool onTheFly, + bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, def, mainConfig), mHorizont(nullptr), mLabel(nullptr), mSlider(nullptr), mMin(min), - mMax(max) + mMax(max), + mWidth(width), + mOnTheFly(onTheFly) { mValueType = VSTR; createControls(); @@ -645,7 +650,7 @@ void SetupItemSlider::createControls() mSlider->setHeight(30); mWidget = mSlider; - mSlider->setWidth(150); + mSlider->setWidth(mWidth); mSlider->setHeight(40); mHorizont->add(mLabel); mHorizont->add(mSlider, -10); @@ -675,6 +680,8 @@ void SetupItemSlider::toWidget() void SetupItemSlider::action(const gcn::ActionEvent &event A_UNUSED) { fromWidget(); + if (mOnTheFly) + save(); } void SetupItemSlider::apply(std::string eventName) @@ -689,7 +696,8 @@ void SetupItemSlider::apply(std::string eventName) SetupItemSlider2::SetupItemSlider2(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, int min, int max, - SetupItemNames *values, bool mainConfig) : + SetupItemNames *values, bool onTheFly, + bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), mHorizont(nullptr), mLabel(nullptr), @@ -699,7 +707,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description, mMin(min), mMax(max), mInvert(false), - mInvertValue(0) + mInvertValue(0), + mOnTheFly(onTheFly) { mValueType = VSTR; createControls(); @@ -709,7 +718,7 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, int min, int max, SetupItemNames *values, std::string def, - bool mainConfig) : + bool onTheFly, bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, def, mainConfig), mHorizont(nullptr), mLabel(nullptr), @@ -719,7 +728,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description, mMin(min), mMax(max), mInvert(false), - mInvertValue(0) + mInvertValue(0), + mOnTheFly(onTheFly) { mValueType = VSTR; createControls(); @@ -811,6 +821,8 @@ void SetupItemSlider2::action(const gcn::ActionEvent &event A_UNUSED) { fromWidget(); updateLabel(); + if (mOnTheFly) + save(); } void SetupItemSlider2::updateLabel() diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index cf847f55d..b950d1488 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -270,12 +270,14 @@ class SetupItemSlider : public SetupItem SetupItemSlider(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, double min, double max, + int width = 150, bool onTheFly = false, bool mainConfig = true); SetupItemSlider(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, double min, double max, - std::string def, bool mainConfig = true); + std::string def, int width = 150, + bool onTheFly = false, bool mainConfig = true); ~SetupItemSlider(); @@ -297,6 +299,8 @@ class SetupItemSlider : public SetupItem Slider *mSlider; double mMin; double mMax; + int mWidth; + bool mOnTheFly; }; typedef std::vector<std::string> SetupItemNames; @@ -309,13 +313,14 @@ class SetupItemSlider2 : public SetupItem SetupItemSlider2(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, int min, int max, - SetupItemNames *values, bool mainConfig = true); + SetupItemNames *values, bool onTheFly = false, + bool mainConfig = true); SetupItemSlider2(std::string text, std::string description, std::string keyName, SetupTabScroll *parent, std::string eventName, int min, int max, SetupItemNames *values, std::string def, - bool mainConfig = true); + bool onTheFly = false, bool mainConfig = true); ~SetupItemSlider2(); @@ -345,6 +350,7 @@ class SetupItemSlider2 : public SetupItem int mMax; bool mInvert; int mInvertValue; + bool mOnTheFly; }; #endif |