Merge remote-tracking branch 'origin/KDE/4.7' into frameworks

This commit is contained in:
Stephen Kelly 2011-09-22 17:04:54 +02:00
commit 9fca702bb0
2 changed files with 36 additions and 5 deletions

View File

@ -390,14 +390,29 @@ void Wallpaper::setUsingRenderingCache(bool useCache)
void Wallpaper::setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod) void Wallpaper::setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod)
{ {
d->lastResizeMethod = resizeMethod; const ResizeMethod method = qBound(ScaledResize, resizeMethod, LastResizeMethod);
emit renderHintsChanged(); if (method != d->lastResizeMethod) {
d->lastResizeMethod = method;
emit renderHintsChanged();
}
}
Wallpaper::ResizeMethod Wallpaper::resizeMethodHint() const
{
return d->lastResizeMethod;
} }
void Wallpaper::setTargetSizeHint(const QSizeF &targetSize) void Wallpaper::setTargetSizeHint(const QSizeF &targetSize)
{ {
d->targetSize = targetSize; if (targetSize != d->targetSize) {
emit renderHintsChanged(); d->targetSize = targetSize;
emit renderHintsChanged();
}
}
QSizeF Wallpaper::targetSizeHint() const
{
return d->targetSize;
} }
void Wallpaper::render(const QString &sourceImagePath, const QSize &size, void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
@ -408,6 +423,7 @@ void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
return; return;
} }
resizeMethod = qBound(ScaledResize, resizeMethod, LastResizeMethod);
if (d->lastResizeMethod != resizeMethod) { if (d->lastResizeMethod != resizeMethod) {
d->lastResizeMethod = resizeMethod; d->lastResizeMethod = resizeMethod;
emit renderHintsChanged(); emit renderHintsChanged();

View File

@ -63,6 +63,8 @@ class PLASMA_EXPORT Wallpaper : public QObject
Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes) Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes)
Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache) Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache)
Q_PROPERTY(bool previewing READ isPreviewing WRITE setPreviewing) Q_PROPERTY(bool previewing READ isPreviewing WRITE setPreviewing)
Q_PROPERTY(ResizeMethod resizeMethod READ resizeMethodHint WRITE setResizeMethodHint)
Q_PROPERTY(QSizeF targetSize READ targetSizeHint WRITE setTargetSizeHint)
public: public:
/** /**
@ -74,7 +76,8 @@ class PLASMA_EXPORT Wallpaper : public QObject
ScaledAndCroppedResize /**< Scales and crops the image, preserving the aspect ratio */, ScaledAndCroppedResize /**< Scales and crops the image, preserving the aspect ratio */,
TiledResize /**< Tiles the image to fill the area */, TiledResize /**< Tiles the image to fill the area */,
CenterTiledResize /**< Tiles the image to fill the area, starting with a centered tile */, CenterTiledResize /**< Tiles the image to fill the area, starting with a centered tile */,
MaxpectResize /**< Best fit resize */ MaxpectResize /**< Best fit resize */,
LastResizeMethod = MaxpectResize
}; };
Q_ENUMS(ResizeMethod) Q_ENUMS(ResizeMethod)
@ -319,6 +322,12 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/ */
void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod); void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
/**
* @return the current resize method hint
* @since 4.7.2
*/
Wallpaper::ResizeMethod resizeMethodHint() const;
/** /**
* 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,
@ -330,6 +339,12 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/ */
void setTargetSizeHint(const QSizeF &targetSize); void setTargetSizeHint(const QSizeF &targetSize);
/**
* @return the current target size method hint
* @since 4.7.2
*/
QSizeF targetSizeHint() const;
/** /**
* Returns a list of wallpaper contextual actions (nothing by default) * Returns a list of wallpaper contextual actions (nothing by default)
*/ */