summaryrefslogtreecommitdiff
path: root/client/debug.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-18 11:17:57 +0000
committerdeva <deva>2010-08-18 11:17:57 +0000
commit195e25f7f46cf273bce2bb582f12b17fc2997c89 (patch)
treee214dd6a251513c7bd6adcb3432754119e3d5648 /client/debug.cc
parent1db5fd50a64224a67fe2e2ccc9ef0d3479bb5aed (diff)
Add filter toggle buttons.
Diffstat (limited to 'client/debug.cc')
-rw-r--r--client/debug.cc57
1 files changed, 56 insertions, 1 deletions
diff --git a/client/debug.cc b/client/debug.cc
index 49f970d..1507b2e 100644
--- a/client/debug.cc
+++ b/client/debug.cc
@@ -47,11 +47,41 @@ DebugWindow::DebugWindow()
lst->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
center->layout()->addWidget(lst);
- QToolBar *toolbar = addToolBar("debug");
+ QToolBar *toolbar = addToolBar("Tools");
toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
QAction *clear = toolbar->addAction("Clear");
connect(clear, SIGNAL(triggered()), this, SLOT(clear()));
+ QToolBar *toolbar2 = addToolBar("Filters");
+ toolbar2->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+ QAction *a = new QAction(toolbar2);
+ a->setText("debug");
+ a->setCheckable(true);
+ toolbar2->addAction(a);
+ connect(a, SIGNAL(toggled(bool)), this, SLOT(debug_toggled(bool)));
+ a->setChecked(true);
+
+ a = new QAction(toolbar2);
+ a->setText("error");
+ a->setCheckable(true);
+ toolbar2->addAction(a);
+ connect(a, SIGNAL(toggled(bool)), this, SLOT(error_toggled(bool)));
+ a->setChecked(true);
+
+ a = new QAction(toolbar2);
+ a->setText("warning");
+ a->setCheckable(true);
+ toolbar2->addAction(a);
+ connect(a, SIGNAL(toggled(bool)), this, SLOT(warning_toggled(bool)));
+ a->setChecked(true);
+
+ a = new QAction(toolbar2);
+ a->setText("log");
+ a->setCheckable(true);
+ toolbar2->addAction(a);
+ connect(a, SIGNAL(toggled(bool)), this, SLOT(log_toggled(bool)));
+ a->setChecked(true);
+
QSettings settings("Aasimon.org", "Pracro");
settings.beginGroup("DebugWindow");
resize(settings.value("size", QSize(700, 800)).toSize());
@@ -77,9 +107,34 @@ void DebugWindow::clear()
lst->clear();
}
+void DebugWindow::debug_toggled(bool on)
+{
+ show_debug = on;
+}
+
+void DebugWindow::error_toggled(bool on)
+{
+ show_error = on;
+}
+
+void DebugWindow::warning_toggled(bool on)
+{
+ show_warning = on;
+}
+
+void DebugWindow::log_toggled(bool on)
+{
+ show_log = on;
+}
+
void DebugWindow::log(const char *func, const char *file, const int line,
debug_class cl, const char *ch, QString &msg)
{
+ if(cl == _debug && show_debug == false) return; // Ignore
+ if(cl == _error && show_error == false) return; // Ignore
+ if(cl == _warn && show_warning == false) return; // Ignore
+ if(cl == _log && show_log == false) return; // Ignore
+
timer.stop();
// Remove trailing newlines.