Base for Plasma::Wallpaper plugins.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=842590
This commit is contained in:
parent
dfb38b00f3
commit
0183db7d30
@ -64,6 +64,7 @@ set(plasma_LIB_SRCS
|
||||
uiloader.cpp
|
||||
version.cpp
|
||||
view.cpp
|
||||
wallpaper.cpp
|
||||
widgets/checkbox.cpp
|
||||
widgets/combobox.cpp
|
||||
widgets/flash.cpp
|
||||
@ -155,7 +156,8 @@ set(plasma_LIB_INCLUDES
|
||||
uiloader.h
|
||||
tooltipmanager.h
|
||||
version.h
|
||||
view.h)
|
||||
view.h
|
||||
wallpaper.h)
|
||||
|
||||
if(QT_QTOPENGL_FOUND AND OPENGL_FOUND)
|
||||
set(plasma_LIB_INCLUDES
|
||||
@ -246,6 +248,7 @@ includes/Theme
|
||||
includes/UiLoader
|
||||
includes/View
|
||||
includes/Version
|
||||
includes/Wallpaper
|
||||
includes/WebContent
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma COMPONENT Devel)
|
||||
|
||||
@ -263,6 +266,7 @@ install(FILES
|
||||
servicetypes/plasma-packagestructure.desktop
|
||||
servicetypes/plasma-runner.desktop
|
||||
servicetypes/plasma-scriptengine.desktop
|
||||
servicetypes/plasma-wallpaper.desktop
|
||||
DESTINATION ${SERVICETYPES_INSTALL_DIR})
|
||||
|
||||
install(FILES scripting/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
18
applet.cpp
18
applet.cpp
@ -75,6 +75,7 @@
|
||||
#include "widgets/label.h"
|
||||
#include "widgets/pushbutton.h"
|
||||
#include "tooltipmanager.h"
|
||||
#include "wallpaper.h"
|
||||
|
||||
#include "private/containment_p.h"
|
||||
#include "private/packages_p.h"
|
||||
@ -373,6 +374,11 @@ void AppletPrivate::selectItemToDestroy()
|
||||
q->destroy();
|
||||
}
|
||||
|
||||
void AppletPrivate::updateRect(const QRectF& rect)
|
||||
{
|
||||
q->update(rect);
|
||||
}
|
||||
|
||||
void AppletPrivate::cleanUpAndDelete()
|
||||
{
|
||||
//kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????";
|
||||
@ -886,12 +892,16 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
|
||||
// note that the widget we get is actually the viewport of the view, not the view itself
|
||||
View* v = qobject_cast<Plasma::View*>(widget->parent());
|
||||
if (!v || v->isWallpaperEnabled()) {
|
||||
Containment::StyleOption coption(*option);
|
||||
coption.view = v;
|
||||
Containment* c = qobject_cast<Plasma::Containment*>(this);
|
||||
if (c && c->drawWallpaper() && c->wallpaper()) {
|
||||
c->wallpaper()->paint(p, contentsRect);
|
||||
} else {
|
||||
Containment::StyleOption coption(*option);
|
||||
coption.view = v;
|
||||
|
||||
paintInterface(p, &coption, contentsRect);
|
||||
paintInterface(p, &coption, contentsRect);
|
||||
}
|
||||
}
|
||||
|
||||
p->restore();
|
||||
return;
|
||||
}
|
||||
|
1
applet.h
1
applet.h
@ -779,6 +779,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
Q_PRIVATE_SLOT(d, void themeChanged())
|
||||
Q_PRIVATE_SLOT(d, void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim))
|
||||
Q_PRIVATE_SLOT(d, void selectItemToDestroy())
|
||||
Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
|
||||
|
||||
/**
|
||||
* Reimplemented from QGraphicsItem
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "animator.h"
|
||||
#include "corona.h"
|
||||
#include "svg.h"
|
||||
#include "wallpaper.h"
|
||||
|
||||
#include "private/applet_p.h"
|
||||
#include "private/applethandle_p.h"
|
||||
@ -249,6 +250,9 @@ void Containment::restore(KConfigGroup &group)
|
||||
//kDebug() << "Containment" << id() << "geometry is" << geometry() << "config'd with" << appletConfig.name();
|
||||
restoreContents(group);
|
||||
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
|
||||
|
||||
setWallpaper(group.readEntry("wallpaperplugin", QString()),
|
||||
group.readEntry("wallpaperpluginmode", QString()));
|
||||
}
|
||||
|
||||
void Containment::save(KConfigGroup &g) const
|
||||
@ -790,6 +794,14 @@ void Containment::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
{
|
||||
Applet::resizeEvent(event);
|
||||
if (d->wallpaper) {
|
||||
d->wallpaper->setBoundingRect(geometry());
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
//FIXME Qt4.4 check to see if this is still necessary to avoid unnecessary repaints
|
||||
@ -950,6 +962,39 @@ void Containment::removeAssociatedWidget(QWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::setDrawWallpaper(bool drawWallpaper)
|
||||
{
|
||||
d->drawWallpaper = drawWallpaper;
|
||||
}
|
||||
|
||||
bool Containment::drawWallpaper()
|
||||
{
|
||||
return d->drawWallpaper;
|
||||
}
|
||||
|
||||
void Containment::setWallpaper(const QString &pluginName, const QString &action)
|
||||
{
|
||||
delete d->wallpaper;
|
||||
if (!pluginName.isEmpty()) {
|
||||
d->wallpaper = Plasma::Wallpaper::load(pluginName);
|
||||
setDrawWallpaper(d->wallpaper != 0);
|
||||
if (d->wallpaper) {
|
||||
d->wallpaper->setBoundingRect(geometry());
|
||||
d->wallpaper->init(action);
|
||||
connect(d->wallpaper, SIGNAL(update(const QRectF&)),
|
||||
this, SLOT(updateRect(const QRectF&)));
|
||||
}
|
||||
} else {
|
||||
d->wallpaper = 0;
|
||||
setDrawWallpaper(false);
|
||||
}
|
||||
}
|
||||
|
||||
Plasma::Wallpaper* Containment::wallpaper()
|
||||
{
|
||||
return d->wallpaper;
|
||||
}
|
||||
|
||||
KActionCollection& ContainmentPrivate::actions()
|
||||
{
|
||||
return static_cast<Applet*>(q)->d->actions;
|
||||
|
@ -42,6 +42,7 @@ class DataEngine;
|
||||
class Package;
|
||||
class Corona;
|
||||
class View;
|
||||
class Wallpaper;
|
||||
class ContainmentPrivate;
|
||||
|
||||
/**
|
||||
@ -269,6 +270,27 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
*/
|
||||
void removeAssociatedWidget(QWidget *widget);
|
||||
|
||||
/**
|
||||
* Sets whether wallpaper is painted or not.
|
||||
*/
|
||||
void setDrawWallpaper(bool drawWallpaper);
|
||||
|
||||
/**
|
||||
* Return whether wallpaper is painted or not.
|
||||
*/
|
||||
bool drawWallpaper();
|
||||
|
||||
/**
|
||||
* Sets wallpaper plugin.
|
||||
*/
|
||||
void setWallpaper(const QString &pluginName, const QString &action = QString());
|
||||
|
||||
/**
|
||||
* Return wallpaper plugin.
|
||||
*/
|
||||
Plasma::Wallpaper* wallpaper();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted when a new applet is created by the containment
|
||||
@ -405,6 +427,11 @@ class PLASMA_EXPORT Containment : public Applet
|
||||
*/
|
||||
void dropEvent(QGraphicsSceneDragDropEvent *event);
|
||||
|
||||
/**
|
||||
* @reimplemented from QGraphicsItem
|
||||
*/
|
||||
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||
|
||||
private:
|
||||
Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*))
|
||||
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim))
|
||||
|
1
includes/Wallpaper
Normal file
1
includes/Wallpaper
Normal file
@ -0,0 +1 @@
|
||||
#include "../../plasma/wallpaper.h"
|
@ -30,6 +30,7 @@ namespace Plasma
|
||||
class PanelSvg;
|
||||
class AppletScript;
|
||||
class ShadowItem;
|
||||
class Wallpaper;
|
||||
|
||||
class AppletOverlayWidget : public QGraphicsWidget
|
||||
{
|
||||
@ -63,6 +64,7 @@ public:
|
||||
void resetConfigurationObject();
|
||||
void appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
||||
void selectItemToDestroy();
|
||||
void updateRect(const QRectF& rect);
|
||||
void setFocus();
|
||||
void cleanUpAndDelete();
|
||||
|
||||
|
@ -38,10 +38,12 @@ public:
|
||||
formFactor(Planar),
|
||||
location(Floating),
|
||||
focusedApplet(0),
|
||||
wallpaper(0),
|
||||
screen(-1), // no screen
|
||||
toolBox(0),
|
||||
type(Containment::NoContainmentType),
|
||||
positioning(false)
|
||||
positioning(false),
|
||||
drawWallpaper(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,11 +97,13 @@ public:
|
||||
Location location;
|
||||
Applet::List applets;
|
||||
Applet *focusedApplet;
|
||||
Plasma::Wallpaper *wallpaper;
|
||||
QMap<Applet*, AppletHandle*> handles;
|
||||
int screen;
|
||||
ToolBox *toolBox;
|
||||
Containment::Type type;
|
||||
bool positioning;
|
||||
bool drawWallpaper;
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
9
servicetypes/plasma-wallpaper.desktop
Normal file
9
servicetypes/plasma-wallpaper.desktop
Normal file
@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=ServiceType
|
||||
X-KDE-ServiceType=Plasma/Wallpaper
|
||||
|
||||
Comment=Plasma wallpaper
|
||||
|
||||
[PropertyDef::X-Plasma-FormFactors]
|
||||
Type=QStringList
|
||||
|
194
wallpaper.cpp
Normal file
194
wallpaper.cpp
Normal file
@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2008 by Petri Damsten <damu@iki.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "wallpaper.h"
|
||||
|
||||
#include <KServiceTypeTrader>
|
||||
#include <KDebug>
|
||||
|
||||
#include <version.h>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class WallpaperPrivate
|
||||
{
|
||||
public:
|
||||
WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) :
|
||||
q(wallpaper),
|
||||
wallpaperDescription(service)
|
||||
{
|
||||
};
|
||||
|
||||
~WallpaperPrivate()
|
||||
{
|
||||
};
|
||||
|
||||
Wallpaper *q;
|
||||
KPluginInfo wallpaperDescription;
|
||||
QRectF boundingRect;
|
||||
};
|
||||
|
||||
Wallpaper::Wallpaper(QObject* parentObject, const QVariantList& args)
|
||||
: d(new WallpaperPrivate(KService::serviceByStorageId(args.count() > 0 ?
|
||||
args[0].toString() : QString()), this))
|
||||
{
|
||||
// now remove first item since those are managed by Wallpaper and subclasses shouldn't
|
||||
// need to worry about them. yes, it violates the constness of this var, but it lets us add
|
||||
// or remove items later while applets can just pretend that their args always start at 0
|
||||
QVariantList &mutableArgs = const_cast<QVariantList&>(args);
|
||||
if (!mutableArgs.isEmpty()) {
|
||||
mutableArgs.removeFirst();
|
||||
}
|
||||
setParent(parentObject);
|
||||
}
|
||||
|
||||
Wallpaper::~Wallpaper()
|
||||
{
|
||||
}
|
||||
|
||||
KPluginInfo::List Wallpaper::listWallpaperInfo(const QString &formFactor)
|
||||
{
|
||||
QString constraint;
|
||||
|
||||
if (!formFactor.isEmpty()) {
|
||||
constraint.append("[X-Plasma-FormFactors] ~~ '").append(formFactor).append("'");
|
||||
}
|
||||
|
||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint);
|
||||
return KPluginInfo::fromServices(offers);
|
||||
}
|
||||
|
||||
Wallpaper* Wallpaper::load(const QString& wallpaperName, const QVariantList& args)
|
||||
{
|
||||
if (wallpaperName.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(wallpaperName);
|
||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/Wallpaper", constraint);
|
||||
|
||||
if (offers.isEmpty()) {
|
||||
kDebug() << "offers is empty for " << wallpaperName;
|
||||
return 0;
|
||||
}
|
||||
|
||||
KService::Ptr offer = offers.first();
|
||||
KPluginLoader plugin(*offer);
|
||||
|
||||
if (!Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariantList allArgs;
|
||||
allArgs << offer->storageId() << args;
|
||||
QString error;
|
||||
Wallpaper* wallpaper = offer->createInstance<Plasma::Wallpaper>(0, allArgs, &error);
|
||||
|
||||
if (!wallpaper) {
|
||||
kDebug() << "Couldn't load wallpaper \"" << wallpaperName << "\"! reason given: " << error;
|
||||
}
|
||||
return wallpaper;
|
||||
}
|
||||
|
||||
Wallpaper* Wallpaper::load(const KPluginInfo& info, const QVariantList& args)
|
||||
{
|
||||
if (!info.isValid()) {
|
||||
return 0;
|
||||
}
|
||||
return load(info.pluginName(), args);
|
||||
}
|
||||
|
||||
QString Wallpaper::name() const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return i18n("Unknown Wallpaper");
|
||||
}
|
||||
return d->wallpaperDescription.name();
|
||||
}
|
||||
|
||||
QString Wallpaper::icon() const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
return d->wallpaperDescription.icon();
|
||||
}
|
||||
|
||||
QString Wallpaper::pluginName() const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
return d->wallpaperDescription.pluginName();
|
||||
}
|
||||
|
||||
QStringList Wallpaper::modes() const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return QStringList();
|
||||
}
|
||||
return d->wallpaperDescription.property("Actions").toStringList();
|
||||
}
|
||||
|
||||
QString Wallpaper::modeName(const QString& mode) const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
KConfigGroup wallpaperCfg = d->wallpaperDescription.config();
|
||||
KConfigGroup cfg(&wallpaperCfg, QString("Desktop Action %1").arg(mode));
|
||||
return cfg.readEntry("Name");
|
||||
}
|
||||
|
||||
QString Wallpaper::modeIcon(const QString& mode) const
|
||||
{
|
||||
if (!d->wallpaperDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
KConfigGroup wallpaperCfg = d->wallpaperDescription.config();
|
||||
KConfigGroup cfg(&wallpaperCfg, QString("Desktop Action %1").arg(mode));
|
||||
return cfg.readEntry("Icon");
|
||||
}
|
||||
|
||||
QRectF Wallpaper::boundingRect() const
|
||||
{
|
||||
return d->boundingRect;
|
||||
}
|
||||
|
||||
void Wallpaper::setBoundingRect(const QRectF& boundingRect)
|
||||
{
|
||||
d->boundingRect = boundingRect;
|
||||
}
|
||||
|
||||
void Wallpaper::init(const QString &action)
|
||||
{
|
||||
Q_UNUSED(action);
|
||||
}
|
||||
|
||||
QWidget *Wallpaper::configuration(QWidget *parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
#include "wallpaper.moc"
|
186
wallpaper.h
Normal file
186
wallpaper.h
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2008 by Petri Damsten <damu@iki.fi>
|
||||
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef PLASMA_WALLPAPER_H
|
||||
#define PLASMA_WALLPAPER_H
|
||||
|
||||
#include <KPluginInfo>
|
||||
|
||||
#include <plasma/plasma.h>
|
||||
#include <plasma/version.h>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class WallpaperPrivate;
|
||||
|
||||
/**
|
||||
* @short The base Wallpaper class
|
||||
*
|
||||
* "Wallpapers" are components that paint the background for Containments that
|
||||
* do not provide their own background rendering.
|
||||
*
|
||||
* Wallpaper plugins are registered using .desktop files. These files should be
|
||||
* named using the following naming scheme:
|
||||
*
|
||||
* plasma-wallpaper-<pluginname>.desktop
|
||||
*
|
||||
* If a wallpaper plugin provides more than on mode (e.g. Single Image, Wallpaper)
|
||||
* it should include a Actions= entry in the .desktop file, listing the possible
|
||||
* actions. An actions group should be included to provide for translatable names.
|
||||
*/
|
||||
|
||||
class PLASMA_EXPORT Wallpaper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect)
|
||||
//Q_PROPERTY(QStringList formFactors READ formFactors WRITE setFormFactors)
|
||||
Q_PROPERTY(QString name READ name)
|
||||
|
||||
public:
|
||||
~Wallpaper();
|
||||
|
||||
/**
|
||||
* Returns a list of all known wallpapers.
|
||||
*
|
||||
* @return list of wallpapers
|
||||
**/
|
||||
static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
|
||||
|
||||
/**
|
||||
* Attempts to load an wallpaper
|
||||
*
|
||||
* Returns a pointer to the wallpaper if successful.
|
||||
* The caller takes responsibility for the wallpaper, including
|
||||
* deleting it when no longer needed.
|
||||
*
|
||||
* @param name the plugin name, as returned by KPluginInfo::pluginName()
|
||||
* @param args to send the wallpaper extra arguments
|
||||
* @return a pointer to the loaded wallpaper, or 0 on load failure
|
||||
**/
|
||||
static Wallpaper* load(const QString &name, const QVariantList& args = QVariantList());
|
||||
|
||||
/**
|
||||
* Attempts to load an wallpaper
|
||||
*
|
||||
* Returns a pointer to the wallpaper if successful.
|
||||
* The caller takes responsibility for the wallpaper, including
|
||||
* deleting it when no longer needed.
|
||||
*
|
||||
* @param info KPluginInfo object for the desired wallpaper
|
||||
* @param args to send the wallpaper extra arguments
|
||||
* @return a pointer to the loaded wallpaper, or 0 on load failure
|
||||
**/
|
||||
static Wallpaper* load(const KPluginInfo& info, const QVariantList& args = QVariantList());
|
||||
|
||||
/**
|
||||
* Returns the user-visible name for the wallpaper, as specified in the
|
||||
* .desktop file.
|
||||
*
|
||||
* @return the user-visible name for the wallpaper.
|
||||
**/
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
* Returns the plugin name for the wallpaper
|
||||
*/
|
||||
QString pluginName() const;
|
||||
|
||||
/**
|
||||
* Returns the icon related to this wallpaper
|
||||
**/
|
||||
QString icon() const;
|
||||
|
||||
/**
|
||||
* Returns modes the wallpaper has, as specified in the
|
||||
* .desktop file.
|
||||
*/
|
||||
QStringList modes() const;
|
||||
|
||||
/**
|
||||
* Returns name for the mode.
|
||||
*/
|
||||
QString modeName(const QString& mode) const;
|
||||
|
||||
/**
|
||||
* Returns icon for the mode.
|
||||
*/
|
||||
QString modeIcon(const QString& mode) const;
|
||||
|
||||
/**
|
||||
* Returns bounding rectangle
|
||||
*/
|
||||
QRectF boundingRect() const;
|
||||
|
||||
/**
|
||||
* Sets bounding rectangle
|
||||
*/
|
||||
void setBoundingRect(const QRectF& boundingRect);
|
||||
|
||||
/**
|
||||
* This method is called when the wallpaper should be painted.
|
||||
*
|
||||
* @param painter the QPainter to use to do the painting
|
||||
* @param exposedRect the rect to paint within
|
||||
**/
|
||||
virtual void paint(QPainter *painter, const QRectF& exposedRect) = 0;
|
||||
|
||||
/**
|
||||
* This method is called once the wallpaper is loaded.
|
||||
* @param action One of the actions spedified in the desktop file (if any).
|
||||
**/
|
||||
virtual void init(const QString &action = QString());
|
||||
|
||||
/**
|
||||
* Returns widget for configuration dialog.
|
||||
*/
|
||||
virtual QWidget *configuration(QWidget *parent);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal indicates that wallpaper needs to be repainted.
|
||||
*/
|
||||
void update(const QRectF &exposedArea);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* This constructor is to be used with the plugin loading systems
|
||||
* found in KPluginInfo and KService. The argument list is expected
|
||||
* to have one element: the KService service ID for the desktop entry.
|
||||
*
|
||||
* @param parent a QObject parent; you probably want to pass in 0
|
||||
* @param args a list of strings containing one entry: the service id
|
||||
*/
|
||||
Wallpaper(QObject* parent, const QVariantList& args);
|
||||
|
||||
private:
|
||||
WallpaperPrivate* const d;
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
/**
|
||||
* Register an wallpaper when it is contained in a loadable module
|
||||
*/
|
||||
#define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
|
||||
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
|
||||
K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
|
||||
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
|
||||
|
||||
#endif // multiple inclusion guard
|
Loading…
Reference in New Issue
Block a user