annotate ui/main.cpp @ 407:af53c40e74b1

Rename m13ui to TrustBridge
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 16 Apr 2014 13:38:11 +0000
parents 17e1c8f37d72
children 09bb19e5e369
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 365
diff changeset
7 */
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #include "mainwindow.h"
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 #include <QApplication>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11 #include <QSystemTrayIcon>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
12 #include <QtPlugin>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 #include <QMessageBox>
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
14 #include <QSettings>
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
16 #ifndef VERSION
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
17 #define VERSION "0.0.1"
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
18 #endif
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
19
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
20 #ifndef APPNAME
407
af53c40e74b1 Rename m13ui to TrustBridge
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
21 #define APPNAME "TrustBridge"
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
22 #endif
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
23
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
24 #ifndef ORGANIZATION
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
25 #define ORGANIZATION "m13org"
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
26 #endif
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 #ifdef Q_OS_WIN
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30 #else
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
32 #endif
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 int main(int argc, char **argv)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36 QApplication app (argc, argv);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
37
154
3349c9596043 Added commandline arguemnt '--tray' to hide or show the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 73
diff changeset
38 QStringList arguments = QApplication::arguments();
3349c9596043 Added commandline arguemnt '--tray' to hide or show the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 73
diff changeset
39 bool trayMode = arguments.contains("--tray");
3349c9596043 Added commandline arguemnt '--tray' to hide or show the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 73
diff changeset
40
73
5c616934cbe4 Also check that the system tray supports messages
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
41 if (!QSystemTrayIcon::isSystemTrayAvailable() ||
5c616934cbe4 Also check that the system tray supports messages
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
42 !QSystemTrayIcon::supportsMessages()) {
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
43 QMessageBox::critical(0, QString::fromLatin1(APPNAME),
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44 QObject::tr("Couldn't detect any system tray "
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
45 "on this system. This software can only "
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
46 "be used in a desktop environment."));
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
47 return 1;
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
48 }
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
49
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
50 QApplication::setQuitOnLastWindowClosed(false);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
51 QApplication::setOrganizationName(QString::fromLatin1(ORGANIZATION));
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
52 QApplication::setApplicationName(QString::fromLatin1(APPNAME));
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
53 QApplication::setApplicationVersion(QString::fromLatin1(VERSION));
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
54 QSettings::setDefaultFormat(QSettings::IniFormat);
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
55
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 154
diff changeset
56 MainWindow mainWin(trayMode);
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
57
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
58 return app.exec();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
59 }

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