drawthread.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef DRAWTHREAD_H
  2. #define DRAWTHREAD_H
  3. #include <QThread>
  4. #include <QVariantList>
  5. #include "pictureitem.h"
  6. class QImage;
  7. class QPainter;
  8. class DrawThread : public QThread
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit DrawThread(QString picturesHome, QMap<PictureItem::ImageSizes,QStringList> resolutions);
  13. ~DrawThread();
  14. void createImage(PictureItem::ImageTypes imageType, PictureItem::ImageSizes imageSize,
  15. QVariantList imageList, QString fileName,
  16. QColor background, QColor backgroundOld,int margin, int aspectRatio);
  17. bool success() const{return m_success;}
  18. void stopWorking();
  19. bool stopRequested();
  20. QString filename();
  21. protected:
  22. void run();
  23. private:
  24. QImage* scaledImage(int index);
  25. public slots:
  26. private:
  27. PictureItem::ImageTypes m_imageType;
  28. PictureItem::ImageSizes m_imageSize;
  29. QVariantList m_imageList;
  30. QString m_fileName;
  31. QColor m_background;
  32. QColor m_backgroundOld;
  33. int m_margin;
  34. QString m_emptyName;
  35. QString m_picturesHome;
  36. QMap<PictureItem::ImageSizes,QStringList > m_resolutions;
  37. bool m_success;
  38. QImage* m_final;
  39. QPainter* m_combiner;
  40. bool m_requestStop;
  41. int m_aspect;
  42. };
  43. #endif // DRAWTHREAD_H