5 void sighandler(int signum
) {
6 static bool quitting
= false;
7 qDebug() << "SAK: caught signal " << signum
;
8 signal(signum
, SIG_IGN
);
16 class MySplashScreen
: public QSplashScreen
19 MySplashScreen(const QPixmap
& px
) : QSplashScreen(px
) {}
21 void timerEvent(QTimerEvent
*) { hide(); deleteLater(); }
25 int main(int argc
, char** argv
)
27 QApplication
app (argc
, argv
);
30 app
.setGraphicsSystem("raster");
33 if (!QSystemTrayIcon::isSystemTrayAvailable()) {
34 QMessageBox::critical(0, QObject::tr("Systray"),
35 QObject::tr("I couldn't detect any system tray "
41 signal(SIGINT
, sighandler
);\v
43 signal(SIGQUIT
, sighandler
);
45 signal(SIGILL
, sighandler
);
46 signal(SIGABRT
, sighandler
);
47 signal(SIGFPE
, sighandler
);
48 signal(SIGSEGV
, sighandler
);
49 signal(SIGTERM
, sighandler
);
52 QFile
lockFile(QDir::homePath() + QDir::separator() + ".sak.run");
53 if (lockFile
.exists()) {
54 if ( QMessageBox::question(0, "Another instance of SAK is running ", "Another instance of SAK seems to be running right now. Proceeding with this new instance may results in data loss / corruptions. Do you want to proceed?", QMessageBox::Yes
| QMessageBox::No
, QMessageBox::No
) == QMessageBox::No
)
57 QFile::remove(lockFile
.fileName());
60 lockFile
.open(QIODevice::ReadWrite
);
63 QPixmap
px(":/images/active.png");
65 QPixmap
px(":/images/splash.png");
67 MySplashScreen
* splash
= new MySplashScreen(px
);
68 splash
->setMask(px
.createMaskFromColor(QColor(0,0,0,0), Qt::MaskInColor
));
70 splash
->startTimer(2000);
76 QFile::remove(lockFile
.fileName());