summaryrefslogtreecommitdiff
path: root/client/formatparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/formatparser.cc')
-rw-r--r--client/formatparser.cc29
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 "";
}