Commit e70af19f authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

wallpapers/potd: only pass 1920x1080 or 3840x2160 to bing provider

This avoids unnecessary cached images caused by different file names
from different screen resolutions.


(cherry picked from commit be01d9cc)
parent e58ad3af
Pipeline #196870 passed with stage
in 1 minute and 27 seconds
......@@ -33,7 +33,9 @@ Kirigami.FormLayout {
return [cfg_Category];
} else if (identifier === "bing") {
// Bing supports 1366/1920/UHD resolutions
return [Screen.width, Screen.height, Screen.devicePixelRatio];
const w = Screen.width * Screen.devicePixelRatio > 1920 ? 3840 : 1920;
const h = Screen.height * Screen.devicePixelRatio > 1080 ? 2160 : 1080;
return [w, h];
}
return [];
}
......
......@@ -24,7 +24,9 @@ Rectangle {
return [wallpaper.configuration.Category];
} else if (identifier === "bing") {
// Bing supports 1366/1920/UHD resolutions
return [Screen.width, Screen.height, Screen.devicePixelRatio];
const w = Screen.width * Screen.devicePixelRatio > 1920 ? 3840 : 1920;
const h = Screen.height * Screen.devicePixelRatio > 1080 ? 2160 : 1080;
return [w, h];
}
return [];
}
......
......@@ -15,9 +15,8 @@
BingProvider::BingProvider(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: PotdProvider(parent, data, args)
, m_screenDPI(args.size() >= 3 ? args[2].toDouble() : 1)
, m_screenWidth(args.size() >= 2 ? args[0].toInt() * m_screenDPI : 0)
, m_screenHeight(args.size() >= 2 ? args[1].toInt() * m_screenDPI : 0)
, m_screenWidth(args.size() >= 2 ? args[0].toInt() : 0)
, m_screenHeight(args.size() >= 2 ? args[1].toInt() : 0)
{
const QUrl url(QStringLiteral("https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1"));
......
......@@ -25,7 +25,6 @@ private:
void pageRequestFinished(KJob *job);
void imageRequestFinished(KJob *job);
double m_screenDPI;
int m_screenWidth;
int m_screenHeight;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment