aboutsummaryrefslogtreecommitdiff
path: root/desktop-utilities/lumina-terminal/main.cpp
blob: 9197561f28215bc1fa3bfa092b0068f5041429cf (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2015, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include <QSystemTrayIcon>
#include <QDebug>
#include <QSerialPortInfo>

#include <LuminaSingleApplication.h>
#include <LuminaThemes.h>

#include <unistd.h>

#include "TrayIcon.h"
int  main(int argc, char *argv[]) {
   /*if(QSerialPortInfo::availablePorts().isEmpty()){
     qDebug() << "No Serial Ports available!!!";
     return 1;
   }*/
   LTHEME::LoadCustomEnvSettings();
   LSingleApplication a(argc, argv, "lumina-terminal");
    if( !a.isPrimaryProcess() ){ return 0; } //poked the current process instead
	
   //First make sure a system tray is available
  /*qDebug() << "Checking for system tray";
   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;
   }*/
   
   //Now go ahead and setup the app
   LuminaThemeEngine theme(&a);
     QApplication::setQuitOnLastWindowClosed(false);   
     
   //Now start the tray icon
   TrayIcon tray;
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &tray, SLOT(slotSingleInstance(QStringList)) );
    QObject::connect(&theme, SIGNAL(updateIcons()), &tray, SLOT(updateIcons()) );
    tray.parseInputs(a.inputlist);
   tray.show();
   return  a.exec();
}
bgstack15