summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rwxr-xr-x[-rw-r--r--]main.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 6724c0d..72b490f 100644..100755
--- a/main.cpp
+++ b/main.cpp
@@ -3,7 +3,7 @@
3 * 3 *
4 * Simple web viewer used by Matrix application launcher 4 * Simple web viewer used by Matrix application launcher
5 * 5 *
6 * Copyright (C) 2011,2012 Texas Instruments Incorporated - http://www.ti.com/ 6 * Copyright (C) 2011-2015 Texas Instruments Incorporated - http://www.ti.com/
7 * 7 *
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
@@ -37,9 +37,24 @@
37*/ 37*/
38 38
39#include <QtWidgets> 39#include <QtWidgets>
40#include <QWebView>
41#include <QGraphicsWebView>
42#include <iostream> 40#include <iostream>
41#include <QApplication>
42#include "MatrixWebView.h"
43#include "signal.h"
44
45static int setup_unix_signal_handlers()
46{
47 struct sigaction term;
48
49 term.sa_handler = MatrixWebView::termSignalHandler;
50 sigemptyset(&term.sa_mask);
51 term.sa_flags = SA_RESTART;
52
53 if (sigaction(SIGTERM, &term, 0) > 0)
54 return 1;
55
56 return 0;
57}
43 58
44using std::endl; 59using std::endl;
45 60
@@ -56,7 +71,7 @@ int main(int argc, char **argv)
56 71
57 bool windowed = QApplication::arguments().contains("--windowed"); 72 bool windowed = QApplication::arguments().contains("--windowed");
58 73
59 QWebView view; 74 MatrixWebView view;
60 view.load(QUrl(args[1])); 75 view.load(QUrl(args[1]));
61 view.setContextMenuPolicy(Qt::NoContextMenu); 76 view.setContextMenuPolicy(Qt::NoContextMenu);
62 77
@@ -68,5 +83,7 @@ int main(int argc, char **argv)
68 else 83 else
69 view.show(); 84 view.show();
70 85
86 int ret = setup_unix_signal_handlers();
87
71 return app.exec(); 88 return app.exec();
72} 89}