diff options
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r-- | client/macrowindow.cc | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 04cc2cb..16f86f9 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -79,13 +79,49 @@ MacroWindow::~MacroWindow() void MacroWindow::update(QDomNode &node) { - clear(); - lua->clear(); + if(is_static || mainwidget == NULL) { + clear(); + lua->clear(); - initMacro(node); + initMacro(node); + + if(mainwidget) setExpandedWidget(mainwidget->qwidget()); + else setExpandedWidget(NULL); + } + + updateResume(node); +} + +void MacroWindow::updateResume(QDomNode &node) +{ + QDomElement elem = node.toElement(); + + if(elem.tagName() == "resume") { + QString resume = elem.text(); + ResumeWidget::state_t state = ResumeWidget::OLD; + if(elem.hasAttribute("state")) { + if(elem.attribute("state") == "old") state = ResumeWidget::OLD; + if(elem.attribute("state") == "new") state = ResumeWidget::NEW; + if(elem.attribute("state") == "dirty") state = ResumeWidget::DIRTY; + } + /* + if(!mainwidget) { // Only call collapse if the macro is in resume state. + collapse(); + } + */ + ((ResumeWidget*)collapsedWidget())->setText(resume, state); + updateHeight(); + + return; + } + + QDomNodeList children = node.childNodes(); + + for (int i=0; i<children.count();i++) { + QDomNode child = children.at(i); + updateResume(child); + } - if(mainwidget) setExpandedWidget(mainwidget->qwidget()); - else setExpandedWidget(NULL); } void MacroWindow::initMacro(QDomNode &node) @@ -101,6 +137,7 @@ void MacroWindow::initMacro(QDomNode &node) } else if(elem.tagName() == "scripts") { // Nothing to do here } else if(elem.tagName() == "resume") { + /* // Handled in updateResume QString resume = elem.text(); ResumeWidget::state_t state = ResumeWidget::OLD; if(elem.hasAttribute("state")) { @@ -110,11 +147,11 @@ void MacroWindow::initMacro(QDomNode &node) } if(!mainwidget) { // Only call collapse if the macro is in resume state. - collapse(); + //collapse(); } ((ResumeWidget*)collapsedWidget())->setText(resume, state); - + */ } else if(elem.tagName() == "script") { lua->runScript(elem.text(), NULL, "preload"); |