From 1db5fd50a64224a67fe2e2ccc9ef0d3479bb5aed Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 18 Aug 2010 11:00:35 +0000 Subject: Add 'clear' toolbutton. --- client/debug.cc | 19 +++++++++++++++++-- client/debug.h | 7 +++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'client') diff --git a/client/debug.cc b/client/debug.cc index 066b0bc..49f970d 100644 --- a/client/debug.cc +++ b/client/debug.cc @@ -31,16 +31,26 @@ #include #include #include +#include +#include static const char * const class_str[] = { "debug", "error", "warn", "log" }; DebugWindow::DebugWindow() { - setLayout(new QVBoxLayout()); + QWidget *center = new QWidget(); + setCentralWidget(center); + + center->setLayout(new QVBoxLayout()); lst = new QListWidget(); lst->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - layout()->addWidget(lst); + center->layout()->addWidget(lst); + + QToolBar *toolbar = addToolBar("debug"); + toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); + QAction *clear = toolbar->addAction("Clear"); + connect(clear, SIGNAL(triggered()), this, SLOT(clear())); QSettings settings("Aasimon.org", "Pracro"); settings.beginGroup("DebugWindow"); @@ -62,6 +72,11 @@ void DebugWindow::closeEvent(QCloseEvent *event) event->accept(); } +void DebugWindow::clear() +{ + lst->clear(); +} + void DebugWindow::log(const char *func, const char *file, const int line, debug_class cl, const char *ch, QString &msg) { diff --git a/client/debug.h b/client/debug.h index ebafce5..f10efd8 100644 --- a/client/debug.h +++ b/client/debug.h @@ -27,7 +27,7 @@ */ #ifndef __PRACRO_DEBUG_H__ -#include +#include #include #include #include @@ -39,7 +39,7 @@ typedef enum { _log } debug_class; -class DebugWindow : public QDialog { +class DebugWindow : public QMainWindow { Q_OBJECT public: DebugWindow(); @@ -50,6 +50,9 @@ public: protected: void closeEvent(QCloseEvent *event); +private slots: + void clear(); + private: QListWidget *lst; QTimer timer; -- cgit v1.2.3