Add Wallpaper::setPackagePath and Wallpaper::packagePath
This commit is contained in:
parent
3bcc40476c
commit
5652490a0e
@ -59,6 +59,7 @@ public:
|
|||||||
QSizeF targetSize;
|
QSizeF targetSize;
|
||||||
WallpaperScript *script;
|
WallpaperScript *script;
|
||||||
QList<QAction*> contextActions;
|
QList<QAction*> contextActions;
|
||||||
|
QString wallpaperPath;
|
||||||
|
|
||||||
bool cacheRendering : 1;
|
bool cacheRendering : 1;
|
||||||
bool initialized : 1;
|
bool initialized : 1;
|
||||||
|
@ -166,7 +166,8 @@ void WallpaperScript::render(const QString &sourceImagePath, const QSize &size,
|
|||||||
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
|
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
|
||||||
{
|
{
|
||||||
if (d->wallpaper) {
|
if (d->wallpaper) {
|
||||||
d->wallpaper->render(sourceImagePath, size, resizeMethod, color);
|
d->wallpaper->setWallpaperPath(sourceImagePath);
|
||||||
|
d->wallpaper->render(size, resizeMethod, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,6 +269,21 @@ bool Wallpaper::isInitialized() const
|
|||||||
return d->initialized;
|
return d->initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Wallpaper::wallpaperPath() const
|
||||||
|
{
|
||||||
|
return d->wallpaperPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wallpaper::setWallpaperPath(const QString& path)
|
||||||
|
{
|
||||||
|
if (path.isEmpty() || !QFile::exists(path)) {
|
||||||
|
kWarning() << "failed on:" << path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->wallpaperPath = path;
|
||||||
|
}
|
||||||
|
|
||||||
void Wallpaper::setBoundingRect(const QRectF &boundingRect)
|
void Wallpaper::setBoundingRect(const QRectF &boundingRect)
|
||||||
{
|
{
|
||||||
d->boundingRect = boundingRect;
|
d->boundingRect = boundingRect;
|
||||||
@ -427,15 +442,10 @@ void Wallpaper::render(const QImage &image, const QSize &size,
|
|||||||
d->renderWallpaper(QString(), image, size, resizeMethod, color);
|
d->renderWallpaper(QString(), image, size, resizeMethod, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
|
void Wallpaper::render(const QSize &size, Wallpaper::ResizeMethod resizeMethod,
|
||||||
Wallpaper::ResizeMethod resizeMethod, const QColor &color)
|
const QColor &color)
|
||||||
{
|
{
|
||||||
if (sourceImagePath.isEmpty() || !QFile::exists(sourceImagePath)) {
|
d->renderWallpaper(d->wallpaperPath, QImage(), size, resizeMethod, color);
|
||||||
//kDebug() << "failed on:" << sourceImagePath;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->renderWallpaper(sourceImagePath, QImage(), size, resizeMethod, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WallpaperPrivate::renderWallpaper(const QString &sourceImagePath, const QImage &image, const QSize &size,
|
void WallpaperPrivate::renderWallpaper(const QString &sourceImagePath, const QImage &image, const QSize &size,
|
||||||
|
@ -309,6 +309,8 @@ class PLASMA_EXPORT Wallpaper : public QObject
|
|||||||
*/
|
*/
|
||||||
bool isUsingRenderingCache() const;
|
bool isUsingRenderingCache() const;
|
||||||
|
|
||||||
|
virtual void setWallpaperPath(const QString& path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows one to set rendering hints that may differ from the actualities of the
|
* Allows one to set rendering hints that may differ from the actualities of the
|
||||||
* Wallpaper's current state, allowing for better selection of papers from packages,
|
* Wallpaper's current state, allowing for better selection of papers from packages,
|
||||||
@ -355,6 +357,8 @@ class PLASMA_EXPORT Wallpaper : public QObject
|
|||||||
*/
|
*/
|
||||||
bool isPreviewing() const;
|
bool isPreviewing() const;
|
||||||
|
|
||||||
|
QString wallpaperPath() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts the wallpaper into preview mode
|
* Puts the wallpaper into preview mode
|
||||||
* @since 4.5
|
* @since 4.5
|
||||||
@ -451,8 +455,7 @@ class PLASMA_EXPORT Wallpaper : public QObject
|
|||||||
* entire size with the given ResizeMethod
|
* entire size with the given ResizeMethod
|
||||||
* @since 4.3
|
* @since 4.3
|
||||||
*/
|
*/
|
||||||
void render(const QString &sourceImagePath, const QSize &size,
|
void render(const QSize &size, Wallpaper::ResizeMethod resizeMethod = ScaledResize,
|
||||||
Wallpaper::ResizeMethod resizeMethod = ScaledResize,
|
|
||||||
const QColor &color = QColor(0, 0, 0));
|
const QColor &color = QColor(0, 0, 0));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user