BackgroundTask.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef BACKGROUNDTASK_H
  2. #define BACKGROUNDTASK_H
  3. #include <QObject>
  4. #include <QRunnable>
  5. #include <string>
  6. #include <functional>
  7. #include "ImageExport.h"
  8. #include "MandelVideoGenerator.h"
  9. class BackgroundTask : public QObject, public QRunnable
  10. {
  11. Q_OBJECT
  12. protected:
  13. std::string shortDescription;
  14. public:
  15. BackgroundTask(const std::string& shortDescription);
  16. void run(void) = 0;
  17. inline const std::string& getShortDescription(void) const { return shortDescription; }
  18. signals:
  19. void progress(float percentage);
  20. void finished(bool success);
  21. };
  22. class ImageExportTask : public BackgroundTask
  23. {
  24. Q_OBJECT
  25. private:
  26. const alm::ImageExportInfo iei;
  27. public:
  28. ImageExportTask(const alm::ImageExportInfo& iei);
  29. void run(void) override;
  30. };
  31. class VideoExportTask : public BackgroundTask
  32. {
  33. Q_OBJECT
  34. private:
  35. MandelVideoGenerator mvg;
  36. mnd::MandelGenerator& generator;
  37. public:
  38. VideoExportTask(MandelVideoGenerator mvg, mnd::MandelGenerator& generator);
  39. void run(void) override;
  40. };
  41. #endif // BACKGROUNDTASK_H