[PATCH 3 of 4] (issue46) Add debug option for trustbridge-admin

Wald Commits scm-commit at wald.intevation.org
Tue Sep 9 18:49:09 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410278437 -7200
# Node ID f638eb1f3b0f7702e95be7895e77583e2050bc44
# Parent  fe2c6666b462363f7994beff70e8d1e35ba479ab
(issue46) Add debug option for trustbridge-admin

diff -r fe2c6666b462 -r f638eb1f3b0f ui/administrator.cpp
--- a/ui/administrator.cpp	Tue Sep 09 17:58:55 2014 +0200
+++ b/ui/administrator.cpp	Tue Sep 09 18:00:37 2014 +0200
@@ -40,6 +40,20 @@
  Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
 #endif
 
+bool g_debug = false;
+QtMessageHandler g_default_msg_handler = NULL;
+
+void noDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+    if (type == QtDebugMsg) {
+        return;
+    }
+
+    if (g_default_msg_handler) {
+        (*g_default_msg_handler)(type, context, msg);
+    }
+}
+
 int main(int argc, char **argv)
 {
     QApplication app (argc, argv);
@@ -58,6 +72,13 @@
         return 0;
     }
 
+    if (arguments.contains("--debug")) {
+        g_debug = true;
+    } else {
+        g_debug = false;
+        g_default_msg_handler = qInstallMessageHandler(noDebugOutput);
+    }
+
     QTranslator translator;
     if (QLocale::system().name() == "C") {
         /* Useful for testing / development as the primary target is german */


More information about the Trustbridge-commits mailing list