blob: ea631894d9778b0814aa35b924bfbf677c36f38f (
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
27
28
|
#include <QApplication>
#include <QSystemTrayIcon>
#include "Trayapp.h"
#include <unistd.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();
}
|