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 "
40 signal(SIGINT
, sighandler
);
42 signal(SIGQUIT
, sighandler
);
44 signal(SIGILL
, sighandler
);
45 signal(SIGABRT
, sighandler
);
46 signal(SIGFPE
, sighandler
);
47 signal(SIGSEGV
, sighandler
);
48 signal(SIGTERM
, sighandler
);
50 QFile
lockFile(QDir::homePath() + QDir::separator() + ".sak.run");
51 if (lockFile
.exists()) {
52 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
)
55 QFile::remove(lockFile
.fileName());
58 lockFile
.open(QIODevice::ReadWrite
);
61 QPixmap
px(":/images/active.png");
63 QPixmap
px(":/images/splash.png");
65 MySplashScreen
* splash
= new MySplashScreen(px
);
66 splash
->setMask(px
.createMaskFromColor(QColor(0,0,0,0), Qt::MaskInColor
));
68 splash
->startTimer(2000);
74 QFile::remove(lockFile
.fileName());