]> sigrok.org Git - pulseview.git/blame - signalhandler.h
Integrated signal handler from qpdfview
[pulseview.git] / signalhandler.h
CommitLineData
7a255aa9
JH
1/*
2
3Copyright 2013 Adam Reichold
4
5This file is part of qpdfview.
6
7qpdfview is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12qpdfview is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along 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
27class QSocketNotifier;
28
29class SignalHandler : public QObject
30{
31 Q_OBJECT
32
33public:
34 static bool prepareSignals();
35
36 explicit SignalHandler(QObject* parent = 0);
37
38signals:
39 void sigIntReceived();
40 void sigTermReceived();
41
42private slots:
43 void on_socketNotifier_activated();
44
45private:
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