• Skip to content
  • Skip to link menu
KDE 4.6 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 <kplugininfo.h>
00025 
00026 #include <plasma/plasma.h>
00027 #include <plasma/packagestructure.h>
00028 #include <plasma/version.h>
00029 
00030 namespace Plasma
00031 {
00032 
00033 class DataEngine;
00034 class WallpaperPrivate;
00035 class Package;
00036 
00055 class PLASMA_EXPORT Wallpaper : public QObject
00056 {
00057     Q_OBJECT
00058     Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect)
00059     Q_PROPERTY(QString name READ name)
00060     Q_PROPERTY(QString pluginName READ pluginName)
00061     Q_PROPERTY(QString icon READ icon)
00062     Q_PROPERTY(KServiceAction renderingMode READ renderingMode)
00063     Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes)
00064     Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache)
00065     Q_PROPERTY(bool previewing READ isPreviewing WRITE setPreviewing)
00066 
00067     public:
00071         enum ResizeMethod {
00072             ScaledResize ,
00073             CenteredResize ,
00074             ScaledAndCroppedResize ,
00075             TiledResize ,
00076             CenterTiledResize ,
00077             MaxpectResize 
00078         };
00079         Q_ENUMS(ResizeMethod)
00080 
00081         
00084         explicit Wallpaper(QObject * parent = 0);
00085 
00086         ~Wallpaper();
00087 
00094         static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
00095 
00102         static KPluginInfo::List listWallpaperInfoForMimetype(const QString &mimetype,
00103                                                               const QString &formFactor = QString());
00104 
00116         static Wallpaper *load(const QString &name, const QVariantList &args = QVariantList());
00117 
00129         static Wallpaper *load(const KPluginInfo &info, const QVariantList &args = QVariantList());
00130 
00140         static PackageStructure::Ptr packageStructure(Wallpaper *paper = 0);
00141 
00148         QString name() const;
00149 
00155         const Package *package() const;
00156 
00160         QString pluginName() const;
00161 
00165         QString icon() const;
00166 
00170         KServiceAction renderingMode() const;
00171 
00172 
00178         void setRenderingMode(const QString &mode);
00179 
00184         QList<KServiceAction> listRenderingModes() const;
00185 
00189         bool isInitialized() const;
00190 
00194         QRectF boundingRect() const;
00195 
00199         void setBoundingRect(const QRectF &boundingRect);
00200 
00207         virtual void paint(QPainter *painter, const QRectF &exposedRect) = 0;
00208 
00214         void restore(const KConfigGroup &config);
00215 
00220         virtual void save(KConfigGroup &config);
00221 
00238         virtual QWidget *createConfigurationInterface(QWidget *parent);
00239 
00246         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00247 
00254         virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00255 
00262         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00263 
00270         virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
00271 
00291         Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
00292 
00298         bool configurationRequired() const;
00299 
00304         bool isUsingRenderingCache() const;
00305 
00316         void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
00317 
00327         void setTargetSizeHint(const QSizeF &targetSize);
00328 
00332         QList<QAction*> contextualActions() const;
00333 
00338         bool isPreviewing() const;
00339 
00344         void setPreviewing(bool previewing);
00345 
00350         bool needsPreviewDuringConfiguration() const;
00351 
00352 
00353     Q_SIGNALS:
00357         void update(const QRectF &exposedArea);
00358 
00363         void configureRequested();
00364 
00370         void configurationRequired(bool needsConfig);
00371 
00377         void configNeedsSaving();
00378 
00383         void renderCompleted(const QImage &image);
00384 
00391         void urlDropped(const KUrl &url);
00392 
00396         void renderHintsChanged();
00397 
00398     protected:
00407         Wallpaper(QObject *parent, const QVariantList &args);
00408 
00416         virtual void init(const KConfigGroup &config);
00417 
00429         void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
00430 
00444         void render(const QString &sourceImagePath, const QSize &size,
00445                     Wallpaper::ResizeMethod resizeMethod = ScaledResize,
00446                     const QColor &color = QColor(0, 0, 0));
00447 
00458         void setUsingRenderingCache(bool useCache);
00459 
00471         bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
00472 
00486         void insertIntoCache(const QString& key, const QImage &image);
00487 
00495         void setContextualActions(const QList<QAction*> &actions);
00496 
00497         //FIXME: KDE5, this must be moved to the dptr
00498         QList<QAction*> contextActions;
00499 
00508         void setPreviewDuringConfiguration(const bool preview);
00509 
00510     private:
00511         Q_PRIVATE_SLOT(d, void newRenderCompleted(WallpaperRenderThread *renderer, int token, const QImage &image,
00512                                                   const QString &sourceImagePath, const QSize &size,
00513                                                   int resizeMethod, const QColor &color))
00514         Q_PRIVATE_SLOT(d, void initScript())
00515 
00516         friend class WallpaperPackage;
00517         friend class WallpaperPrivate;
00518         friend class WallpaperScript;
00519         friend class WallpaperWithPaint;
00520         friend class ContainmentPrivate;
00521         WallpaperPrivate *const d;
00522 };
00523 
00524 } // Plasma namespace
00525 
00529 #define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
00530 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00531 K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
00532 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00533 
00534 #endif // multiple inclusion guard

Plasma

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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.3
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