• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
wallpaper.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 by Aaron Seigo <aseigo@kde.org>
3 * Copyright 2008 by Petri Damsten <damu@iki.fi>
4
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef PLASMA_WALLPAPER_H
22#define PLASMA_WALLPAPER_H
23
24#include <kmimetype.h>
25#include <kplugininfo.h>
26
27#include <plasma/plasma.h>
28#include <plasma/packagestructure.h>
29#include <plasma/version.h>
30
31namespace Plasma
32{
33
34class DataEngine;
35class WallpaperPrivate;
36class Package;
37
56class PLASMA_EXPORT Wallpaper : public QObject
57{
58 Q_OBJECT
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)
69
70 public:
74 enum ResizeMethod {
75 ScaledResize ,
76 CenteredResize ,
77 ScaledAndCroppedResize ,
78 TiledResize ,
79 CenterTiledResize ,
80 MaxpectResize ,
81 LastResizeMethod = MaxpectResize
82 };
83 Q_ENUMS(ResizeMethod)
84
85
88 explicit Wallpaper(QObject * parent = 0);
89
90 ~Wallpaper();
91
97 void setUrls(const KUrl::List &urls);
98
99
106 static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
107
114 static KPluginInfo::List listWallpaperInfoForMimetype(const QString &mimetype,
115 const QString &formFactor = QString());
116
128 static Wallpaper *load(const QString &name, const QVariantList &args = QVariantList());
129
141 static Wallpaper *load(const KPluginInfo &info, const QVariantList &args = QVariantList());
142
152 static PackageStructure::Ptr packageStructure(Wallpaper *paper = 0);
153
160 QString name() const;
161
167 const Package *package() const;
168
172 QString pluginName() const;
173
177 QString icon() const;
178
182 KServiceAction renderingMode() const;
183
191 bool supportsMimetype(const QString &mimetype) const;
192
198 void setRenderingMode(const QString &mode);
199
204 QList<KServiceAction> listRenderingModes() const;
205
209 bool isInitialized() const;
210
214 QRectF boundingRect() const;
215
219 void setBoundingRect(const QRectF &boundingRect);
220
227 virtual void paint(QPainter *painter, const QRectF &exposedRect) = 0;
228
234 void restore(const KConfigGroup &config);
235
240 virtual void save(KConfigGroup &config);
241
258 virtual QWidget *createConfigurationInterface(QWidget *parent);
259
266 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
267
274 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
275
282 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
283
290 virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
291
311 Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
312
318 bool configurationRequired() const;
319
324 bool isUsingRenderingCache() const;
325
336 void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
337
342 Wallpaper::ResizeMethod resizeMethodHint() const;
343
353 void setTargetSizeHint(const QSizeF &targetSize);
354
359 QSizeF targetSizeHint() const;
360
364 QList<QAction*> contextualActions() const;
365
370 bool isPreviewing() const;
371
376 void setPreviewing(bool previewing);
377
382 bool needsPreviewDuringConfiguration() const;
383
384
385 Q_SIGNALS:
389 void update(const QRectF &exposedArea);
390
395 void configureRequested();
396
402 void configurationRequired(bool needsConfig);
403
409 void configNeedsSaving();
410
415 void renderCompleted(const QImage &image);
416
423 KDE_DEPRECATED void urlDropped(const KUrl &url);
424
428 void renderHintsChanged();
429
430 protected Q_SLOTS:
437 void addUrls(const KUrl::List &urls);
438
439 protected:
448 Wallpaper(QObject *parent, const QVariantList &args);
449
457 virtual void init(const KConfigGroup &config);
458
470 void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
471
485 void render(const QString &sourceImagePath, const QSize &size,
486 Wallpaper::ResizeMethod resizeMethod = ScaledResize,
487 const QColor &color = QColor(0, 0, 0));
488
501 void render(const QImage &image, const QSize &size,
502 Wallpaper::ResizeMethod resizeMethod = ScaledResize,
503 const QColor &color = QColor(0, 0, 0));
504
515 void setUsingRenderingCache(bool useCache);
516
528 bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
529
543 void insertIntoCache(const QString& key, const QImage &image);
544
552 void setContextualActions(const QList<QAction*> &actions);
553
554 //FIXME: KDE5, this must be moved to the dptr
555 QList<QAction*> contextActions;
556
565 void setPreviewDuringConfiguration(const bool preview);
566
567 private:
568 Q_PRIVATE_SLOT(d, void newRenderCompleted(const WallpaperRenderRequest &request,
569 const QImage &image))
570 Q_PRIVATE_SLOT(d, void initScript())
571
572 friend class WallpaperPackage;
573 friend class WallpaperPrivate;
574 friend class WallpaperScript;
575 friend class WallpaperWithPaint;
576 friend class ContainmentPrivate;
577 WallpaperPrivate *const d;
578};
579
580} // Plasma namespace
581
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)
589
590#endif // multiple inclusion guard
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition: dataengine.h:59
Plasma::PackageStructure::Ptr
KSharedPtr< PackageStructure > Ptr
Definition: packagestructure.h:77
Plasma::Package
object representing an installed Plasmagik package
Definition: package.h:43
Plasma::WallpaperScript
Provides a restricted interface for scripting a Wallpaper.
Definition: wallpaperscript.h:43
Plasma::Wallpaper
The base Wallpaper class.
Definition: wallpaper.h:57
Plasma::Wallpaper::paint
virtual void paint(QPainter *painter, const QRectF &exposedRect)=0
This method is called when the wallpaper should be painted.
Plasma::Wallpaper::update
void update(const QRectF &exposedArea)
This signal indicates that wallpaper needs to be repainted.
Plasma::Wallpaper::renderHintsChanged
void renderHintsChanged()
Plasma::Wallpaper::configurationRequired
void configurationRequired(bool needsConfig)
Emitted when the state of the wallpaper requiring configuration changes.
Plasma::Wallpaper::ResizeMethod
ResizeMethod
Various resize modes supported by the built in image renderer.
Definition: wallpaper.h:74
Plasma::Wallpaper::contextActions
QList< QAction * > contextActions
Definition: wallpaper.h:555
Plasma::Wallpaper::renderCompleted
void renderCompleted(const QImage &image)
Emitted when a wallpaper image render is completed.
Plasma::Wallpaper::configureRequested
void configureRequested()
Emitted when the user wants to configure/change the wallpaper.
Plasma::Wallpaper::urlDropped
void urlDropped(const KUrl &url)
Emitted when a URL matching X-Plasma-DropMimeTypes is dropped on the wallpaper.
Plasma::Wallpaper::configNeedsSaving
void configNeedsSaving()
Emitted when the configuration of the wallpaper needs to be saved to disk.
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
Plasma::packageStructure
PackageStructure::Ptr packageStructure(const QString &language, ComponentType type)
Loads an appropriate PackageStructure for the given language and type.
Definition: scriptengine.cpp:274
packagestructure.h
plasma.h
version.h
<Plasma/Version>
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal