summaryrefslogtreecommitdiff
path: root/client/macrowindow.cc
diff options
context:
space:
mode:
authordeva <deva>2008-07-02 09:42:38 +0000
committerdeva <deva>2008-07-02 09:42:38 +0000
commitfe81dbb0a0dfc9c3808df9576dfe9a8f0b7520be (patch)
tree33281ee07a3fef90dfca8fbe330cbd7f16b79967 /client/macrowindow.cc
parent4d7617cbf20985b7cf2231675d8aadd01f77c3d2 (diff)
Made all setValue calls in a second pass, to the construction of the widgets.
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r--client/macrowindow.cc57
1 files changed, 11 insertions, 46 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index ad85c6f..764bf79 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -85,10 +85,18 @@ void MacroWindow::initMacro(QDomNode &node)
QDomNodeList children = node.childNodes();
+ // Build widgets
for (int i=0; i<children.count();i++) {
QDomNode child = children.at(i);
widgets += widgetBuilder(child, mainwidget, this);
}
+
+ // Insert their values (this must be done last for lua progs to work properly)
+ for (int i=0; i<children.count();i++) {
+ QDomNode child = children.at(i);
+ setValues(child, this);
+ }
+
return;
}
@@ -98,7 +106,6 @@ void MacroWindow::initMacro(QDomNode &node)
QDomNode child = children.at(i);
initMacro(child);
}
-
}
bool MacroWindow::doCommit()
@@ -221,55 +228,13 @@ bool MacroWindow::isClosed()
return isclosed;
}
-QString MacroWindow::getValue(QString name)
-{
- // Iterate the different entries, and append their results to the commit string
- QVector< Widget* >::iterator i=widgets.begin();
- while (i != widgets.end()) {
- Widget* w = *i;
- if(name == w->getName()) return w->getValue();
- i++;
- }
- return name + " - No such field!";
-}
-
-void MacroWindow::setValue(QString name, QString value)
-{
- // Iterate the different entries, and append their results to the commit string
- QVector< Widget* >::iterator i = widgets.begin();
- while (i != widgets.end()) {
- Widget* w = *i;
- if(name == w->getName()) w->setValue(value);
- i++;
- }
-}
-
-void MacroWindow::enable(QString name)
-{
- // Iterate the different entries, and append their results to the commit string
- QVector< Widget* >::iterator i=widgets.begin();
- while (i != widgets.end()) {
- Widget* w = *i;
- if(name == w->getName()) {
- w->enable();
- return;
- }
- i++;
- }
- printf("widget not found!\n");
-}
-
-void MacroWindow::disable(QString name)
+Widget *MacroWindow::getWidget(QString name)
{
- // Iterate the different entries, and append their results to the commit string
QVector< Widget* >::iterator i=widgets.begin();
while (i != widgets.end()) {
Widget* w = *i;
- if(name == w->getName()) {
- w->disable();
- return;
- }
+ if(name == w->getName()) return w;
i++;
}
- printf("widget not found!\n");
+ return NULL;
}