From 9d544917dcaa047c5bf7353d89c110792bae3d84 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Wed, 2 Jan 2013 17:19:57 -0600 Subject: [PATCH] main: quit on SIGINT Signed-off-by: Alexandru Gagniuc --- main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index a7ab89fb..54a69fd7 100644 --- a/main.cpp +++ b/main.cpp @@ -34,6 +34,8 @@ extern "C" { #include "config.h" +// Global pointer to our QApplication +QApplication *g_app = NULL; void usage() { fprintf(stderr, @@ -52,10 +54,11 @@ void usage() void sigint(int param) { (void) param; - + qDebug("pv: Recieved SIGINT"); - - /* TODO: Handle SIGINT */ + + if (g_app) + g_app->quit(); } int main(int argc, char *argv[]) @@ -67,6 +70,8 @@ int main(int argc, char *argv[]) signal (SIGINT, sigint); QApplication a(argc, argv); + // Now we have an application to populate our global pointer + g_app = &a; // Set some application metadata QApplication::setApplicationVersion(PV_VERSION_STRING); -- 2.30.2