- if (videos.isEmpty()) return;
- video = videos.first();
- connect(video, SIGNAL(gotMediumThumbnail(QByteArray)),
- SLOT(setPixmapData(QByteArray)), Qt::UniqueConnection);
- video->loadMediumThumbnail();
+ if (videos.isEmpty()) {
+ qDebug() << "Unavailable video source" << videoSource->getName();
+ emit unavailable(this);
+ return;
+ }
+ Video *video = videos.at(0);
+ lastPixelRatio = devicePixelRatio();
+
+ video->loadThumb(size(), lastPixelRatio)
+ .then([this](auto variant) { setPixmapData(variant.toByteArray()); })
+ .onFailed([](auto msg) { qDebug() << msg; })
+ .finally([videos] {
+ for (auto v : videos)
+ v->deleteLater();
+ });