51 #include <QVBoxLayout> 54 #include "../scene/elementInput.hh" 55 #include "../parser/type.hh" 56 #include "../parser/element.hh" 57 #include "../parser/context.hh" 59 #include "configValue.hh" 80 group_->setCheckable (
false);
86 QVBoxLayout *vL =
new QVBoxLayout;
87 QHBoxLayout *hL =
new QHBoxLayout;
89 if (_input->
state () & Input::Optional || !(_input->
state () & Input::NoExternalInput) ||
90 !(_input->
state () & Input::NoRuntimeUserInput))
92 QHBoxLayout *bL =
new QHBoxLayout;
93 QString dI = (_input->
state () & Input::NoExternalInput) ?
"" :
"Direct Input / ";
95 buttonGroup_ =
new QButtonGroup (
this);
97 constant_ =
new QRadioButton (
"Constant value");
98 if (_input->
state () & Input::Optional)
100 optional_ =
new QRadioButton (dI +
"Optional");
101 if (!(_input->
state () & Input::NoRuntimeUserInput))
103 forceAskUser_ =
new QRadioButton (
"Ask during execution");
104 buttonGroup_->addButton (forceAskUser_, 2);
108 optional_ =
new QRadioButton (dI +
"Ask during execution");
109 buttonGroup_->addButton (optional_, 0);
110 buttonGroup_->addButton (constant_, 1);
112 bL->addWidget (optional_);
113 bL->addWidget (constant_);
116 bL->addWidget (forceAskUser_);
117 buttonGroup_->addButton (forceAskUser_, 2);
122 QFrame *f =
new QFrame ();
124 f->setFrameStyle (QFrame::HLine | QFrame::Plain);
127 connect (buttonGroup_, SIGNAL (buttonClicked (
int)),
128 this, SLOT (selectionChange()));
134 hL->addWidget (main_);
135 hL->setStretchFactor (main_, 2);
137 QFrame *f =
new QFrame ();
139 f->setFrameStyle (QFrame::VLine | QFrame::Plain);
142 default_ =
new QPushButton (
"Default");
143 hL->addWidget (default_);
147 group_->setLayout (vL);
149 if (_input->
isSet ())
154 constant_->setChecked (
true);
158 if (!_input->
value ().isEmpty ())
163 forceAskUser_->setChecked (
true);
164 main_->setEnabled (
false);
165 default_->setEnabled (
false);
169 optional_->setChecked (
true);
170 main_->setEnabled (
false);
171 default_->setEnabled (
false);
175 connect (default_, SIGNAL (pressed()),
this, SLOT (toDefault()));
191 void ConfigValue::toDefault()
199 void ConfigValue::selectionChange()
202 if (constant_->isChecked())
204 main_->setEnabled (
true);
205 default_->setEnabled (
true);
209 main_->setEnabled (
false);
210 default_->setEnabled (
false);
QString typeString() const
Type.
virtual void fromValue(QString _from)=0
Set configuration to the value of the given string.
virtual TypeWidget * widget(QMap< QString, QString >, QString, QWidget *=NULL)
Returns the configuration widget.
QMap< QString, QString > hints() const
Parsed hints for this input/output type.
Context * context() const
Context of element.
bool isForceAskSet() const
Return "ForceAsk" flag.
ConfigValue(ElementInput *_input)
Constructor.
virtual void toDefault()=0
reset the widget to default
const QString & shortDescription() const
Short description.
bool isSet()
Return "set" flag.
QString value() const
Returns value set by user.
~ConfigValue()
Destructor.
InOut * inOut() const
InOut context object.
const Element * element() const
Element of this input/output.
Type * getType(QString _type)
Get type object for given type name.
unsigned int state()
VSI::Input state passthrough.