diff options
-rw-r--r-- | client/formatparser.cc | 15 | ||||
-rw-r--r-- | client/macrowindow.cc | 17 | ||||
-rw-r--r-- | client/widgets/dbwidget.cc | 1 |
3 files changed, 22 insertions, 11 deletions
diff --git a/client/formatparser.cc b/client/formatparser.cc index 233a694..0f04d0a 100644 --- a/client/formatparser.cc +++ b/client/formatparser.cc @@ -127,17 +127,12 @@ QString format_parser(QString format, QSqlQuery &query) p++; } { - int fieldNo = query.record().indexOf(var); - resume += query.value(fieldNo).toString(); - - /* - QVector< Widget* >::iterator i = widgets.begin(); - while (i != widgets.end()) { - Widget* w = *i; - if(w->getName() == var) resume += w->getValue(); - i++; + int idx = query.record().indexOf(var); + if(idx == -1) { + printf("Unknown field in format string %s\n", var.toStdString().c_str()); + } else { + resume += query.value(idx).toString(); } - */ } break; diff --git a/client/macrowindow.cc b/client/macrowindow.cc index b0eab65..5ef342d 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -61,6 +61,21 @@ MacroWindow::MacroWindow(QDomNode &xml_doc) MacroWindow::~MacroWindow() { delete lua; + + QVector< Widget* >::iterator i = widgets.begin(); + while (i != widgets.end()) { + Widget* w = *i; + delete w; + i++; + } + + QVector< Widget* >::iterator j = auxwidgets.begin(); + while (j != auxwidgets.end()) { + Widget* w = *j; + delete w; + j++; + } + } void MacroWindow::initMacro(QDomNode &node) @@ -200,7 +215,7 @@ void MacroWindow::cont(QString name) bool MacroWindow::isClosed() { - return isclosed; + return isclosed || mainwidget->isVisible() == false; } Widget *MacroWindow::getWidget(QString name) diff --git a/client/widgets/dbwidget.cc b/client/widgets/dbwidget.cc index 69c868e..1c0a0d2 100644 --- a/client/widgets/dbwidget.cc +++ b/client/widgets/dbwidget.cc @@ -94,6 +94,7 @@ DBWidget::DBWidget(QDomNode &node, MacroWindow *macrowindow) DBWidget::~DBWidget() { db.close(); + db = QSqlDatabase(); } |