PollCenter.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _RVC_SPSHELL_POLL_CENTER_H_
  2. #define _RVC_SPSHELL_POLL_CENTER_H_
  3. #include <Widgets/BootSplashScreen.h>
  4. #include <Widgets/BootWidget.h>
  5. #include <Widgets/mainwindow.h>
  6. #include <QApplication>
  7. #include <QObject>
  8. #include <QThread>
  9. #define WITH_MAIN_WINDOW 1
  10. class Poller : public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit Poller(QObject* parent = nullptr) : QObject(parent)
  15. {
  16. }
  17. ~Poller() {}
  18. signals:
  19. void Finished(int exitCode);
  20. public slots:
  21. void OnPoll();
  22. };
  23. class Center : public QApplication
  24. {
  25. Q_OBJECT
  26. public:
  27. Center(int& argc, char** argv);
  28. ~Center();
  29. int Run();
  30. BootWidget* mWidget;
  31. MainWindow* mWindow;
  32. BootSplashScreen* GetSplash() { return mSplashScreen; }
  33. void Init();
  34. signals:
  35. void StartPoll();
  36. void EndPoll(int exitCode);
  37. public slots:
  38. void OnFinishedReceived(int result);
  39. private:
  40. QThread mPollThread;
  41. Poller* mPoller;
  42. BootSplashScreen* mSplashScreen;
  43. enum StopEnum
  44. {
  45. NoInit,
  46. StopFromPoll,
  47. StopFromGUI,
  48. StopFinished
  49. } stopFlag;
  50. };
  51. #endif /*_RVC_SPSHELL_POLL_CENTER_H_*/