Mercurial > trustbridge
annotate ui/administrator.cpp @ 829:294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 24 Jul 2014 11:41:52 +0200 |
parents | 09077eca0b0d |
children | 170b13ea05ee |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #include "administratorwindow.h" |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 #include <QApplication> |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 #include <QtPlugin> |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 #include <QMessageBox> |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 #include <QSettings> |
420
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
14 #include <QTranslator> |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
15 #include <QDebug> |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 #ifndef VERSION |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 #define VERSION "0.0.1" |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 #ifndef APPNAME |
520
09077eca0b0d
Rename administrator to trustbridge-admin
Andre Heinecke <aheinecke@intevation.de>
parents:
431
diff
changeset
|
22 #define APPNAME "trustbridge-admin" |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 #ifndef ORGANIZATION |
409
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
26 #define ORGANIZATION "BSI" |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 |
829
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
29 #define COPYRIGHT "Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik \n" \ |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
30 "Software engineering by Intevation GmbH \n\n" \ |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
31 "This file is Free Software under the GNU GPL (v>=2)\n" \ |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
32 "and comes with ABSOLUTELY NO WARRANTY!\n" |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
33 |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 #ifdef Q_OS_WIN |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 #else |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 int main(int argc, char **argv) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 { |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 QApplication app (argc, argv); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 QStringList arguments = QApplication::arguments(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 QSettings::setDefaultFormat(QSettings::IniFormat); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 |
829
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
51 if (QApplication::arguments().contains("--version")) { |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
52 printf (APPNAME " Version: %s \n", |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
53 QApplication::applicationVersion().toLocal8Bit().constData()); |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
54 printf (COPYRIGHT); |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
55 return 0; |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
56 } |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
57 |
420
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
58 QTranslator translator; |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
59 if (QLocale::system().name() == "C") { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
60 /* Useful for testing / development as the primary target is german */ |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
61 translator.load(":/l10n/administrator_de_DE"); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
62 } else { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
63 translator.load(":/l10n/administrator_" + QLocale::system().name()); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
64 qDebug() << "Loading translations for: " << "administrator_" + |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
65 QLocale::system().name(); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
66 } |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
67 app.installTranslator(&translator); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
68 |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 AdministratorWindow adminWin; |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 adminWin.show(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 return app.exec(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 } |