annotate ui/administrator.cpp @ 959:385ffd7e40a0

Add geotrust root ca as a temporary workaround to authenticate the test server.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 28 Aug 2014 10:31:57 +0200
parents 0051cb07da28
children f638eb1f3b0f
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 333
diff changeset
7 */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include "administratorwindow.h"
876
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
9 #include "util.h"
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QApplication>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QtPlugin>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QMessageBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QSettings>
420
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
15 #include <QTranslator>
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
16 #include <QDebug>
832
170b13ea05ee (Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 829
diff changeset
17 #include <QTextCodec>
876
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
18 #include <QFontDatabase>
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 #ifndef VERSION
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 #define VERSION "0.0.1"
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 #endif
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 #ifndef APPNAME
520
09077eca0b0d Rename administrator to trustbridge-admin
Andre Heinecke <aheinecke@intevation.de>
parents: 431
diff changeset
25 #define APPNAME "trustbridge-admin"
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 #endif
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 #ifndef ORGANIZATION
409
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
29 #define ORGANIZATION "BSI"
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 #endif
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
829
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
32 #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
33 "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
34 "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
35 "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
36
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 #ifdef Q_OS_WIN
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 #else
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 #endif
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 int main(int argc, char **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 QApplication app (argc, argv);
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 QStringList arguments = QApplication::arguments();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 QApplication::setApplicationName(QString::fromLatin1(APPNAME));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 QApplication::setApplicationVersion(QString::fromLatin1(VERSION));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 QSettings::setDefaultFormat(QSettings::IniFormat);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53
829
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
54 if (QApplication::arguments().contains("--version")) {
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
55 printf (APPNAME " Version: %s \n",
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
56 QApplication::applicationVersion().toLocal8Bit().constData());
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
57 printf (COPYRIGHT);
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
58 return 0;
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
59 }
294d76174102 (issue5) Add --version to trustbridge and trustbridge-admin
Andre Heinecke <andre.heinecke@intevation.de>
parents: 520
diff changeset
60
420
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
61 QTranslator translator;
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
62 if (QLocale::system().name() == "C") {
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
63 /* 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
64 translator.load(":/l10n/administrator_de_DE");
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
65 } else {
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
66 translator.load(":/l10n/administrator_" + QLocale::system().name());
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
67 qDebug() << "Loading translations for: " << "administrator_" +
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
68 QLocale::system().name();
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
69 }
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
70 app.installTranslator(&translator);
16b6d5686835 Switch to resource based loading of translations
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
71
832
170b13ea05ee (Issue10) Force encoding to be latin-1 during installer creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 829
diff changeset
72 /* 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
73 * 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
74 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
75
876
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
76 /* Install static fonts */
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
77
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
78 /* The putenv here works around a bug in qt. Qt thinks it is a fatal
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
79 * error if the font directory does not exist. */
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
80 qputenv("QT_QPA_FONTDIR", get_install_dir());
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
81 int fontId = QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf");
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
82 if (fontId != -1)
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
83 {
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
84 QFont font("DejaVuSans");
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
85 font.setPointSize(9);
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
86 app.setFont(font);
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
87 }
0051cb07da28 Reduce libraries, document i386 build and statically link fonts.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 832
diff changeset
88
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 AdministratorWindow adminWin;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 adminWin.show();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 return app.exec();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 }

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