paysages : Small change.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@374 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-07-04 15:47:22 +00:00 committed by ThunderK
parent b7e4be1030
commit c0725baf87
3 changed files with 14 additions and 1 deletions

View file

@ -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)
{

View file

@ -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;
};

View file

@ -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);