Mercurial > trustbridge
annotate ui/administrator.cpp @ 842:bd33c6585cd0
UI improvements (issue18, 60)
author | Emanuel Schuetze <emanuel@intevation.de> |
---|---|
date | Wed, 30 Jul 2014 09:58:20 +0200 |
parents | 170b13ea05ee |
children | 0051cb07da28 |
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> |
832
170b13ea05ee
(Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
829
diff
changeset
|
16 #include <QTextCodec> |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 #ifndef VERSION |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 #define VERSION "0.0.1" |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 #ifndef APPNAME |
520
09077eca0b0d
Rename administrator to trustbridge-admin
Andre Heinecke <aheinecke@intevation.de>
parents:
431
diff
changeset
|
23 #define APPNAME "trustbridge-admin" |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 #ifndef ORGANIZATION |
409
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
27 #define ORGANIZATION "BSI" |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
829
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
30 #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
|
31 "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
|
32 "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
|
33 "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
|
34 |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 #ifdef Q_OS_WIN |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 #else |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 int main(int argc, char **argv) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 { |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 QApplication app (argc, argv); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 QStringList arguments = QApplication::arguments(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 QSettings::setDefaultFormat(QSettings::IniFormat); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 |
829
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
52 if (QApplication::arguments().contains("--version")) { |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
53 printf (APPNAME " Version: %s \n", |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
54 QApplication::applicationVersion().toLocal8Bit().constData()); |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
55 printf (COPYRIGHT); |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
56 return 0; |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
57 } |
294d76174102
(issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
520
diff
changeset
|
58 |
420
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
59 QTranslator translator; |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
60 if (QLocale::system().name() == "C") { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
61 /* 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
|
62 translator.load(":/l10n/administrator_de_DE"); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
63 } else { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
64 translator.load(":/l10n/administrator_" + QLocale::system().name()); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
65 qDebug() << "Loading translations for: " << "administrator_" + |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
66 QLocale::system().name(); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
67 } |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
68 app.installTranslator(&translator); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
69 |
832
170b13ea05ee
(Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
829
diff
changeset
|
70 /* Out of process calls need to be encoded in latin-1 so that they |
170b13ea05ee
(Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
829
diff
changeset
|
71 * look decent on western europe's windows */ |
170b13ea05ee
(Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
829
diff
changeset
|
72 QTextCodec::setCodecForLocale(QTextCodec::codecForName ("ISO-8859-1")); |
170b13ea05ee
(Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
829
diff
changeset
|
73 |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 AdministratorWindow adminWin; |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 adminWin.show(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 return app.exec(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 } |