comparison ui/main.cpp @ 154:3349c9596043

Added commandline arguemnt '--tray' to hide or show the mainwindow.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 25 Mar 2014 08:59:58 +0100
parents 5c616934cbe4
children 75f7288ad67b
comparison
equal deleted inserted replaced
153:252ffe6e27fd 154:3349c9596043
26 26
27 int main(int argc, char **argv) 27 int main(int argc, char **argv)
28 { 28 {
29 QApplication app (argc, argv); 29 QApplication app (argc, argv);
30 30
31 QStringList arguments = QApplication::arguments();
32 bool trayMode = arguments.contains("--tray");
33
31 if (!QSystemTrayIcon::isSystemTrayAvailable() || 34 if (!QSystemTrayIcon::isSystemTrayAvailable() ||
32 !QSystemTrayIcon::supportsMessages()) { 35 !QSystemTrayIcon::supportsMessages()) {
33 QMessageBox::critical(0, QString::fromLatin1(APPNAME), 36 QMessageBox::critical(0, QString::fromLatin1(APPNAME),
34 QObject::tr("Couldn't detect any system tray " 37 QObject::tr("Couldn't detect any system tray "
35 "on this system. This software can only " 38 "on this system. This software can only "
42 QApplication::setApplicationName(QString::fromLatin1(APPNAME)); 45 QApplication::setApplicationName(QString::fromLatin1(APPNAME));
43 QApplication::setApplicationVersion(QString::fromLatin1(VERSION)); 46 QApplication::setApplicationVersion(QString::fromLatin1(VERSION));
44 QSettings::setDefaultFormat(QSettings::IniFormat); 47 QSettings::setDefaultFormat(QSettings::IniFormat);
45 48
46 MainWindow mainWin; 49 MainWindow mainWin;
50 if (!trayMode) {
51 mainWin.show();
52 }
47 53
48 return app.exec(); 54 return app.exec();
49 } 55 }

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