diff options
author | deva <deva> | 2010-08-17 14:29:05 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-17 14:29:05 +0000 |
commit | d2295ad23ed22af07addc93b71e36f7bb688d534 (patch) | |
tree | 4915612e87646091275e291bae291951744585fc /client/widgets | |
parent | b23c3c321b80449aa22e14d40115d1e4a764a1b3 (diff) |
New format parser for metawidget et al. DBWidget is broken for the moment...
Diffstat (limited to 'client/widgets')
-rw-r--r-- | client/widgets/dbwidget.cc | 3 | ||||
-rw-r--r-- | client/widgets/metawidget.cc | 26 | ||||
-rw-r--r-- | client/widgets/widget.h | 3 |
3 files changed, 8 insertions, 24 deletions
diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc index 4d6240c..08107b1 100644 --- a/client/widgets/dbwidget.cc +++ b/client/widgets/dbwidget.cc @@ -36,7 +36,6 @@ #include <QLineEdit> #include <QComboBox> -#include "formatparser.h" #include "common.h" #define EMPTY_STRING "Write something in the searchfield" @@ -160,7 +159,7 @@ void DBWidget::update_list(QString prefix) QStringList lst; while(query.next()) { - lst << format_parser(format, query); + // lst << format_parser(format, query); } lst.sort(); diff --git a/client/widgets/metawidget.cc b/client/widgets/metawidget.cc index a179138..a866445 100644 --- a/client/widgets/metawidget.cc +++ b/client/widgets/metawidget.cc @@ -31,10 +31,11 @@ #include <QFrame> #include "messagebox.h" -#include "formatparser.h" #include "macrowindow.h" #include "common.h" +#include "debug.h" + MetaWidget::MetaWidget(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { @@ -59,24 +60,7 @@ MetaWidget::MetaWidget(QDomNode &node, MacroWindow *macrowindow) */ // addChildren(node); - // Setup format string - if(elem.hasAttribute("formatlanguage")) { - formatlanguage = elem.attribute("formatlanguage"); - } else { - formatlanguage = "pracro"; - } - - if(elem.hasAttribute("format")) { - format = elem.attribute("format"); - } else { - QVector< Widget* >::iterator i = widgets.begin(); - while (i != widgets.end()) { - Widget* w = *i; - if(format != "") format += ", "; - format += "${" + w->name() + "}"; - i++; - } - } + format = elem.attribute("format", ""); addChildren(node, frame->layout()); @@ -101,12 +85,12 @@ void MetaWidget::changed() QString MetaWidget::value() { - return format_parser(format, this, formatlanguage); + return lua->runScriptS(format, this, "format"); } void MetaWidget::setValue(QString, QString) { - // Nothing reasonable we can do here. + WARN(metawidget, "setValue was attempted on this widget."); } bool MetaWidget::preValid() diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 3315c2e..d172543 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -95,6 +95,8 @@ protected: void addChildren(QDomNode &xml_node, QLayout *layout); + LUA *lua; + private: QVector< Widget* > children; void createWidget(QDomNode &xml_node, QLayout *layout); @@ -109,7 +111,6 @@ private: QString widget_type; bool widget_local; - LUA *lua; MacroWindow *macrowindow; bool hasOnChangeEvent; |