summaryrefslogtreecommitdiff
path: root/client/widgets/widget.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-03 12:30:27 +0000
committerdeva <deva>2010-08-03 12:30:27 +0000
commitdbab8458dcce186e7eb7a114a83f759d7db5445a (patch)
tree5abbd9e97b17a0e8321adea983594d818157e8e2 /client/widgets/widget.cc
parentd285c1bdb79752ef23a7252c9c2d9f408f0c9f49 (diff)
New scripting interface part1.
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r--client/widgets/widget.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index 5899839..c17633f 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -31,7 +31,9 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow)
QDomElement elem = node.toElement();
this->macrowindow = macrowindow;
-
+
+ widget_type = elem.tagName();
+
if(elem.hasAttribute("name")) {
widget_name = elem.attribute("name");
} else {
@@ -63,11 +65,16 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow)
initial_value = "";
}
-QString Widget::getName()
+QString Widget::name()
{
return widget_name;
}
+QString Widget::type()
+{
+ return widget_type;
+}
+
void Widget::setValue(QString, QString)
{
}
@@ -85,11 +92,12 @@ bool Widget::regexpValidator()
bool Widget::luaValidator()
{
if(!hasluaprogram) return true;
-
- if(macrowindow->luaprograms.contains(luaprogram) == false) return false;
- QString program = macrowindow->luaprograms.value(luaprogram);
- return macrowindow->lua->runValidator(program, getName(), getValue());
+ QString program = "";
+
+ program += luaprogram;
+
+ return macrowindow->lua->runValidator(program, this, name(), getValue());
}
void Widget::setInitialValue(QString value)