aboutsummaryrefslogtreecommitdiff
path: root/dev-tools/systray-tester/main.cpp
blob: ff14caba865ff857ad049d9c648e712bd2ba5af3 (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
29
#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.setStyleSheet(background-color: #999999);
   tray.show();
   QApplication::setQuitOnLastWindowClosed(false); 
   return  a.exec();
}
bgstack15