InteractiveWork.h 695 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef INTERACTIVEWORK_H
  2. #define INTERACTIVEWORK_H
  3. #include <QThread>
  4. #include <QMutex>
  5. #include <QMutexLocker>
  6. #include <QThreadPool>
  7. #include "InteractiveTask.h"
  8. #include "template_singleton.h"
  9. class InteractiveWork : public QThread
  10. {
  11. SINGLETON_DEFINE(InteractiveWork)
  12. Q_OBJECT
  13. private:
  14. explicit InteractiveWork(QObject *parent = nullptr);
  15. ~InteractiveWork();
  16. public:
  17. void appendTask(InteractiveTask *task);
  18. protected:
  19. void run();
  20. signals:
  21. void signal_completed(InteractiveTask *task);
  22. void signal_failstart(InteractiveTask *task);
  23. private:
  24. bool m_bThread;
  25. QMutex m_mutex;
  26. QList<InteractiveTask *> m_listTask;
  27. };
  28. #endif // INTERACTIVEWORK_H