prepare Wallpaper for delay init: add a setRenderingMode and an isInitialized
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=872753
This commit is contained in:
parent
333b91acfb
commit
390f76d33a
@ -33,7 +33,8 @@ class WallpaperPrivate
|
|||||||
public:
|
public:
|
||||||
WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) :
|
WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) :
|
||||||
q(wallpaper),
|
q(wallpaper),
|
||||||
wallpaperDescription(service)
|
wallpaperDescription(service),
|
||||||
|
initialized(false)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ public:
|
|||||||
KPluginInfo wallpaperDescription;
|
KPluginInfo wallpaperDescription;
|
||||||
QRectF boundingRect;
|
QRectF boundingRect;
|
||||||
KServiceAction mode;
|
KServiceAction mode;
|
||||||
|
bool initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallpaper::Wallpaper(QObject *parentObject, const QVariantList &args)
|
Wallpaper::Wallpaper(QObject *parentObject, const QVariantList &args)
|
||||||
@ -164,13 +166,22 @@ QRectF Wallpaper::boundingRect() const
|
|||||||
return d->boundingRect;
|
return d->boundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Wallpaper::isInitialized() const
|
||||||
|
{
|
||||||
|
return d->initialized;
|
||||||
|
}
|
||||||
|
|
||||||
void Wallpaper::setBoundingRect(const QRectF &boundingRect)
|
void Wallpaper::setBoundingRect(const QRectF &boundingRect)
|
||||||
{
|
{
|
||||||
d->boundingRect = boundingRect;
|
d->boundingRect = boundingRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallpaper::restore(const KConfigGroup &config, const QString &mode)
|
void Wallpaper::setRenderingMode(const QString &mode)
|
||||||
{
|
{
|
||||||
|
if (d->mode.name() == mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
d->mode = KServiceAction();
|
d->mode = KServiceAction();
|
||||||
if (!mode.isEmpty()) {
|
if (!mode.isEmpty()) {
|
||||||
QList<KServiceAction> modes = listRenderingModes();
|
QList<KServiceAction> modes = listRenderingModes();
|
||||||
@ -182,7 +193,11 @@ void Wallpaper::restore(const KConfigGroup &config, const QString &mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wallpaper::restore(const KConfigGroup &config)
|
||||||
|
{
|
||||||
|
d->initialized = true;
|
||||||
init(config);
|
init(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
wallpaper.h
17
wallpaper.h
@ -117,12 +117,25 @@ class PLASMA_EXPORT Wallpaper : public QObject
|
|||||||
*/
|
*/
|
||||||
KServiceAction renderingMode() const;
|
KServiceAction renderingMode() const;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rendering mode for this wallpaper.
|
||||||
|
* @param mode One of the modes supported by the plugin,
|
||||||
|
* or an empty string for the default mode.
|
||||||
|
*/
|
||||||
|
void setRenderingMode(const QString &mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns modes the wallpaper has, as specified in the
|
* Returns modes the wallpaper has, as specified in the
|
||||||
* .desktop file.
|
* .desktop file.
|
||||||
*/
|
*/
|
||||||
QList<KServiceAction> listRenderingModes() const;
|
QList<KServiceAction> listRenderingModes() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if initialized (usually by calling retore), false otherwise
|
||||||
|
*/
|
||||||
|
bool isInitialized() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns bounding rectangle
|
* Returns bounding rectangle
|
||||||
*/
|
*/
|
||||||
@ -144,11 +157,9 @@ class PLASMA_EXPORT Wallpaper : public QObject
|
|||||||
/**
|
/**
|
||||||
* This method should be called once the wallpaper is loaded or mode is changed.
|
* This method should be called once the wallpaper is loaded or mode is changed.
|
||||||
* @param config Config group to load settings
|
* @param config Config group to load settings
|
||||||
* @param mode One of the modes supported by the plugin,
|
|
||||||
* or an empty string for the default mode.
|
|
||||||
* @see init
|
* @see init
|
||||||
**/
|
**/
|
||||||
void restore(const KConfigGroup &config, const QString &mode = QString());
|
void restore(const KConfigGroup &config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called when settings need to be saved.
|
* This method is called when settings need to be saved.
|
||||||
|
Loading…
Reference in New Issue
Block a user