summaryrefslogtreecommitdiff
path: root/client/debug.cc
diff options
context:
space:
mode:
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.