45 #include <QVBoxLayout> 48 #include "../scene/elementInput.hh" 49 #include "../parser/type.hh" 50 #include "../parser/element.hh" 51 #include "../parser/context.hh" 53 #include "configValue.hh" 74 group_->setCheckable (
false);
80 QVBoxLayout *vL =
new QVBoxLayout;
81 QHBoxLayout *hL =
new QHBoxLayout;
83 if (_input->
state () & Input::Optional || !(_input->
state () & Input::NoExternalInput) ||
84 !(_input->
state () & Input::NoRuntimeUserInput))
86 QHBoxLayout *bL =
new QHBoxLayout;
87 QString dI = (_input->
state () & Input::NoExternalInput) ?
"" :
"Direct Input / ";
89 buttonGroup_ =
new QButtonGroup (
this);
91 constant_ =
new QRadioButton (
"Constant value");
92 if (_input->
state () & Input::Optional)
94 optional_ =
new QRadioButton (dI +
"Optional");
95 if (!(_input->
state () & Input::NoRuntimeUserInput))
97 forceAskUser_ =
new QRadioButton (
"Ask during execution");
98 buttonGroup_->addButton (forceAskUser_, 2);
102 optional_ =
new QRadioButton (dI +
"Ask during execution");
103 buttonGroup_->addButton (optional_, 0);
104 buttonGroup_->addButton (constant_, 1);
106 bL->addWidget (optional_);
107 bL->addWidget (constant_);
110 bL->addWidget (forceAskUser_);
111 buttonGroup_->addButton (forceAskUser_, 2);
116 QFrame *f =
new QFrame ();
118 f->setFrameStyle (QFrame::HLine | QFrame::Plain);
121 connect (buttonGroup_, SIGNAL (buttonClicked (
int)),
122 this, SLOT (selectionChange()));
128 hL->addWidget (main_);
129 hL->setStretchFactor (main_, 2);
131 QFrame *f =
new QFrame ();
133 f->setFrameStyle (QFrame::VLine | QFrame::Plain);
136 default_ =
new QPushButton (
"Default");
137 hL->addWidget (default_);
141 group_->setLayout (vL);
143 if (_input->
isSet ())
148 constant_->setChecked (
true);
152 if (!_input->
value ().isEmpty ())
157 forceAskUser_->setChecked (
true);
158 main_->setEnabled (
false);
159 default_->setEnabled (
false);
163 optional_->setChecked (
true);
164 main_->setEnabled (
false);
165 default_->setEnabled (
false);
169 connect (default_, SIGNAL (pressed()),
this, SLOT (toDefault()));
175 ConfigValue::~ ConfigValue ()
185 void ConfigValue::toDefault()
193 void ConfigValue::selectionChange()
196 if (constant_->isChecked())
198 main_->setEnabled (
true);
199 default_->setEnabled (
true);
203 main_->setEnabled (
false);
204 default_->setEnabled (
false);
virtual void fromValue(QString _from)=0
Set configuration to the value of the given string.
unsigned int state()
VSI::Input state passthrough.
virtual TypeWidget * widget(QMap< QString, QString >, QString, QWidget *=NULL)
Returns the configuration widget.
QString value() const
Returns value set by user.
Context * context() const
Context of element.
QString typeString() const
Type.
const QString & shortDescription() const
Short description.
ConfigValue(ElementInput *_input)
Constructor.
const Element * element() const
Element of this input/output.
bool isSet()
Return "set" flag.
Type * getType(QString _type)
Get type object for given type name.
bool isForceAskSet() const
Return "ForceAsk" flag.
QMap< QString, QString > hints() const
Parsed hints for this input/output type.
InOut * inOut() const
InOut context object.
virtual void toDefault()=0
reset the widget to default