KVIrc 5.2.4
Developer APIs
KviSignalHandler.h
Go to the documentation of this file.
1#ifndef _KVI_SIGNALHANDLER_H_
2#define _KVI_SIGNALHANDLER_H_
3//=============================================================================
4//
5// File : KviSignalHandler.h
6// Creation date : Sat 2016-07-09 07:32:25 UTC by Vladimir Panteleev
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 1999-2010 Szymon Stefanek (pragma at kvirc dot net)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
27#include "kvi_settings.h"
28
29#if !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW)
30
31#include <QObject>
32
33class QSocketNotifier;
34
35// Adapted from http://doc.qt.io/qt-5/unix-signals.html
36
37class KviSignalHandler : public QObject
38{
39 Q_OBJECT
40
41public:
42 KviSignalHandler(QObject *parent = nullptr);
43
44 static void unixSignalHandler(int unused);
45
46public slots:
47 // Qt signal handler
48 void handleSignal();
49
50private:
51 static int fd[2];
52
53 QSocketNotifier *sn;
54};
55
57
58#else // !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW)
59static bool kvi_signalHandlerSetup() { return true; }
60#endif // !defined(COMPILE_ON_WINDOWS) && !defined(COMPILE_ON_MINGW)
61
62#endif
bool KVILIB_API kvi_signalHandlerSetup()
Definition KviSignalHandler.cpp:65
Definition KviSignalHandler.h:38
QSocketNotifier * sn
Definition KviSignalHandler.h:53
static void unixSignalHandler(int unused)
Definition KviSignalHandler.cpp:84
static int fd[2]
Definition KviSignalHandler.h:51
void handleSignal()
Definition KviSignalHandler.cpp:95
This file contains compile time settings.
#define KVILIB_API
Definition kvi_settings.h:124