2012-01-05 18:39:17 +00:00
|
|
|
#include "baseinput.h"
|
|
|
|
|
|
|
|
BaseInput::BaseInput(QWidget* form, QString label):
|
|
|
|
QObject(form)
|
|
|
|
{
|
|
|
|
_label = new QLabel(label);
|
2012-04-14 15:52:16 +00:00
|
|
|
|
|
|
|
_label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
_label->setWordWrap(true);
|
2012-06-23 22:11:25 +00:00
|
|
|
|
|
|
|
_visibility_value = NULL;
|
2012-07-04 15:47:22 +00:00
|
|
|
_enabled_value = NULL;
|
|
|
|
|
2012-06-23 22:11:25 +00:00
|
|
|
_visible = true;
|
2012-06-27 14:03:19 +00:00
|
|
|
_enabled = true;
|
2012-06-23 22:11:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BaseInput::setVisibilityCondition(int* value, int condition)
|
|
|
|
{
|
|
|
|
_visibility_value = value;
|
|
|
|
_visibility_condition = condition;
|
2012-01-05 18:39:17 +00:00
|
|
|
}
|
2012-01-05 19:41:10 +00:00
|
|
|
|
2012-07-04 15:47:22 +00:00
|
|
|
void BaseInput::setEnabledCondition(int* value, int condition)
|
|
|
|
{
|
|
|
|
_enabled_value = value;
|
|
|
|
_enabled_condition = condition;
|
|
|
|
}
|
|
|
|
|
2012-01-08 10:31:01 +00:00
|
|
|
void BaseInput::updatePreview()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-01-05 19:41:10 +00:00
|
|
|
void BaseInput::applyValue()
|
|
|
|
{
|
2012-01-08 10:31:01 +00:00
|
|
|
updatePreview();
|
2012-01-05 19:41:10 +00:00
|
|
|
emit(valueChanged());
|
|
|
|
}
|
2012-01-08 10:31:01 +00:00
|
|
|
|
|
|
|
void BaseInput::revert()
|
|
|
|
{
|
|
|
|
updatePreview();
|
|
|
|
}
|
2012-06-23 22:11:25 +00:00
|
|
|
|
2012-06-27 14:03:19 +00:00
|
|
|
void BaseInput::checkVisibility(bool enabled)
|
2012-06-23 22:11:25 +00:00
|
|
|
{
|
|
|
|
if (!_visibility_value || *_visibility_value == _visibility_condition)
|
|
|
|
{
|
|
|
|
if (not _visible)
|
|
|
|
{
|
|
|
|
_visible = true;
|
|
|
|
|
|
|
|
_label->show();
|
|
|
|
_preview->show();
|
|
|
|
_control->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_visible)
|
|
|
|
{
|
|
|
|
_visible = false;
|
|
|
|
|
|
|
|
_label->hide();
|
|
|
|
_preview->hide();
|
|
|
|
_control->hide();
|
|
|
|
}
|
|
|
|
}
|
2012-06-27 14:03:19 +00:00
|
|
|
|
2012-07-04 15:47:22 +00:00
|
|
|
if (enabled && (!_enabled_value || *_enabled_value == _enabled_condition))
|
2012-06-27 14:03:19 +00:00
|
|
|
{
|
|
|
|
if (not _enabled)
|
|
|
|
{
|
|
|
|
_enabled = true;
|
|
|
|
|
|
|
|
_preview->setEnabled(true);
|
|
|
|
_control->setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_enabled)
|
|
|
|
{
|
|
|
|
_enabled = false;
|
|
|
|
|
|
|
|
_preview->setEnabled(false);
|
|
|
|
_control->setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
2012-06-23 22:11:25 +00:00
|
|
|
}
|