diff options
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r-- | client/macrowindow.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc index f38245e..0770021 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -36,7 +36,6 @@ #include "widgets/widget.h" #include "widgets/window.h" #include "lua.h" -#include "resumewidget.h" #include "debug.h" @@ -48,7 +47,7 @@ extern quint16 port; MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, bool is_static, bool compact, QScrollArea *scrollarea) - : Collapser(NULL, NULL, true, compact?NULL:scrollarea), netcom(n) + : Collapser(NULL, compact?NULL:scrollarea), netcom(n) { this->is_static = is_static; @@ -62,16 +61,18 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, this->templ = templ; resumewidget = new ResumeWidget(compact); - setCollapsedWidget(resumewidget); // update(xml_doc); + updateResume(xml_doc); initMacro(xml_doc); - if(mainwidget) setExpandedWidget(mainwidget->qwidget()); - setCollapsed(!is_static); + if(mainwidget) animateToWidget(mainwidget->qwidget(), true); + else animateToWidget(resumewidget); + active = true; - connect(this, SIGNAL(doneCollapsing()), this, SLOT(collapsed())); + connect(this, SIGNAL(doneAnimating(QWidget*)), + this, SLOT(animated(QWidget*))); } MacroWindow::~MacroWindow() @@ -200,7 +201,7 @@ bool MacroWindow::doCommit() qApp->processEvents(); - setCollapsed(true); + animateToWidget(resumewidget); emit updateOnCommit(); return true; @@ -226,7 +227,7 @@ void MacroWindow::cancel() void MacroWindow::expandWrapper() { - if(!isCollapsed()) return; + if(currentWidget() != resumewidget) return; waschanged = false; @@ -264,8 +265,7 @@ void MacroWindow::expandWrapper() // system and thereby validate correctly. if(mainwidget) mainwidget->setValues(); - if(mainwidget) setExpandedWidget(mainwidget->qwidget()); - expand(); + if(mainwidget) animateToWidget(mainwidget->qwidget(), true); // Set keyboard focus on the first focusable widget in the macro. QVector< Widget* > widgets; @@ -283,7 +283,7 @@ void MacroWindow::expandWrapper() void MacroWindow::collapseWrapper() { - if(isCollapsed()) return; + if(currentWidget() == resumewidget) return; if(waschanged) { switch(MessageBox::warning(NULL, @@ -297,21 +297,21 @@ void MacroWindow::collapseWrapper() doCommit(); break; case MessageBox::Close: - collapse(); + animateToWidget(resumewidget); break; case MessageBox::Cancel: default: break; } } else { - collapse(); + animateToWidget(resumewidget); } } void MacroWindow::toggleMacro() { if(!active) return; - if(isCollapsed()) { + if(currentWidget() == resumewidget) { expandWrapper(); } else { collapseWrapper(); @@ -338,7 +338,7 @@ void MacroWindow::setActive(bool active) void MacroWindow::clear() { // DEBUG(macrowindow, "clear %p\n", this); - setExpandedWidget(NULL); + //setExpandedWidget(NULL); if(mainwidget) delete mainwidget; mainwidget = NULL; @@ -346,8 +346,10 @@ void MacroWindow::clear() // lua->clear(); } -void MacroWindow::collapsed() +void MacroWindow::animated(QWidget *w) { - DEBUG(macrowindow, "collapsed %p\n", this); - clear(); + if(w == resumewidget) { + DEBUG(macrowindow, "collapsed %p\n", this); + clear(); + } } |