comparison 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
comparison
equal deleted inserted replaced
1071:fc4e1fe4e4d4 1072:1e429faf7c84
38 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) 38 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
39 #else 39 #else
40 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) 40 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
41 #endif 41 #endif
42 42
43 #ifdef DO_RELEASE_BUILD
43 bool g_debug = false; 44 bool g_debug = false;
45 #else
46 bool g_debug = true;
47 #endif
48
44 QtMessageHandler g_default_msg_handler = NULL; 49 QtMessageHandler g_default_msg_handler = NULL;
45 50
46 void noDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) 51 void filterDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
47 { 52 {
48 if (type == QtDebugMsg) { 53 if (!g_debug && type == QtDebugMsg) {
49 return; 54 return;
50 } 55 }
51 56
52 if (g_default_msg_handler) { 57 if (g_default_msg_handler) {
53 (*g_default_msg_handler)(type, context, msg); 58 (*g_default_msg_handler)(type, context, msg);
72 return 0; 77 return 0;
73 } 78 }
74 79
75 if (arguments.contains("--debug")) { 80 if (arguments.contains("--debug")) {
76 g_debug = true; 81 g_debug = true;
77 } else {
78 g_debug = false;
79 g_default_msg_handler = qInstallMessageHandler(noDebugOutput);
80 } 82 }
83 g_default_msg_handler = qInstallMessageHandler(filterDebugOutput);
81 84
82 QTranslator translator; 85 QTranslator translator;
83 if (QLocale::system().name() == "C") { 86 if (QLocale::system().name() == "C") {
84 /* Useful for testing / development as the primary target is german */ 87 /* Useful for testing / development as the primary target is german */
85 translator.load(":/l10n/administrator_de_DE"); 88 translator.load(":/l10n/administrator_de_DE");

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