comparison ui/main.cpp @ 840:c9a31544aaab

(issue50) Write startup file with display variable
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 29 Jul 2014 13:15:32 +0200
parents 294d76174102
children 4efd6378c001
comparison
equal deleted inserted replaced
839:b108510bac5a 840:c9a31544aaab
12 #ifdef WIN32 12 #ifdef WIN32
13 #include "taskscheduler.h" 13 #include "taskscheduler.h"
14 #endif 14 #endif
15 15
16 #include <QApplication> 16 #include <QApplication>
17 #include <QFile>
17 #include <QSystemTrayIcon> 18 #include <QSystemTrayIcon>
18 #include <QtPlugin> 19 #include <QtPlugin>
19 #include <QMessageBox> 20 #include <QMessageBox>
20 #include <QSettings> 21 #include <QSettings>
21 #include <QDebug> 22 #include <QDebug>
27 #define VERSION "0.0.1" 28 #define VERSION "0.0.1"
28 #endif 29 #endif
29 30
30 #ifndef APPNAME 31 #ifndef APPNAME
31 #define APPNAME "TrustBridge" 32 #define APPNAME "TrustBridge"
33 #endif
34
35 #ifndef STARTUP_FILE_NAME
36 #define STARTUP_FILE_NAME "trustbridge-tray-starter.cfg"
32 #endif 37 #endif
33 38
34 #ifndef ORGANIZATION 39 #ifndef ORGANIZATION
35 #define ORGANIZATION "BSI" 40 #define ORGANIZATION "BSI"
36 #endif 41 #endif
116 { 121 {
117 TaskScheduler taskSched; 122 TaskScheduler taskSched;
118 qDebug() << " task sched done: " << taskSched.createDailyTask(QCoreApplication::applicationFilePath(), 123 qDebug() << " task sched done: " << taskSched.createDailyTask(QCoreApplication::applicationFilePath(),
119 QString::fromLatin1("--tray"), QTime::currentTime()); 124 QString::fromLatin1("--tray"), QTime::currentTime());
120 } 125 }
126 #else
127 /* Save the display on start so that it might later be used by the cron startup script. */
128 QFile startup_file (settings.fileName().replace(APPNAME ".ini", STARTUP_FILE_NAME));
129 startup_file.open(QIODevice::WriteOnly);
130 startup_file.write(QString::fromLatin1("DISPLAY=%1\n").arg(qgetenv("DISPLAY").constData()).toUtf8());
131 startup_file.close();
121 #endif 132 #endif
122
123 MainWindow mainWin(trayMode); 133 MainWindow mainWin(trayMode);
124 134
125 return app.exec(); 135 return app.exec();
126 } 136 }

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