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

Plasma

wallpaper.h
Go to the documentation of this file.
00001 /*
00002  *   Copyright 2008 by Aaron Seigo <aseigo@kde.org>
00003  *   Copyright 2008 by Petri Damsten <damu@iki.fi>
00004 
00005  *   This program is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU Library General Public License as
00007  *   published by the Free Software Foundation; either version 2, or
00008  *   (at your option) any later version.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details
00014  *
00015  *   You should have received a copy of the GNU Library General Public
00016  *   License along with this program; if not, write to the
00017  *   Free Software Foundation, Inc.,
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  */
00020 
00021 #ifndef PLASMA_WALLPAPER_H
00022 #define PLASMA_WALLPAPER_H
00023 
00024 #include <kmimetype.h>
00025 #include <kplugininfo.h>
00026 
00027 #include <plasma/plasma.h>
00028 #include <plasma/packagestructure.h>
00029 #include <plasma/version.h>
00030 
00031 namespace Plasma
00032 {
00033 
00034 class DataEngine;
00035 class WallpaperPrivate;
00036 class Package;
00037 
00056 class PLASMA_EXPORT Wallpaper : public QObject
00057 {
00058     Q_OBJECT
00059     Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect)
00060     Q_PROPERTY(QString name READ name)
00061     Q_PROPERTY(QString pluginName READ pluginName)
00062     Q_PROPERTY(QString icon READ icon)
00063     Q_PROPERTY(KServiceAction renderingMode READ renderingMode)
00064     Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes)
00065     Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache)
00066     Q_PROPERTY(bool previewing READ isPreviewing WRITE setPreviewing)
00067     Q_PROPERTY(ResizeMethod resizeMethod READ resizeMethodHint WRITE setResizeMethodHint)
00068     Q_PROPERTY(QSizeF targetSize READ targetSizeHint WRITE setTargetSizeHint)
00069 
00070     public:
00074         enum ResizeMethod {
00075             ScaledResize ,
00076             CenteredResize ,
00077             ScaledAndCroppedResize ,
00078             TiledResize ,
00079             CenterTiledResize ,
00080             MaxpectResize ,
00081             LastResizeMethod = MaxpectResize
00082         };
00083         Q_ENUMS(ResizeMethod)
00084 
00085         
00088         explicit Wallpaper(QObject * parent = 0);
00089 
00090         ~Wallpaper();
00091 
00097         void setUrls(const KUrl::List &urls);
00098 
00099 
00106         static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
00107 
00114         static KPluginInfo::List listWallpaperInfoForMimetype(const QString &mimetype,
00115                                                               const QString &formFactor = QString());
00116 
00128         static Wallpaper *load(const QString &name, const QVariantList &args = QVariantList());
00129 
00141         static Wallpaper *load(const KPluginInfo &info, const QVariantList &args = QVariantList());
00142 
00152         static PackageStructure::Ptr packageStructure(Wallpaper *paper = 0);
00153 
00160         QString name() const;
00161 
00167         const Package *package() const;
00168 
00172         QString pluginName() const;
00173 
00177         QString icon() const;
00178 
00182         KServiceAction renderingMode() const;
00183 
00191         bool supportsMimetype(const QString &mimetype) const;
00192 
00198         void setRenderingMode(const QString &mode);
00199 
00204         QList<KServiceAction> listRenderingModes() const;
00205 
00209         bool isInitialized() const;
00210 
00214         QRectF boundingRect() const;
00215 
00219         void setBoundingRect(const QRectF &boundingRect);
00220 
00227         virtual void paint(QPainter *painter, const QRectF &exposedRect) = 0;
00228 
00234         void restore(const KConfigGroup &config);
00235 
00240         virtual void save(KConfigGroup &config);
00241 
00258         virtual QWidget *createConfigurationInterface(QWidget *parent);
00259 
00266         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00267 
00274         virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00275 
00282         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00283 
00290         virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
00291 
00311         Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
00312 
00318         bool configurationRequired() const;
00319 
00324         bool isUsingRenderingCache() const;
00325 
00336         void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
00337 
00342         Wallpaper::ResizeMethod resizeMethodHint() const;
00343 
00353         void setTargetSizeHint(const QSizeF &targetSize);
00354 
00359         QSizeF targetSizeHint() const;
00360 
00364         QList<QAction*> contextualActions() const;
00365 
00370         bool isPreviewing() const;
00371 
00376         void setPreviewing(bool previewing);
00377 
00382         bool needsPreviewDuringConfiguration() const;
00383 
00384 
00385     Q_SIGNALS:
00389         void update(const QRectF &exposedArea);
00390 
00395         void configureRequested();
00396 
00402         void configurationRequired(bool needsConfig);
00403 
00409         void configNeedsSaving();
00410 
00415         void renderCompleted(const QImage &image);
00416 
00423         KDE_DEPRECATED void urlDropped(const KUrl &url);
00424 
00428         void renderHintsChanged();
00429 
00430     protected Q_SLOTS:
00437         void addUrls(const KUrl::List &urls);
00438 
00439     protected:
00448         Wallpaper(QObject *parent, const QVariantList &args);
00449 
00457         virtual void init(const KConfigGroup &config);
00458 
00470         void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
00471 
00485         void render(const QString &sourceImagePath, const QSize &size,
00486                     Wallpaper::ResizeMethod resizeMethod = ScaledResize,
00487                     const QColor &color = QColor(0, 0, 0));
00488 
00499         void setUsingRenderingCache(bool useCache);
00500 
00512         bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
00513 
00527         void insertIntoCache(const QString& key, const QImage &image);
00528 
00536         void setContextualActions(const QList<QAction*> &actions);
00537 
00538         //FIXME: KDE5, this must be moved to the dptr
00539         QList<QAction*> contextActions;
00540 
00549         void setPreviewDuringConfiguration(const bool preview);
00550 
00551     private:
00552         Q_PRIVATE_SLOT(d, void newRenderCompleted(const WallpaperRenderRequest &request,
00553                                                   const QImage &image))
00554         Q_PRIVATE_SLOT(d, void initScript())
00555 
00556         friend class WallpaperPackage;
00557         friend class WallpaperPrivate;
00558         friend class WallpaperScript;
00559         friend class WallpaperWithPaint;
00560         friend class ContainmentPrivate;
00561         WallpaperPrivate *const d;
00562 };
00563 
00564 } // Plasma namespace
00565 
00569 #define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
00570 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00571 K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
00572 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00573 
00574 #endif // multiple inclusion guard

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal