diff options
author | deva <deva> | 2009-02-12 14:42:12 +0000 |
---|---|---|
committer | deva <deva> | 2009-02-12 14:42:12 +0000 |
commit | 9be2869c6ebad21621e10b3bd9e82dc811b75d2d (patch) | |
tree | 499aa5af9dfd80aae4c07437f2f55f21241e5891 /client/widgets | |
parent | 22e0b0ddd78f13b2648befe892d9ec6c5b1b1229 (diff) |
Added formatlanguage attribute to metawidget, and implemented lua parser for it.
Diffstat (limited to 'client/widgets')
-rw-r--r-- | client/widgets/metawidget.cc | 8 | ||||
-rw-r--r-- | client/widgets/metawidget.h | 1 | ||||
-rw-r--r-- | client/widgets/widget.cc | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/client/widgets/metawidget.cc b/client/widgets/metawidget.cc index 5102a04..c085f10 100644 --- a/client/widgets/metawidget.cc +++ b/client/widgets/metawidget.cc @@ -55,6 +55,12 @@ MetaWidget::MetaWidget(QDomNode &node, MacroWindow *macrowindow) else macrowindow->addAuxWidgets(widgets); // Setup format string + if(elem.hasAttribute("formatlanguage")) { + formatlanguage = elem.attribute("formatlanguage"); + } else { + formatlanguage = "pracro"; + } + if(elem.hasAttribute("format")) { format = elem.attribute("format"); } else { @@ -83,7 +89,7 @@ void MetaWidget::changed() QString MetaWidget::getValue() { - return format_parser(format, widgets); + return format_parser(format, widgets, formatlanguage); } void MetaWidget::setValue(QString, QString) diff --git a/client/widgets/metawidget.h b/client/widgets/metawidget.h index 77b79d7..022197a 100644 --- a/client/widgets/metawidget.h +++ b/client/widgets/metawidget.h @@ -70,6 +70,7 @@ private: QListWidget *list; QVector< Widget* > widgets; QString format; + QString formatlanguage; bool storechildren; }; diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 0857d67..870fc4b 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -81,8 +81,11 @@ 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->run(luaprogram, getName(), getValue()); + return macrowindow->lua->runValidator(program, getName(), getValue()); } void Widget::setInitialValue(QString value) |