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

Plasma

  • plasma
  • scripting
wallpaperscript.h
Go to the documentation of this file.
1/*
2 * Copyright 2009 by Aaron Seigo <aseigo@kde.org>
3 * Copyright 2009 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_WALLPAPERSCRIPT_H
22#define PLASMA_WALLPAPERSCRIPT_H
23
24#include <kgenericfactory.h>
25#include <kplugininfo.h>
26
27#include <plasma/plasma_export.h>
28#include <plasma/scripting/scriptengine.h>
29#include <plasma/wallpaper.h>
30
31namespace Plasma
32{
33
34class WallpaperScriptPrivate;
35class Service;
36
42class PLASMA_EXPORT WallpaperScript : public ScriptEngine
43{
44 Q_OBJECT
45
46public:
54 explicit WallpaperScript(QObject *parent = 0);
55 ~WallpaperScript();
56
60 void setWallpaper(Wallpaper *wallpaper);
61
65 Wallpaper *wallpaper() const;
66
74 virtual void initWallpaper(const KConfigGroup &config);
75
82 virtual void paint(QPainter *painter, const QRectF &exposedRect);
83
88 virtual void save(KConfigGroup &config);
89
106 virtual QWidget *createConfigurationInterface(QWidget *parent);
107
114 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
115
122 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
123
130 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
131
138 virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
139
144 void setUrls(const KUrl::List urls);
145
146protected:
150 QString mainScript() const;
151
157 const Package *package() const;
158
162 KPluginInfo description() const;
163
164 bool isInitialized() const;
165 QRectF boundingRect() const;
166 DataEngine *dataEngine(const QString &name) const;
167 void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
168 void setTargetSizeHint(const QSizeF &targetSize);
169 void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
170 void render(const QString &sourceImagePath, const QSize &size,
171 Wallpaper::ResizeMethod resizeMethod = Plasma::Wallpaper::ScaledResize,
172 const QColor &color = QColor(0, 0, 0));
173 void setUsingRenderingCache(bool useCache);
174 bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
175 void insertIntoCache(const QString& key, const QImage &image);
176 void setContextualActions(const QList<QAction*> &actions);
177 void update(const QRectF &exposedArea);
178 void configNeedsSaving();
179
180protected Q_SLOTS:
181 virtual void renderCompleted(const QImage &image);
182 virtual void urlDropped(const KUrl &url);
183
184private:
185 WallpaperScriptPrivate *const d;
186};
187
188#define K_EXPORT_PLASMA_WALLPAPERSCRIPTENGINE(libname, classname) \
189K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
190K_EXPORT_PLUGIN(factory("plasma_wallpaperscriptengine_" #libname))
191
192} //Plasma namespace
193
194#endif
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition dataengine.h:59
Plasma::Package
object representing an installed Plasmagik package
Definition package.h:43
Plasma::ScriptEngine::ScriptEngine
ScriptEngine(QObject *parent=0)
Definition scriptengine.cpp:41
Plasma::Service
This class provides a generic API for write access to settings or services.
Definition service.h:92
Plasma::WallpaperScript::wallpaper
Wallpaper * wallpaper() const
Returns the Plasma::Wallpaper associated with this script component.
Definition wallpaperscript.cpp:54
Plasma::WallpaperScript::paint
virtual void paint(QPainter *painter, const QRectF &exposedRect)
This method is called when the wallpaper should be painted.
Definition wallpaperscript.cpp:82
Plasma::WallpaperScript::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Mouse move event.
Definition wallpaperscript.cpp:99
Plasma::WallpaperScript::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Mouse release event.
Definition wallpaperscript.cpp:109
Plasma::WallpaperScript::configNeedsSaving
void configNeedsSaving()
Definition wallpaperscript.cpp:214
Plasma::WallpaperScript::isInitialized
bool isInitialized() const
Definition wallpaperscript.cpp:127
Plasma::WallpaperScript::setResizeMethodHint
void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod)
Definition wallpaperscript.cpp:149
Plasma::WallpaperScript::insertIntoCache
void insertIntoCache(const QString &key, const QImage &image)
Definition wallpaperscript.cpp:193
Plasma::WallpaperScript::createConfigurationInterface
virtual QWidget * createConfigurationInterface(QWidget *parent)
Returns a widget that can be used to configure the options (if any) associated with this wallpaper.
Definition wallpaperscript.cpp:93
Plasma::WallpaperScript::renderCompleted
virtual void renderCompleted(const QImage &image)
Definition wallpaperscript.cpp:221
Plasma::WallpaperScript::description
KPluginInfo description() const
Definition wallpaperscript.cpp:71
Plasma::WallpaperScript::urlDropped
virtual void urlDropped(const KUrl &url)
Definition wallpaperscript.cpp:226
Plasma::WallpaperScript::dataEngine
DataEngine * dataEngine(const QString &name) const
Definition wallpaperscript.cpp:143
Plasma::WallpaperScript::update
void update(const QRectF &exposedArea)
Definition wallpaperscript.cpp:207
Plasma::WallpaperScript::render
void render(const QString &sourceImagePath, const QSize &size, Wallpaper::ResizeMethod resizeMethod=Plasma::Wallpaper::ScaledResize, const QColor &color=QColor(0, 0, 0))
Definition wallpaperscript.cpp:170
Plasma::WallpaperScript::setUsingRenderingCache
void setUsingRenderingCache(bool useCache)
Definition wallpaperscript.cpp:178
Plasma::WallpaperScript::initWallpaper
virtual void initWallpaper(const KConfigGroup &config)
This method is called once the wallpaper is loaded or mode is changed.
Definition wallpaperscript.cpp:77
Plasma::WallpaperScript::boundingRect
QRectF boundingRect() const
Definition wallpaperscript.cpp:135
Plasma::WallpaperScript::save
virtual void save(KConfigGroup &config)
This method is called when settings need to be saved.
Definition wallpaperscript.cpp:88
Plasma::WallpaperScript::package
const Package * package() const
Definition wallpaperscript.cpp:65
Plasma::WallpaperScript::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Mouse press event.
Definition wallpaperscript.cpp:104
Plasma::WallpaperScript::setConfigurationRequired
void setConfigurationRequired(bool needsConfiguring, const QString &reason=QString())
Definition wallpaperscript.cpp:163
Plasma::WallpaperScript::mainScript
QString mainScript() const
Definition wallpaperscript.cpp:59
Plasma::WallpaperScript::setTargetSizeHint
void setTargetSizeHint(const QSizeF &targetSize)
Definition wallpaperscript.cpp:156
Plasma::WallpaperScript::findInCache
bool findInCache(const QString &key, QImage &image, unsigned int lastModified=0)
Definition wallpaperscript.cpp:185
Plasma::WallpaperScript::setUrls
void setUrls(const KUrl::List urls)
Adds urls (e.g.
Definition wallpaperscript.cpp:119
Plasma::WallpaperScript::setWallpaper
void setWallpaper(Wallpaper *wallpaper)
Sets the Plasma::Wallpaper associated with this WallpaperScript.
Definition wallpaperscript.cpp:45
Plasma::WallpaperScript::WallpaperScript
WallpaperScript(QObject *parent=0)
Default constructor for a WallpaperScript.
Definition wallpaperscript.cpp:34
Plasma::WallpaperScript::setContextualActions
void setContextualActions(const QList< QAction * > &actions)
Definition wallpaperscript.cpp:200
Plasma::WallpaperScript::wheelEvent
virtual void wheelEvent(QGraphicsSceneWheelEvent *event)
Mouse wheel event.
Definition wallpaperscript.cpp:114
Plasma::Wallpaper
The base Wallpaper class.
Definition wallpaper.h:57
Plasma::Wallpaper::ResizeMethod
ResizeMethod
Various resize modes supported by the built in image renderer.
Definition wallpaper.h:74
Plasma::Wallpaper::ScaledResize
@ ScaledResize
Scales the image to fit the full area.
Definition wallpaper.h:75
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition abstractdialogmanager.cpp:25
plasma_export.h
scriptengine.h
wallpaper.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 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