• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 
00054 class PLASMA_EXPORT Wallpaper : public QObject
00055 {
00056     Q_OBJECT
00057     Q_PROPERTY(QRectF boundingRect READ boundingRect WRITE setBoundingRect)
00058     Q_PROPERTY(QString name READ name)
00059     Q_PROPERTY(QString pluginName READ pluginName)
00060     Q_PROPERTY(QString icon READ icon)
00061     Q_PROPERTY(KServiceAction renderingMode READ renderingMode)
00062     Q_PROPERTY(QList<KServiceAction> listRenderingModes READ listRenderingModes)
00063     Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache)
00064 
00065     public:
00069         enum ResizeMethod {
00070             ScaledResize ,
00071             CenteredResize ,
00072             ScaledAndCroppedResize ,
00073             TiledResize ,
00074             CenterTiledResize ,
00075             MaxpectResize 
00076         };
00077         Q_ENUMS(ResizeMethod)
00078 
00079         
00082         explicit Wallpaper(QObject * parent = 0);
00083 
00084         ~Wallpaper();
00085 
00091         static KPluginInfo::List listWallpaperInfo(const QString &formFactor = QString());
00092 
00104         static Wallpaper *load(const QString &name, const QVariantList &args = QVariantList());
00105 
00117         static Wallpaper *load(const KPluginInfo &info, const QVariantList &args = QVariantList());
00118 
00128         static PackageStructure::Ptr packageStructure(Wallpaper *paper = 0);
00129 
00136         QString name() const;
00137 
00141         QString pluginName() const;
00142 
00146         QString icon() const;
00147 
00151         KServiceAction renderingMode() const;
00152 
00153 
00159         void setRenderingMode(const QString &mode);
00160 
00165         QList<KServiceAction> listRenderingModes() const;
00166 
00170         bool isInitialized() const;
00171 
00175         QRectF boundingRect() const;
00176 
00180         void setBoundingRect(const QRectF &boundingRect);
00181 
00188         virtual void paint(QPainter *painter, const QRectF &exposedRect) = 0;
00189 
00195         void restore(const KConfigGroup &config);
00196 
00201         virtual void save(KConfigGroup &config);
00202 
00219         virtual QWidget *createConfigurationInterface(QWidget *parent);
00220 
00227         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00228 
00235         virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00236 
00243         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00244 
00251         virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
00252 
00272         Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
00273 
00279         bool configurationRequired() const;
00280 
00285         bool isUsingRenderingCache() const;
00286 
00297         void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
00298 
00299         /*
00300          * Allows one to set rendering hints that may differ from the actualities of the
00301          * Wallpaper's current state, allowing for better selection of papers from packages,
00302          * for instance.
00303          *
00304          * @arg targetSize The size to assume will be used for future wallpaper scaling
00305          *
00306          * @since 4.3
00307          */
00308         void setTargetSizeHint(const QSizeF &targetSize);
00309 
00310     Q_SIGNALS:
00314         void update(const QRectF &exposedArea);
00315 
00320         void configureRequested();
00321 
00327         void configurationRequired(bool needsConfig);
00328 
00334         void configNeedsSaving();
00335 
00340         void renderCompleted(const QImage &image);
00341 
00345         void renderHintsChanged();
00346 
00347     protected:
00356         Wallpaper(QObject *parent, const QVariantList &args);
00357 
00365         virtual void init(const KConfigGroup &config);
00366 
00378         void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
00379 
00393         void render(const QString &sourceImagePath, const QSize &size,
00394                     Wallpaper::ResizeMethod resizeMethod = ScaledResize,
00395                     const QColor &color = QColor(0, 0, 0));
00396 
00407         void setUsingRenderingCache(bool useCache);
00408 
00420         bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
00421 
00435         void insertIntoCache(const QString& key, const QImage &image);
00436 
00437     private:
00438         Q_PRIVATE_SLOT(d, void newRenderCompleted(const WallpaperRenderRequest &request,
00439                                                   const QImage &image))
00440 
00441         friend class WallpaperPackage;
00442         friend class WallpaperPrivate;
00443         WallpaperPrivate *const d;
00444 };
00445 
00446 } // Plasma namespace
00447 
00451 #define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
00452 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00453 K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
00454 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
00455 
00456 #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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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