21#ifndef PLASMA_WALLPAPER_H
22#define PLASMA_WALLPAPER_H
25#include <kplugininfo.h>
35class WallpaperPrivate;
59 Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect)
60 Q_PROPERTY(QString name READ name)
61 Q_PROPERTY(QString pluginName READ pluginName)
62 Q_PROPERTY(QString icon READ icon)
63 Q_PROPERTY(KServiceAction renderingMode READ renderingMode)
64 Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes)
65 Q_PROPERTY(
bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache)
66 Q_PROPERTY(
bool previewing READ isPreviewing WRITE setPreviewing)
67 Q_PROPERTY(
ResizeMethod resizeMethod READ resizeMethodHint WRITE setResizeMethodHint)
68 Q_PROPERTY(QSizeF targetSize READ targetSizeHint WRITE setTargetSizeHint)
77 ScaledAndCroppedResize ,
81 LastResizeMethod = MaxpectResize
97 void setUrls(
const KUrl::List &urls);
106 static KPluginInfo::List listWallpaperInfo(
const QString &formFactor = QString());
114 static KPluginInfo::List listWallpaperInfoForMimetype(
const QString &mimetype,
115 const QString &formFactor = QString());
128 static Wallpaper *load(
const QString &name,
const QVariantList &args = QVariantList());
141 static Wallpaper *load(
const KPluginInfo &info,
const QVariantList &args = QVariantList());
160 QString name()
const;
167 const Package *package()
const;
172 QString pluginName()
const;
177 QString icon()
const;
182 KServiceAction renderingMode()
const;
191 bool supportsMimetype(
const QString &mimetype)
const;
198 void setRenderingMode(
const QString &mode);
204 QList<KServiceAction> listRenderingModes()
const;
209 bool isInitialized()
const;
214 QRectF boundingRect()
const;
219 void setBoundingRect(
const QRectF &boundingRect);
227 virtual void paint(QPainter *painter,
const QRectF &exposedRect) = 0;
234 void restore(
const KConfigGroup &config);
240 virtual void save(KConfigGroup &config);
266 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
274 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
282 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
290 virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
311 Q_INVOKABLE
DataEngine *dataEngine(
const QString &name)
const;
318 bool configurationRequired()
const;
324 bool isUsingRenderingCache()
const;
353 void setTargetSizeHint(
const QSizeF &targetSize);
359 QSizeF targetSizeHint()
const;
364 QList<QAction*> contextualActions()
const;
370 bool isPreviewing()
const;
376 void setPreviewing(
bool previewing);
382 bool needsPreviewDuringConfiguration()
const;
437 void addUrls(
const KUrl::List &urls);
457 virtual void init(
const KConfigGroup &config);
470 void setConfigurationRequired(
bool needsConfiguring,
const QString &reason = QString());
485 void render(
const QString &sourceImagePath,
const QSize &size,
487 const QColor &color = QColor(0, 0, 0));
501 void render(
const QImage &image,
const QSize &size,
503 const QColor &color = QColor(0, 0, 0));
515 void setUsingRenderingCache(
bool useCache);
528 bool findInCache(
const QString &key, QImage &image,
unsigned int lastModified = 0);
543 void insertIntoCache(
const QString& key,
const QImage &image);
552 void setContextualActions(
const QList<QAction*> &actions);
565 void setPreviewDuringConfiguration(
const bool preview);
568 Q_PRIVATE_SLOT(d,
void newRenderCompleted(
const WallpaperRenderRequest &request,
569 const QImage &image))
570 Q_PRIVATE_SLOT(d,
void initScript())
572 friend class WallpaperPackage;
573 friend class WallpaperPrivate;
575 friend class WallpaperWithPaint;
576 friend class ContainmentPrivate;
577 WallpaperPrivate *const d;
585#define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
586K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
587K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
588K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
Data provider for plasmoids (Plasma plugins)
KSharedPtr< PackageStructure > Ptr
object representing an installed Plasmagik package
Provides a restricted interface for scripting a Wallpaper.
The base Wallpaper class.
virtual void paint(QPainter *painter, const QRectF &exposedRect)=0
This method is called when the wallpaper should be painted.
void update(const QRectF &exposedArea)
This signal indicates that wallpaper needs to be repainted.
void renderHintsChanged()
void configurationRequired(bool needsConfig)
Emitted when the state of the wallpaper requiring configuration changes.
ResizeMethod
Various resize modes supported by the built in image renderer.
QList< QAction * > contextActions
void renderCompleted(const QImage &image)
Emitted when a wallpaper image render is completed.
void configureRequested()
Emitted when the user wants to configure/change the wallpaper.
void urlDropped(const KUrl &url)
Emitted when a URL matching X-Plasma-DropMimeTypes is dropped on the wallpaper.
void configNeedsSaving()
Emitted when the configuration of the wallpaper needs to be saved to disk.
Namespace for everything in libplasma.
PackageStructure::Ptr packageStructure(const QString &language, ComponentType type)
Loads an appropriate PackageStructure for the given language and type.