imagemanager.cpp 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "imagemanager.h"
  2. #include <QDebug>
  3. #include <QFile>
  4. ImageManager::ImageManager(QObject *parent) : QObject(parent),
  5. screens(new QList<QImage>),
  6. vManager(new VideoManger),
  7. imagesCount(0),
  8. imagesFolder("C://Documents/")
  9. {
  10. connect(vManager.get(), SIGNAL(videoSaved()), this, SLOT(onVideoSaved()));
  11. }
  12. void ImageManager::append(QVariant image)
  13. {
  14. // Q_UNUSED(image)
  15. QImage tmpImg = qvariant_cast<QImage>(image);
  16. screens.get()->push_back(tmpImg);
  17. }
  18. void ImageManager::saveAll() const
  19. {
  20. int counter = 0;
  21. for(int i = 0; i < screens.get()->count(); ++i){
  22. screens.get()->at(i).save(imagesFolder + QString("%1.png").arg(counter++));
  23. }
  24. }
  25. void ImageManager::createVideo() const
  26. {
  27. // vManager.get()->makeVideo(screens.get(), imagesFolder);
  28. }
  29. void ImageManager::onVideoSaved()
  30. {
  31. // for(int i = 0; i < screens.get()->count(); ++i){
  32. // QFile file(imagesFolder + QString::number(i) + ".png");
  33. // }
  34. screens.get()->clear();
  35. }