diff options
author | deva <deva> | 2011-02-23 10:08:46 +0000 |
---|---|---|
committer | deva <deva> | 2011-02-23 10:08:46 +0000 |
commit | b62e7ea66866a80181efa366ba255c6a30a8a664 (patch) | |
tree | 0ecfb1683de6beff8041db9a54582f13670e8d99 /client/macrowindow.cc | |
parent | 8fbf461b279c0b96fdf5b764ef04376b5f7da7ec (diff) |
Fixes 'speedy collapse' on commit.
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"); |