Mercurial > trustbridge
comparison ui/administrator.cpp @ 1059:f638eb1f3b0f
(issue46) Add debug option for trustbridge-admin
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 09 Sep 2014 18:00:37 +0200 |
parents | 0051cb07da28 |
children | 1e429faf7c84 |
comparison
equal
deleted
inserted
replaced
1058:fe2c6666b462 | 1059:f638eb1f3b0f |
---|---|
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 bool g_debug = false; | |
44 QtMessageHandler g_default_msg_handler = NULL; | |
45 | |
46 void noDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) | |
47 { | |
48 if (type == QtDebugMsg) { | |
49 return; | |
50 } | |
51 | |
52 if (g_default_msg_handler) { | |
53 (*g_default_msg_handler)(type, context, msg); | |
54 } | |
55 } | |
56 | |
43 int main(int argc, char **argv) | 57 int main(int argc, char **argv) |
44 { | 58 { |
45 QApplication app (argc, argv); | 59 QApplication app (argc, argv); |
46 | 60 |
47 QStringList arguments = QApplication::arguments(); | 61 QStringList arguments = QApplication::arguments(); |
54 if (QApplication::arguments().contains("--version")) { | 68 if (QApplication::arguments().contains("--version")) { |
55 printf (APPNAME " Version: %s \n", | 69 printf (APPNAME " Version: %s \n", |
56 QApplication::applicationVersion().toLocal8Bit().constData()); | 70 QApplication::applicationVersion().toLocal8Bit().constData()); |
57 printf (COPYRIGHT); | 71 printf (COPYRIGHT); |
58 return 0; | 72 return 0; |
73 } | |
74 | |
75 if (arguments.contains("--debug")) { | |
76 g_debug = true; | |
77 } else { | |
78 g_debug = false; | |
79 g_default_msg_handler = qInstallMessageHandler(noDebugOutput); | |
59 } | 80 } |
60 | 81 |
61 QTranslator translator; | 82 QTranslator translator; |
62 if (QLocale::system().name() == "C") { | 83 if (QLocale::system().name() == "C") { |
63 /* Useful for testing / development as the primary target is german */ | 84 /* Useful for testing / development as the primary target is german */ |