45static std::vector<WallpaperData> wallpaperData;
46static bool haveBackup;
48static std::string wallpaperPath;
49static std::string wallpaperFile;
51static void initWallpaperPaths()
56 if (wallpaperPath.empty())
60 if (wallpaperPath.empty())
61 wallpaperPath =
"graphics/images/";
67 if (wallpaperFile.empty())
71 if (wallpaperFile.empty())
72 wallpaperFile =
"login_wallpaper.png";
84 return (aa > ab || (aa == ab && a.
width > b.
width));
89 wallpaperData.clear();
97 if (wallpaperFile == fileName)
102 if (
auto sizeSuffix = strrchr(fileName,
'_'))
107 if (sscanf(sizeSuffix,
"_%dx%d.png", &width, &height) == 2)
114 wallpaperData.push_back(wp);
124 if (wallpaperData.empty())
125 return haveBackup ? (wallpaperPath + wallpaperFile) : std::string();
130 for (
auto &wp : wallpaperData)
132 if (wp.width >= width && wp.height >= height)
134 if (wallpaper.
filename.empty() || (wallpaper.
width < wp.width &&
135 wallpaper.
height < wp.height))
145 wallpaper = wallpaperData.front();
std::string getStringValue(const std::string &key) const
static void loadWallpapers()
Reads the folder that contains wallpapers and organizes the wallpapers found by area,...
static std::string getWallpaper(int width, int height)
Returns the largest wallpaper for the given resolution, or the default wallpaper if none are found.
Configuration paths
XML default paths information reader.
Configuration branding
XML branding information reader.
Files enumerateFiles(const std::string &dir)
Returns a list of files in the given directory.
bool wallpaperCompare(const WallpaperData &a, const WallpaperData &b)
Comparison function that puts the largest wallpaper first.
std::ostream & operator<<(std::ostream &os, const WallpaperData &d)