SignalManager.h 551 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef SIGNALMANAGER_H
  2. #define SIGNALMANAGER_H
  3. #include <QObject>
  4. #include <QSocketNotifier>
  5. #include <QGuiApplication>
  6. class SignalManager : public QObject
  7. {
  8. Q_OBJECT
  9. public:
  10. SignalManager(QGuiApplication* app);
  11. ~SignalManager() {}
  12. // Unix signal handlers.
  13. static void signalHandler(int signal_num);
  14. int setupHandlers();
  15. void closeApplication();
  16. public slots:
  17. // Qt signal handlers.
  18. void handleSignal();
  19. private:
  20. static int sigtermFd[2];
  21. QSocketNotifier* snTerm;
  22. QGuiApplication* m_app;
  23. };
  24. #endif // SIGNALMANAGER_H