2013-03-31 17:31:51 +08:00
|
|
|
/*
|
2013-03-31 17:45:44 +08:00
|
|
|
* This file is part of the PulseView project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Adam Reichold
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-10-20 15:53:43 +08:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2013-03-31 17:45:44 +08:00
|
|
|
*/
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2015-01-18 06:00:52 +08:00
|
|
|
#ifndef SIGNALHANDLER_HPP
|
|
|
|
#define SIGNALHANDLER_HPP
|
2013-03-31 17:31:51 +08:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class QSocketNotifier;
|
|
|
|
|
|
|
|
class SignalHandler : public QObject
|
|
|
|
{
|
2013-03-31 17:45:44 +08:00
|
|
|
Q_OBJECT
|
2013-03-31 17:31:51 +08:00
|
|
|
|
|
|
|
public:
|
2013-03-31 17:45:44 +08:00
|
|
|
static bool prepare_signals();
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2013-03-31 17:45:44 +08:00
|
|
|
public:
|
2015-04-12 22:54:29 +08:00
|
|
|
explicit SignalHandler(QObject* parent = nullptr);
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2014-07-20 02:15:55 +08:00
|
|
|
Q_SIGNALS:
|
2013-03-31 17:45:44 +08:00
|
|
|
void int_received();
|
|
|
|
void term_received();
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2014-07-20 02:15:55 +08:00
|
|
|
private Q_SLOTS:
|
2013-03-31 17:45:44 +08:00
|
|
|
void on_socket_notifier_activated();
|
2013-03-31 17:31:51 +08:00
|
|
|
|
|
|
|
private:
|
2013-03-31 17:45:44 +08:00
|
|
|
static void handle_signals(int sig_number);
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2013-03-31 17:45:44 +08:00
|
|
|
private:
|
2014-11-22 16:46:22 +08:00
|
|
|
QSocketNotifier* socket_notifier_;
|
2013-03-31 17:31:51 +08:00
|
|
|
|
2013-03-31 17:45:44 +08:00
|
|
|
private:
|
2014-11-22 16:46:22 +08:00
|
|
|
static int sockets_[2];
|
2013-03-31 17:31:51 +08:00
|
|
|
};
|
|
|
|
|
2015-01-18 06:00:52 +08:00
|
|
|
#endif // SIGNALHANDLER_HPP
|