- lastPixelRatio = window()->devicePixelRatio();
- bool needLargeThumb = lastPixelRatio > 1.0 || window()->width() > 1000;
- QString url = needLargeThumb ? video->getLargeThumbnailUrl() : video->getMediumThumbnailUrl();
- if (url.isEmpty()) url = video->getThumbnailUrl();
- video->deleteLater();
- QObject *reply = HttpUtils::yt().get(url);
- connect(reply, SIGNAL(data(QByteArray)), SLOT(setPixmapData(QByteArray)));
+ 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();
+ });