utils: Allow specifying XCursor theme search paths
This commit is contained in:
parent
28b396f44c
commit
53221fd43f
2 changed files with 9 additions and 7 deletions
|
@ -34,7 +34,7 @@ public:
|
|||
KXcursorThemePrivate();
|
||||
KXcursorThemePrivate(const QString &themeName, int size, qreal devicePixelRatio);
|
||||
|
||||
void load();
|
||||
void load(const QStringList &searchPaths);
|
||||
void loadCursors(const QString &packagePath);
|
||||
|
||||
QString name;
|
||||
|
@ -175,7 +175,7 @@ void KXcursorThemePrivate::loadCursors(const QString &packagePath)
|
|||
}
|
||||
}
|
||||
|
||||
static QStringList searchPaths()
|
||||
static QStringList defaultSearchPaths()
|
||||
{
|
||||
static QStringList paths;
|
||||
if (paths.isEmpty()) {
|
||||
|
@ -195,9 +195,9 @@ static QStringList searchPaths()
|
|||
return paths;
|
||||
}
|
||||
|
||||
void KXcursorThemePrivate::load()
|
||||
void KXcursorThemePrivate::load(const QStringList &searchPaths)
|
||||
{
|
||||
const QStringList paths = searchPaths();
|
||||
const QStringList paths = !searchPaths.isEmpty() ? searchPaths : defaultSearchPaths();
|
||||
|
||||
QStack<QString> stack;
|
||||
QSet<QString> loaded;
|
||||
|
@ -236,10 +236,10 @@ KXcursorTheme::KXcursorTheme()
|
|||
{
|
||||
}
|
||||
|
||||
KXcursorTheme::KXcursorTheme(const QString &themeName, int size, qreal devicePixelRatio)
|
||||
KXcursorTheme::KXcursorTheme(const QString &themeName, int size, qreal devicePixelRatio, const QStringList &searchPaths)
|
||||
: d(new KXcursorThemePrivate(themeName, size, devicePixelRatio))
|
||||
{
|
||||
d->load();
|
||||
d->load(searchPaths);
|
||||
}
|
||||
|
||||
KXcursorTheme::KXcursorTheme(const KXcursorTheme &other)
|
||||
|
|
|
@ -88,8 +88,10 @@ public:
|
|||
* Loads the Xcursor theme with the given @ themeName and the desired @a size.
|
||||
* The @a dpr specifies the desired scale factor. If no theme with the provided
|
||||
* name exists, the cursor theme will be empty.
|
||||
*
|
||||
* @a searchPaths specifies where the cursor theme should be looked for.
|
||||
*/
|
||||
KXcursorTheme(const QString &theme, int size, qreal devicePixelRatio);
|
||||
KXcursorTheme(const QString &theme, int size, qreal devicePixelRatio, const QStringList &searchPaths = QStringList());
|
||||
|
||||
/**
|
||||
* Constructs a copy of the KXcursorTheme object @a other.
|
||||
|
|
Loading…
Reference in a new issue