]> sigrok.org Git - pulseview.git/blob - signalhandler.h
48017629b35cad4f037bc459a7c23493e82ffa7e
[pulseview.git] / signalhandler.h
1 /*
2
3 Copyright 2013 Adam Reichold
4
5 This file is part of qpdfview.
6
7 qpdfview is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 qpdfview is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
19
20 */
21
22 #ifndef SIGNALHANDLER_H
23 #define SIGNALHANDLER_H
24
25 #include <QObject>
26
27 class QSocketNotifier;
28
29 class SignalHandler : public QObject
30 {
31     Q_OBJECT
32
33 public:
34     static bool prepareSignals();
35
36     explicit SignalHandler(QObject* parent = 0);
37
38 signals:
39     void sigIntReceived();
40     void sigTermReceived();
41
42 private slots:
43     void on_socketNotifier_activated();
44
45 private:
46     static int s_sockets[2];
47
48     static void handleSignals(int sigNumber);
49
50     QSocketNotifier* m_socketNotifier;
51
52 };
53
54 #endif // SIGNALHANDLER_H