changeset 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 fc4e1fe4e4d4
children fa3f4e2370d3
files cinst/main.c cinst/mozilla.c ui/administrator.cpp ui/main.cpp
diffstat 4 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cinst/main.c	Wed Sep 10 17:52:11 2014 +0200
+++ b/cinst/main.c	Wed Sep 10 17:53:32 2014 +0200
@@ -201,7 +201,11 @@
   return 0;
 }
 
+#ifdef DO_RELEASE_BUILD
 bool g_debug = false;
+#else
+bool g_debug = true;
+#endif
 
 int
 main (int argc, char **argv)
--- a/cinst/mozilla.c	Wed Sep 10 17:52:11 2014 +0200
+++ b/cinst/mozilla.c	Wed Sep 10 17:53:32 2014 +0200
@@ -835,7 +835,11 @@
     }
 }
 
+#ifdef DO_RELEASE_BUILD
 bool g_debug = false;
+#else
+bool g_debug = true;
+#endif
 
 int
 main (int argc, char **argv)
--- 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") {
--- 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/