GCI2012: Unix Qt Signals
authormartin_bede
Wed, 02 Jan 2013 23:13:14 +0100
changeset 8355 df0ea4323295
parent 8353 c23bd7ee9a5e
child 8357 d7bef04c99d4
GCI2012: Unix Qt Signals
QTfrontend/main.cpp
--- a/QTfrontend/main.cpp	Wed Jan 02 12:39:50 2013 +0100
+++ b/QTfrontend/main.cpp	Wed Jan 02 23:13:14 2013 +0100
@@ -39,9 +39,11 @@
 
 #ifdef _WIN32
 #include <Shlobj.h>
+#elif defined __APPLE__
+#include "CocoaInitializer.h"
 #endif
-#ifdef __APPLE__
-#include "CocoaInitializer.h"
+#ifndef _WIN32
+#include <signal.h>
 #endif
 
 
@@ -87,6 +89,12 @@
     else
         season = SEASON_NONE;
 }
+#ifndef _WIN32
+void terminateFrontend(int signal)
+{
+    QCoreApplication::exit(0);
+}
+#endif
 
 bool checkForDir(const QString & dir)
 {
@@ -136,6 +144,10 @@
     atexit(releaseCocoaPool);
 #endif
 
+#ifndef _WIN32
+    signal(SIGINT, &terminateFrontend);
+#endif
+
     HWApplication app(argc, argv);
 
     QLabel *splash = NULL;