From 819e9d404d2a72652764970651a66c4c9849c9c9 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 17 Aug 2010 11:23:02 +0000 Subject: Scroll improvement. Don't show console on startup. --- client/debug.cc | 6 ++++-- client/pracro.cc | 1 - client/widgets/altcombobox.cc | 16 +++++++++------- client/widgets/widget.cc | 14 +++++++------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/client/debug.cc b/client/debug.cc index 3138cf4..632db97 100644 --- a/client/debug.cc +++ b/client/debug.cc @@ -53,6 +53,7 @@ DebugWindow::DebugWindow() { setLayout(new QVBoxLayout()); lst = new QListWidget(); + lst->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); layout()->addWidget(lst); QSettings settings("Aasimon.org", "Pracro"); @@ -78,9 +79,10 @@ void DebugWindow::log(const char *func, const char *file, const int line, // Remove trailing newlines. while(msg.endsWith("\n")) msg = msg.left(msg.length() - 1); + ch = ch; QString txt; - txt.sprintf("[%s] %s %s:%s:%d ", - class_str[(unsigned)cl], ch, file, func, line); + txt.sprintf("[%s] %s:%s:%d ", + class_str[(unsigned)cl], file, func, line); txt += " : " + msg; QListWidgetItem *item = new QListWidgetItem(); diff --git a/client/pracro.cc b/client/pracro.cc index ded56bc..7ae939e 100644 --- a/client/pracro.cc +++ b/client/pracro.cc @@ -97,7 +97,6 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); dbg_init(); - dbg_show(); QString macro = MACRO_DEFAULT; QString templ = TEMPLATE_DEFAULT; diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc index f60fb5c..b5cdab0 100644 --- a/client/widgets/altcombobox.cc +++ b/client/widgets/altcombobox.cc @@ -35,6 +35,8 @@ #include "multilist.h" #include "macrowindow.h" +#include "debug.h" + AltComboBox::AltComboBox(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { @@ -72,14 +74,14 @@ AltComboBox::AltComboBox(QDomNode &node, MacroWindow *macrowindow) if(item.hasAttribute("value")) { altvalue = item.attribute("value"); } else { - printf("ERROR: altitem tag is missing the value attribute, " - "in altcombobox!\n"); + ERROR(altcombobos, "altitem tag is missing the value attribute, " + "in altcombobox!\n"); } if(item.hasAttribute("innerwidget")) { iwname = item.attribute("innerwidget"); } else { - printf("ERROR: altitem tag is missing the innerwidget attribute, " + ERROR(altcombobox, "altitem tag is missing the innerwidget attribute, " "in altcombobox!\n"); } @@ -108,7 +110,7 @@ AltComboBox::AltComboBox(QDomNode &node, MacroWindow *macrowindow) innerwidget = findWidget(iwname, true); if(innerwidget == NULL) { - printf("ERROR: Inner Widget %s not found (in altcombobox)!\n", + ERROR(altcombobox, "Inner Widget %s not found (in altcombobox)!\n", iwname.toStdString().c_str()); } @@ -182,9 +184,9 @@ void AltComboBox::onValueChange(int index) QComboBox *cmb = (QComboBox*)combobox->qwidget(); - printf("Value changed: %s altvalue: %s\n", - cmb->itemData(index).toString().toStdString().c_str(), - altvalue.toStdString().c_str()); + DEBUG(alcombobox, "Value changed: %s altvalue: %s\n", + cmb->itemData(index).toString().toStdString().c_str(), + altvalue.toStdString().c_str()); if(cmb->itemData(index).toString() == altvalue) { // altframe->setEnabled(true); diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 231359c..563f648 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -33,8 +33,7 @@ #include #include -#define DEBUG(fmt...) printf("Widget (%p)", this); printf(fmt); fflush(stdout) -//#define DEBUG(ftm...) +#include "debug.h" Widget::Widget(QDomNode &node, MacroWindow *macrowindow) { @@ -69,14 +68,14 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow) is_valid = true; - DEBUG("Create Widget '%s' of type '%s'\n", + DEBUG(widget, "Create Widget '%s' of type '%s'\n", name().toStdString().c_str(), type().toStdString().c_str()); } Widget::~Widget() { - DEBUG("Delete Widget '%s' of type '%s'\n", + DEBUG(widget, "Delete Widget '%s' of type '%s'\n", name().toStdString().c_str(), type().toStdString().c_str()); @@ -169,7 +168,7 @@ bool Widget::setKeyboardFocus() Widget *Widget::findWidget(QString n, bool deep) { - DEBUG("Find Widget %p\n", this); fflush(stdout); + DEBUG(widget, "Find Widget %p\n", this); if(n == name()) return this; @@ -189,7 +188,7 @@ Widget *Widget::findWidget(QString n, bool deep) QVector< Widget* > Widget::widgetList(bool deep) { - DEBUG("Widget List %p\n", this); fflush(stdout); + DEBUG(widget, "Widget List %p\n", this); QVector< Widget* > lst; @@ -214,7 +213,8 @@ void Widget::childWasChanged() void Widget::addChild(Widget *widget) { if(widget == NULL) { - DEBUG("Trying to add NULL child to '%s'\n", name().toStdString().c_str()); + WARN(widget, "Trying to add NULL child to '%s'\n", + name().toStdString().c_str()); return; } children.push_back(widget); -- cgit v1.2.3