Mercurial > trustbridge
annotate ui/administrator.cpp @ 777:ca149bad8195
(issue51) Set up autostart on installation.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 11 Jul 2014 18:31:09 +0200 |
parents | 09077eca0b0d |
children | 294d76174102 |
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 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 #ifdef Q_OS_WIN |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 #else |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 #endif |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 int main(int argc, char **argv) |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 { |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 QApplication app (argc, argv); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 QStringList arguments = QApplication::arguments(); |
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 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 QSettings::setDefaultFormat(QSettings::IniFormat); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 |
420
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
46 QTranslator translator; |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
47 if (QLocale::system().name() == "C") { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
48 /* 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
|
49 translator.load(":/l10n/administrator_de_DE"); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
50 } else { |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
51 translator.load(":/l10n/administrator_" + QLocale::system().name()); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
52 qDebug() << "Loading translations for: " << "administrator_" + |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
53 QLocale::system().name(); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
54 } |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
55 app.installTranslator(&translator); |
16b6d5686835
Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents:
409
diff
changeset
|
56 |
333
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 AdministratorWindow adminWin; |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 adminWin.show(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 return app.exec(); |
de94c4ec22b1
Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 } |