diff --git a/dataengines/potd/unsplashprovider.cpp b/dataengines/potd/unsplashprovider.cpp --- a/dataengines/potd/unsplashprovider.cpp +++ b/dataengines/potd/unsplashprovider.cpp @@ -50,13 +50,23 @@ } const QString html = QString::fromUtf8(job->data()); - - QRegularExpression re(QStringLiteral("src=\"(https://images\\.unsplash\\.com/photo-\\w+-\\w+)")); - - QRegularExpressionMatch match = re.match(html); - - if (match.hasMatch()) { - QUrl picUrl(match.captured(1)); // url to full size photo (compressed) + + // "?ixlib" will filter out the banner image which rarely change... + QRegularExpression re(QStringLiteral("src=\"(https://images\\.unsplash\\.com/photo-\\w+-\\w+)\\?ixlib")); + + QRegularExpressionMatchIterator i = re.globalMatch(html); + + QStringList urls; + + while (i.hasNext()) { + QRegularExpressionMatch match = i.next(); + QString url = match.captured(1); + urls << url; + } + + if (urls.size() > 0) { + // Pick a ramdom photo because the wallpaper page doesn't update every day + QUrl picUrl(urls.at(rand() % urls.size())); // url to full size photo (compressed) KIO::StoredTransferJob* imageJob = KIO::storedGet(picUrl, KIO::NoReload, KIO::HideProgressInfo); connect(imageJob, &KIO::StoredTransferJob::finished, this, &UnsplashProvider::imageRequestFinished); return; diff --git a/wallpapers/potd/contents/ui/main.qml b/wallpapers/potd/contents/ui/main.qml --- a/wallpapers/potd/contents/ui/main.qml +++ b/wallpapers/potd/contents/ui/main.qml @@ -45,5 +45,6 @@ anchors.fill: parent image: engine.data[provider]["Image"] fillMode: wallpaper.configuration.FillMode + smooth: true } }