summaryrefslogtreecommitdiff
path: root/client/widgets/widget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r--client/widgets/widget.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index 93deb31..f3247a0 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -55,8 +55,9 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow)
prefilled = elem.attribute("prefilled");
}
- has_initial_value = false;
- initial_value = "";
+ has_initial_value = elem.hasAttribute("name") && elem.hasAttribute("value");
+ lazy_value = elem.attribute("value", "");
+ lazy_source = elem.attribute("prefilled", "");
if((hasOnChangeEvent = elem.hasAttribute("onChange"))) {
onChangeEventScript = elem.attribute("onChange");
@@ -90,15 +91,6 @@ Widget::~Widget()
}
}
-void Widget::addChildren(QDomNode &node, QLayout *layout)
-{
- QDomNodeList children = node.childNodes();
- for (int i=0; i<children.count();i++) {
- QDomNode child = children.at(i);
- widgetBuilder(child, layout);
- }
-}
-
QString Widget::name()
{
return widget_name;
@@ -236,10 +228,29 @@ void Widget::addChild(Widget *widget)
connect(widget, SIGNAL(wasChanged()), this, SLOT(childWasChanged()));
}
-void Widget::widgetBuilder(QDomNode &xml_node, QLayout *layout)
+void Widget::addChildren(QDomNode &node, QLayout *layout)
{
- QDomElement xml_elem = xml_node.toElement();
+ QDomNodeList children = node.childNodes();
+ for (int i=0; i<children.count();i++) {
+ QDomNode child = children.at(i);
+ createWidget(child, layout);
+ }
+}
+
+void Widget::setValues()
+{
+ if(has_lazy) setValue(lazy_value, lazy_source);
+
+ QVector< Widget* >::iterator i = children.begin();
+ while(i != children.end()) {
+ if(*i) (*i)->setValues();
+ i++;
+ }
+}
+void Widget::createWidget(QDomNode &xml_node, QLayout *layout)
+{
+ QDomElement xml_elem = xml_node.toElement();
// TODO: Why do we do this??
if(xml_elem.hasAttribute("prefilled") &&