From c58541468c5477323e35837a8f0aeaf41e5a0794 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 13 Aug 2010 11:56:34 +0000 Subject: Fix one too many resets of the LUA stack. --- client/widgets/button.cc | 1 - client/widgets/checkbox.cc | 1 - client/widgets/lineedit.cc | 1 - client/widgets/widget.cc | 27 +++++++++++++++++---------- client/widgets/window.cc | 10 ++++++++-- 5 files changed, 25 insertions(+), 15 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/button.cc b/client/widgets/button.cc index 3234296..6e809fe 100644 --- a/client/widgets/button.cc +++ b/client/widgets/button.cc @@ -64,7 +64,6 @@ Button::Button(QDomNode &node, MacroWindow *macrowindow) Button::~Button() { - printf("Delete (Button) %p\n", this); fflush(stdout); // delete button; } diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index 19b59e6..af7d68f 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -63,7 +63,6 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow) CheckBox::~CheckBox() { - printf("Delete (CheckBox) %p\n", this); fflush(stdout); // delete checkbox; } diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index 6b231f3..cddd59e 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -65,7 +65,6 @@ LineEdit::LineEdit(QDomNode &node, MacroWindow *macrowindow) LineEdit::~LineEdit() { - printf("Delete (LineEdit) %p\n", this); fflush(stdout); // delete lineedit; } diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index f3247a0..cd29d0a 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -33,10 +33,15 @@ #include #include +//#define DEBUG(fmt...) printf(fmt) +#define DEBUG(ftm...) + Widget::Widget(QDomNode &node, MacroWindow *macrowindow) { widget = NULL; + hideChildren = false; + QDomElement elem = node.toElement(); this->macrowindow = macrowindow; @@ -65,16 +70,16 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow) is_valid = true; - printf("Create Widget '%s' of type '%s'\n", - name().toStdString().c_str(), - type().toStdString().c_str()); + DEBUG("Create Widget '%s' of type '%s'\n", + name().toStdString().c_str(), + type().toStdString().c_str()); } Widget::~Widget() { - printf("Delete Widget '%s' of type '%s'\n", - name().toStdString().c_str(), - type().toStdString().c_str()); + DEBUG("Delete Widget '%s' of type '%s'\n", + name().toStdString().c_str(), + type().toStdString().c_str()); QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { @@ -178,7 +183,7 @@ bool Widget::setKeyboardFocus() Widget *Widget::findWidget(QString n, bool deep) { - printf("Find Widget %p\n", this); fflush(stdout); + DEBUG("Find Widget %p\n", this); fflush(stdout); if(n == name()) return this; @@ -198,9 +203,11 @@ Widget *Widget::findWidget(QString n, bool deep) QVector< Widget* > Widget::widgetList(bool deep) { - printf("Widget List %p\n", this); fflush(stdout); + DEBUG("Widget List %p\n", this); fflush(stdout); + + QVector< Widget* > lst; - QVector< Widget* > lst = children; + lst.push_back(this); if(hideChildren && deep == false) return lst; @@ -221,7 +228,7 @@ void Widget::childWasChanged() void Widget::addChild(Widget *widget) { if(widget == NULL) { - printf("Trying to add NULL child to '%s'\n", name().toStdString().c_str()); + DEBUG("Trying to add NULL child to '%s'\n", name().toStdString().c_str()); return; } children.push_back(widget); diff --git a/client/widgets/window.cc b/client/widgets/window.cc index 4d9253d..b480189 100644 --- a/client/widgets/window.cc +++ b/client/widgets/window.cc @@ -30,9 +30,14 @@ #include #include +//#define DEBUG(fmt...) printf(fmt) +#define DEBUG(ftm...) + Window::Window(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { + DEBUG("window\n"); + widget = new QWidget(NULL); widget->setWindowFlags(Qt::WindowContextHelpButtonHint | @@ -60,6 +65,7 @@ Window::Window(QDomNode &node, MacroWindow *macrowindow) Window::~Window() { - printf("Delete (Window) %p\n", this); fflush(stdout); - // delete widget; + DEBUG("~window\n"); + + //delete widget; } -- cgit v1.2.3