summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/debug.cc57
-rw-r--r--client/debug.h9
2 files changed, 65 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.
diff --git a/client/debug.h b/client/debug.h
index f10efd8..e583afc 100644
--- a/client/debug.h
+++ b/client/debug.h
@@ -52,10 +52,19 @@ protected:
private slots:
void clear();
+ void debug_toggled(bool);
+ void error_toggled(bool);
+ void warning_toggled(bool);
+ void log_toggled(bool);
private:
QListWidget *lst;
QTimer timer;
+
+ bool show_debug;
+ bool show_error;
+ bool show_warning;
+ bool show_log;
};
void dbg_init();