7 YTThumb::YTThumb(int width, int height, const QString &url)
8 : width(width), height(height), url(url) {}
10 VariantPromise &YTThumb::load(QObject *parent) {
13 qDebug() << "Already loading" << promise;
16 promise = new VariantPromise(parent);
17 promise->connect(HttpUtils::yt().get(url), &HttpReply::finished, promise, [this](auto &reply) {
18 // clear promise member before emitting signals
19 auto promise2 = promise;
21 if (reply.isSuccessful()) {
22 promise2->resolve(reply.body());
24 promise2->reject(reply.reasonPhrase());