10#include <QVariantList>
11#include <QtQmlIntegration/qqmlintegration.h>
71 [[nodiscard]]
int count()
const;
79 [[nodiscard]]
static QList<Candidate>
scanDirectory(
const QString& directory);
84 [[nodiscard]]
static QString
packageImage(
const QString& packageDir);
87 [[nodiscard]]
static QString
packageName(
const QString& packageDir);
90 [[nodiscard]]
static bool isImageFile(
const QString& fileName);
113 QStringList m_directories;
114 QString m_currentPath;
115 QList<Candidate> m_candidates;
117 mutable QVariantList m_candidatesCache;
118 mutable bool m_candidatesCacheValid =
false;
QString currentPath() const
static bool isUsableImage(const QFileInfo &entry)
Whether a scanned entry is a REGULAR file the picker can offer.
void directoriesChanged()
QVariantList candidates() const
static bool isImageFile(const QString &fileName)
Whether a file name carries a raster image suffix the picker offers.
static QStringList defaultDirectories()
The user's wallpaper directory followed by the system ones, every existing wallpapers directory on th...
WallpaperCandidates(QObject *parent=nullptr)
Directories to scan, in order. Defaults to defaultDirectories().
static QList< Candidate > scanDirectory(const QString &directory)
Scan one directory: its image files and its Plasma packages, sorted by name within each shape (files ...
void currentPathChanged()
static QString packageName(const QString &packageDir)
A package's display name from its metadata, or the directory name.
void setDirectories(const QStringList &directories)
static QString packageImage(const QString &packageDir)
The image a Plasma wallpaper package offers: the largest under contents/images/ by the WxH in its nam...
~WallpaperCandidates() override
void rescan()
Re-run the scan against directories and currentPath.
QStringList directories() const
void setCurrentPath(const QString &path)
static constexpr int MaxCandidatesPerDirectory
Most candidates taken from any one directory.
Definition WallpaperCandidates.h:101
Definition AppearanceLibrary.h:13
One wallpaper the picker can offer.
Definition WallpaperCandidates.h:17
QString path
Absolute path of the image file.
Definition WallpaperCandidates.h:19
QString source
Where it came from: "current", "file" or "package".
Definition WallpaperCandidates.h:23
QString name
Display name: the file's base name, or a Plasma package's name.
Definition WallpaperCandidates.h:21
bool operator==(const Candidate &other) const =default