# HG changeset patch # User Andre Heinecke # Date 1410364412 -7200 # Node ID 1e429faf7c8436eb4ed1523252944e57b0f6892f # Parent fc4e1fe4e4d4c939f06b6851b231b14068ec54eb (issue46) Default to debug output on if RELEASE_BUILD is not defined diff -r fc4e1fe4e4d4 -r 1e429faf7c84 cinst/main.c --- 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) diff -r fc4e1fe4e4d4 -r 1e429faf7c84 cinst/mozilla.c --- 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) diff -r fc4e1fe4e4d4 -r 1e429faf7c84 ui/administrator.cpp --- 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") { diff -r fc4e1fe4e4d4 -r 1e429faf7c84 ui/main.cpp --- 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(", ");