From c0725baf87a0daa237a78829c384ef33149c6750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 4 Jul 2012 15:47:22 +0000 Subject: [PATCH] paysages : Small change. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@374 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- gui_qt/baseinput.cpp | 10 +++++++++- gui_qt/baseinput.h | 3 +++ gui_qt/formsky.cpp | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gui_qt/baseinput.cpp b/gui_qt/baseinput.cpp index 8537160..31b2ce2 100644 --- a/gui_qt/baseinput.cpp +++ b/gui_qt/baseinput.cpp @@ -9,6 +9,8 @@ BaseInput::BaseInput(QWidget* form, QString label): _label->setWordWrap(true); _visibility_value = NULL; + _enabled_value = NULL; + _visible = true; _enabled = true; } @@ -19,6 +21,12 @@ void BaseInput::setVisibilityCondition(int* value, int condition) _visibility_condition = condition; } +void BaseInput::setEnabledCondition(int* value, int condition) +{ + _enabled_value = value; + _enabled_condition = condition; +} + void BaseInput::updatePreview() { } @@ -59,7 +67,7 @@ void BaseInput::checkVisibility(bool enabled) } } - if (enabled) + if (enabled && (!_enabled_value || *_enabled_value == _enabled_condition)) { if (not _enabled) { diff --git a/gui_qt/baseinput.h b/gui_qt/baseinput.h index 2cdf8b0..168fb8e 100644 --- a/gui_qt/baseinput.h +++ b/gui_qt/baseinput.h @@ -14,6 +14,7 @@ public: inline QWidget* preview() {return _preview;} inline QWidget* control() {return _control;} void setVisibilityCondition(int* value, int condition); + void setEnabledCondition(int* value, int condition); public slots: virtual void updatePreview(); @@ -30,6 +31,8 @@ protected: QWidget* _control; int* _visibility_value; int _visibility_condition; + int* _enabled_value; + int _enabled_condition; bool _visible; bool _enabled; }; diff --git a/gui_qt/formsky.cpp b/gui_qt/formsky.cpp index fa6d913..1a7a16c 100644 --- a/gui_qt/formsky.cpp +++ b/gui_qt/formsky.cpp @@ -117,8 +117,10 @@ FormSky::FormSky(QWidget *parent): input->setVisibilityCondition((int*)&_definition.model, SKY_MODEL_CUSTOM); input = addInputColor(tr("Zenith color"), &_definition.model_custom.zenith_color); input->setVisibilityCondition((int*)&_definition.model, SKY_MODEL_CUSTOM); + input->setEnabledCondition(&_definition.model_custom.auto_from_daytime, 0); input = addInputColor(tr("Haze color"), &_definition.model_custom.haze_color); input->setVisibilityCondition((int*)&_definition.model, SKY_MODEL_CUSTOM); + input->setEnabledCondition(&_definition.model_custom.auto_from_daytime, 0); input = addInputDouble(tr("Haze height"), &_definition.model_custom.haze_height, 0.0, 1.0, 0.01, 0.1); input->setVisibilityCondition((int*)&_definition.model, SKY_MODEL_CUSTOM); input = addInputDouble(tr("Haze smoothing"), &_definition.model_custom.haze_smoothing, 0.0, 1.0, 0.01, 0.1);