diff options
author | deva <deva> | 2010-08-12 10:57:04 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-12 10:57:04 +0000 |
commit | d9338083192084613e5530b02710b796252d342b (patch) | |
tree | e0ec2b36e0de62328e5fd5d3b597f6ee71d1b18f /client/formatparser.cc | |
parent | dbab8458dcce186e7eb7a114a83f759d7db5445a (diff) |
New scripting system part2.
Diffstat (limited to 'client/formatparser.cc')
-rw-r--r-- | client/formatparser.cc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/client/formatparser.cc b/client/formatparser.cc index 62f0b21..71f80ee 100644 --- a/client/formatparser.cc +++ b/client/formatparser.cc @@ -31,15 +31,24 @@ #include <string.h> #include "lua.h" +#include "macrowindow.h" +#include "widgets/widget.h" -static QString format_parser_lua(QString format, QVector< Widget *> widgets) +static QString format_parser_lua(QString format, Widget *w) { - LUA lua(&widgets); + /* + LUA lua(w); return lua.runParser(format); + */ + + format = format; + w = w; + + return "FIXME: formatparser.cc:44"; } -static QString format_parser_pracro(QString format, QVector< Widget *> widgets) +static QString format_parser_pracro(QString format, Widget *w) { QString resume; QString var; @@ -64,12 +73,8 @@ static QString format_parser_pracro(QString format, QVector< Widget *> widgets) p++; } { - QVector< Widget* >::iterator i = widgets.begin(); - while (i != widgets.end()) { - Widget* w = *i; - if(w->name() == var) resume += w->getValue(); - i++; - } + Widget *widget = w->findWidget(var, true); + if(widget) resume += widget->value(); } break; @@ -182,9 +187,9 @@ QString format_parser(QString format, QSqlQuery &query) return resume; } -QString format_parser(QString format, QVector< Widget *> widgets, QString language) +QString format_parser(QString format, Widget *w, QString language) { - if(language == "pracro") return format_parser_pracro(format, widgets); - if(language == "lua") return format_parser_lua(format, widgets); + if(language == "pracro") return format_parser_pracro(format, w); + if(language == "lua") return format_parser_lua(format, w); return ""; } |