diff ui/administrator.cpp @ 1072:1e429faf7c84

(issue46) Default to debug output on if RELEASE_BUILD is not defined
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 10 Sep 2014 17:53:32 +0200
parents f638eb1f3b0f
children 12ed0b72e9f5
line wrap: on
line diff
--- a/ui/administrator.cpp	Wed Sep 10 17:52:11 2014 +0200
+++ b/ui/administrator.cpp	Wed Sep 10 17:53:32 2014 +0200
@@ -40,12 +40,17 @@
  Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
 #endif
 
+#ifdef DO_RELEASE_BUILD
 bool g_debug = false;
+#else
+bool g_debug = true;
+#endif
+
 QtMessageHandler g_default_msg_handler = NULL;
 
-void noDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+void filterDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
 {
-    if (type == QtDebugMsg) {
+    if (!g_debug && type == QtDebugMsg) {
         return;
     }
 
@@ -74,10 +79,8 @@
 
     if (arguments.contains("--debug")) {
         g_debug = true;
-    } else {
-        g_debug = false;
-        g_default_msg_handler = qInstallMessageHandler(noDebugOutput);
     }
+    g_default_msg_handler = qInstallMessageHandler(filterDebugOutput);
 
     QTranslator translator;
     if (QLocale::system().name() == "C") {

http://wald.intevation.org/projects/trustbridge/