From c4ecebb7a1f33acb38d51a82788b071186ff3c19 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 13 Aug 2010 09:22:28 +0000 Subject: setValues recursive. Remove old widgetbuilder files. --- client/widgets/altcombobox.cc | 1 - client/widgets/metawidget.cc | 1 - client/widgets/multilist.cc | 1 - client/widgets/widget.cc | 37 ++++++++++++++++++++++++------------- client/widgets/widget.h | 9 ++++++++- 5 files changed, 32 insertions(+), 17 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc index a4f5e76..88ce376 100644 --- a/client/widgets/altcombobox.cc +++ b/client/widgets/altcombobox.cc @@ -32,7 +32,6 @@ #include #include "common.h" -#include "widgetbuilder.h" #include "multilist.h" #include "macrowindow.h" diff --git a/client/widgets/metawidget.cc b/client/widgets/metawidget.cc index ff359f4..55a8bd4 100644 --- a/client/widgets/metawidget.cc +++ b/client/widgets/metawidget.cc @@ -31,7 +31,6 @@ #include #include "messagebox.h" -#include "widgetbuilder.h" #include "formatparser.h" #include "macrowindow.h" #include "common.h" diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc index cccad5a..0160440 100644 --- a/client/widgets/multilist.cc +++ b/client/widgets/multilist.cc @@ -36,7 +36,6 @@ #include #include "messagebox.h" -#include "widgetbuilder.h" #include "common.h" #include "macrowindow.h" 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::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") && diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 960dca9..2a95294 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -80,6 +80,7 @@ public: Widget *findWidget(QString name, bool deep = false); QVector< Widget* > widgetList(bool deep = false); void addChild(Widget *widget); + void setValues(); signals: void wasChanged(); @@ -96,11 +97,16 @@ protected: QWidget *widget; bool hideChildren; - void widgetBuilder(QDomNode &xml_node, QLayout *layout); void addChildren(QDomNode &xml_node, QLayout *layout); private: QVector< Widget* > children; + void createWidget(QDomNode &xml_node, QLayout *layout); + + // Store value in constructor to be set later. + bool has_lazy; + QString lazy_value; + QString lazy_source; bool is_valid; QString widget_name; @@ -114,6 +120,7 @@ private: QString onChangeEventScript; QString initial_value; + QString initial_source; bool has_initial_value; QString prefilled; -- cgit v1.2.3