diff ui/main.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 fe2c6666b462
children 8d811b030959
line wrap: on
line diff
--- a/ui/main.cpp	Wed Sep 10 17:52:11 2014 +0200
+++ b/ui/main.cpp	Wed Sep 10 17:53:32 2014 +0200
@@ -52,12 +52,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;
     }
 
@@ -96,10 +101,8 @@
 
     if (arguments.contains("--debug")) {
         g_debug = true;
-    } else {
-        g_debug = false;
-        g_default_msg_handler = qInstallMessageHandler(noDebugOutput);
     }
+    g_default_msg_handler = qInstallMessageHandler(filterDebugOutput);
 
     qDebug() << "Application style is: " << app.style()->metaObject()->className();
     qDebug() << "Available styles: " << QStyleFactory::keys().join(", ");

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