blob: 309ab4cb903e27b726fefa103d03d78215e6e244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <QApplication>
#include <QSystemTrayIcon>
#include "Trayapp.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
bool ready = false;
for(int i=0; i<60 && !ready; i++){
ready = QSystemTrayIcon::isSystemTrayAvailable();
if(!ready){
//Pause for 5 seconds
sleep(5); //don't worry about stopping event handling - nothing running yet
}
}
if(!ready){
qDebug() << "Could not find any available system tray after 5 minutes: exiting....";
return 1;
}
TrayApp tray;
tray.show();
QApplication::setQuitOnLastWindowClosed(false);
return a.exec();
}
|