diff options
Diffstat (limited to 'client/macrowindow.cc')
-rw-r--r-- | client/macrowindow.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 5a6760e..f8c9af6 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -42,10 +42,16 @@ extern QString user; extern QString host; extern quint16 port; +#define DEBUG(fmt...) printf("MacroWindow (%p)", this); \ + printf(fmt); fflush(stdout) +//#define DEBUG(ftm...) + MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, bool collapsed, bool compact) : Collapser(), netcom(n) { + DEBUG("macrowindow %p\n", this); + mainwidget = NULL; lua = new LUA(&mainwidget); @@ -55,11 +61,12 @@ MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ, setCollapsedWidget(new ResumeWidget(compact)); - update(xml_doc); setCollapsed(collapsed); active = true; + + connect(this, SIGNAL(doneCollapsing()), this, SLOT(collapsed())); } MacroWindow::~MacroWindow() @@ -69,6 +76,9 @@ MacroWindow::~MacroWindow() void MacroWindow::update(QDomNode &node) { + clear(); + lua->clear(); + initMacro(node); if(mainwidget) setExpandedWidget(mainwidget->qwidget()); @@ -106,7 +116,7 @@ void MacroWindow::initMacro(QDomNode &node) } else if(xml_elem.tagName() == "widgets") { if(mainwidget) { - printf("ERROR!!!!!!\n\tmainwidget already exists!\n"); + DEBUG("ERROR!!!!!!\n\tmainwidget already exists!\n"); } Window *window = new Window(xml_elem, this); @@ -271,7 +281,7 @@ void MacroWindow::toggleMacro() void MacroWindow::macroChanged() { - printf("This macro was changed!\n"); + DEBUG("This macro was changed!\n"); emit macroHasChanged(); waschanged = true; } @@ -288,11 +298,17 @@ void MacroWindow::setActive(bool active) void MacroWindow::clear() { + DEBUG("clear %p\n", this); + setExpandedWidget(NULL); + if(mainwidget) delete mainwidget; mainwidget = NULL; - lua->clear(); - - setExpandedWidget(NULL); + // lua->clear(); } +void MacroWindow::collapsed() +{ + DEBUG("collapsed %p\n", this); + clear(); +} |