From 25508b5eeffc3345c0faab80ae05a0f2c663eb66 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 3 Mar 2011 10:58:24 +0000 Subject: Spring cleaning... --- client/macrowindow.cc | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 16f86f9..f38245e 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -61,9 +61,12 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, this->templ = templ; - setCollapsedWidget(new ResumeWidget(compact)); + resumewidget = new ResumeWidget(compact); + setCollapsedWidget(resumewidget); - update(xml_doc); + // update(xml_doc); + initMacro(xml_doc); + if(mainwidget) setExpandedWidget(mainwidget->qwidget()); setCollapsed(!is_static); active = true; @@ -74,11 +77,12 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, MacroWindow::~MacroWindow() { clear(); - delete collapsedWidget(); + delete resumewidget; } void MacroWindow::update(QDomNode &node) { + /* if(is_static || mainwidget == NULL) { clear(); lua->clear(); @@ -88,7 +92,7 @@ void MacroWindow::update(QDomNode &node) if(mainwidget) setExpandedWidget(mainwidget->qwidget()); else setExpandedWidget(NULL); } - + */ updateResume(node); } @@ -109,7 +113,7 @@ void MacroWindow::updateResume(QDomNode &node) collapse(); } */ - ((ResumeWidget*)collapsedWidget())->setText(resume, state); + resumewidget->setText(resume, state); updateHeight(); return; @@ -137,21 +141,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")) { - 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); - */ + // Handled in updateResume } else if(elem.tagName() == "script") { lua->runScript(elem.text(), NULL, "preload"); @@ -210,9 +200,8 @@ bool MacroWindow::doCommit() qApp->processEvents(); - collapse(); + setCollapsed(true); emit updateOnCommit(); - // setCollapsed(true); return true; } else { -- cgit v1.2.3