diff options
author | deva <deva> | 2008-06-09 14:50:00 +0000 |
---|---|---|
committer | deva <deva> | 2008-06-09 14:50:00 +0000 |
commit | 95c75f805ec5f22f5e876dc3fddf8a72d6afd014 (patch) | |
tree | 499e6ac228fe5ccd6c900ddafc9611b5d750b2e7 | |
parent | bce7808fecc65d56b695be03f6b39fed51589562 (diff) |
Fixed macrowindow generation errors when multiple macroes (some empty) are sent.
-rw-r--r-- | client/macro.cc | 16 | ||||
-rw-r--r-- | client/macrowindow.cc | 4 | ||||
-rw-r--r-- | client/macrowindow.h | 2 | ||||
-rw-r--r-- | client/pracro.cc | 4 |
4 files changed, 20 insertions, 6 deletions
diff --git a/client/macro.cc b/client/macro.cc index d4ae0c0..08e44f4 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -123,9 +123,23 @@ static void create_macro(QString course, QString macro) cleanup_macros(); + // + // TODO: This is where the dependency checking should occur. + // + // Initiate the new macro window with the xml document and push // it to the window list - macrowindows.push_back( new MacroWindow(&xml_doc) ); + QDomNodeList courses = xml_doc.documentElement().childNodes(); + QDomNode coursenode = courses.at(0); // There can be only one! + QDomNodeList macros = coursenode.childNodes(); + for(int j = 0; j < macros.count(); j++) { + QDomNode macronode = macros.at(j); + // Only create if the macro contains something. + if(macronode.childNodes().count()) + macrowindows.push_back( new MacroWindow( macronode ) ); + } + //} + } } bool MacroEventFilter::eventFilter( QObject *, QEvent *e ) diff --git a/client/macrowindow.cc b/client/macrowindow.cc index aab9857..69df7f1 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -42,7 +42,7 @@ extern QString user; extern QString host; extern quint16 port; -MacroWindow::MacroWindow(QDomDocument *xml_doc) +MacroWindow::MacroWindow(QDomNode &xml_doc) : QObject() { isclosed = false; @@ -50,7 +50,7 @@ MacroWindow::MacroWindow(QDomDocument *xml_doc) this->lua = new LUA(this); // Execute the recursive function with documentElement - recurser(xml_doc->documentElement(), NULL); + recurser(xml_doc, NULL); } MacroWindow::~MacroWindow() diff --git a/client/macrowindow.h b/client/macrowindow.h index 7138464..138c438 100644 --- a/client/macrowindow.h +++ b/client/macrowindow.h @@ -41,7 +41,7 @@ class MacroWindow : public QObject { Q_OBJECT public: - MacroWindow(QDomDocument *xml_doc); + MacroWindow(QDomNode &xml_doc); ~MacroWindow(); bool isClosed(); diff --git a/client/pracro.cc b/client/pracro.cc index d0fbbf2..2b5c6c2 100644 --- a/client/pracro.cc +++ b/client/pracro.cc @@ -35,8 +35,8 @@ #define VERSION "1.0" #define CPR_DEFAULT "0000000000" -#define MACRO_DEFAULT "example2" -#define COURSE_DEFAULT "example2" +#define MACRO_DEFAULT "example" +#define COURSE_DEFAULT "example" #define USER_DEFAULT "testuser" #define CONFIG_DEFAULT "pracro.ini" |