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

Plasma

  • plasma
  • scripting
wallpaperscript.cpp
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#include "wallpaperscript.h"
22#include "private/wallpaper_p.h"
23#include "package.h"
24
25namespace Plasma
26{
27
28class WallpaperScriptPrivate
29{
30public:
31 Wallpaper *wallpaper;
32};
33
34WallpaperScript::WallpaperScript(QObject *parent)
35 : ScriptEngine(parent),
36 d(new WallpaperScriptPrivate)
37{
38}
39
40WallpaperScript::~WallpaperScript()
41{
42 delete d;
43}
44
45void WallpaperScript::setWallpaper(Wallpaper *wallpaper)
46{
47 d->wallpaper = wallpaper;
48 connect(wallpaper, SIGNAL(renderCompleted(QImage)),
49 this, SLOT(renderCompleted(QImage)));
50 connect(wallpaper, SIGNAL(urlDropped(KUrl)),
51 this, SLOT(urlDropped(KUrl)));
52}
53
54Wallpaper *WallpaperScript::wallpaper() const
55{
56 return d->wallpaper;
57}
58
59QString WallpaperScript::mainScript() const
60{
61 Q_ASSERT(d->wallpaper);
62 return d->wallpaper->package()->filePath("mainscript");
63}
64
65const Package *WallpaperScript::package() const
66{
67 Q_ASSERT(d->wallpaper);
68 return d->wallpaper->package();
69}
70
71KPluginInfo WallpaperScript::description() const
72{
73 Q_ASSERT(d->wallpaper);
74 return d->wallpaper->d->wallpaperDescription;
75}
76
77void WallpaperScript::initWallpaper(const KConfigGroup &config)
78{
79 Q_UNUSED(config)
80}
81
82void WallpaperScript::paint(QPainter *painter, const QRectF &exposedRect)
83{
84 Q_UNUSED(painter)
85 Q_UNUSED(exposedRect)
86}
87
88void WallpaperScript::save(KConfigGroup &config)
89{
90 Q_UNUSED(config)
91}
92
93QWidget *WallpaperScript::createConfigurationInterface(QWidget *parent)
94{
95 Q_UNUSED(parent)
96 return 0;
97}
98
99void WallpaperScript::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
100{
101 Q_UNUSED(event)
102}
103
104void WallpaperScript::mousePressEvent(QGraphicsSceneMouseEvent *event)
105{
106 Q_UNUSED(event)
107}
108
109void WallpaperScript::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
110{
111 Q_UNUSED(event)
112}
113
114void WallpaperScript::wheelEvent(QGraphicsSceneWheelEvent *event)
115{
116 Q_UNUSED(event)
117}
118
119void WallpaperScript::setUrls(const KUrl::List urls)
120{
121 //TODO KDE5 replace urlDropped with addUrls
122 foreach (const KUrl &url, urls) {
123 urlDropped(url);
124 }
125}
126
127bool WallpaperScript::isInitialized() const
128{
129 if (d->wallpaper) {
130 return d->wallpaper->isInitialized();
131 }
132 return false;
133}
134
135QRectF WallpaperScript::boundingRect() const
136{
137 if (d->wallpaper) {
138 return d->wallpaper->boundingRect();
139 }
140 return QRectF();
141}
142
143DataEngine *WallpaperScript::dataEngine(const QString &name) const
144{
145 Q_ASSERT(d->wallpaper);
146 return d->wallpaper->dataEngine(name);
147}
148
149void WallpaperScript::setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod)
150{
151 if (d->wallpaper) {
152 d->wallpaper->setResizeMethodHint(resizeMethod);
153 }
154}
155
156void WallpaperScript::setTargetSizeHint(const QSizeF &targetSize)
157{
158 if (d->wallpaper) {
159 d->wallpaper->setTargetSizeHint(targetSize);
160 }
161}
162
163void WallpaperScript::setConfigurationRequired(bool needsConfiguring, const QString &reason)
164{
165 if (d->wallpaper) {
166 d->wallpaper->setConfigurationRequired(needsConfiguring, reason);
167 }
168}
169
170void WallpaperScript::render(const QString &sourceImagePath, const QSize &size,
171 Wallpaper::ResizeMethod resizeMethod, const QColor &color)
172{
173 if (d->wallpaper) {
174 d->wallpaper->render(sourceImagePath, size, resizeMethod, color);
175 }
176}
177
178void WallpaperScript::setUsingRenderingCache(bool useCache)
179{
180 if (d->wallpaper) {
181 d->wallpaper->setUsingRenderingCache(useCache);
182 }
183}
184
185bool WallpaperScript::findInCache(const QString &key, QImage &image, unsigned int lastModified)
186{
187 if (d->wallpaper) {
188 return d->wallpaper->findInCache(key, image, lastModified);
189 }
190 return false;
191}
192
193void WallpaperScript::insertIntoCache(const QString& key, const QImage &image)
194{
195 if (d->wallpaper) {
196 d->wallpaper->insertIntoCache(key, image);
197 }
198}
199
200void WallpaperScript::setContextualActions(const QList<QAction*> &actions)
201{
202 if (d->wallpaper) {
203 d->wallpaper->setContextualActions(actions);
204 }
205}
206
207void WallpaperScript::update(const QRectF &exposedArea)
208{
209 if (d->wallpaper) {
210 d->wallpaper->update(exposedArea);
211 }
212}
213
214void WallpaperScript::configNeedsSaving()
215{
216 if (d->wallpaper) {
217 d->wallpaper->configNeedsSaving();
218 }
219}
220
221void WallpaperScript::renderCompleted(const QImage &image)
222{
223 Q_UNUSED(image)
224}
225
226void WallpaperScript::urlDropped(const KUrl &url)
227{
228 Q_UNUSED(url)
229}
230
231} // Plasma namespace
232
233#include "wallpaperscript.moc"
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
The base class for scripting interfaces to be used in loading plasmoids of a given language.
Definition: scriptengine.h:66
Plasma::WallpaperScript::wallpaper
Wallpaper * wallpaper() const
Returns the Plasma::Wallpaper associated with this script component.
Definition: wallpaperscript.cpp:54
Plasma::WallpaperScript::renderCompleted
virtual void renderCompleted(const QImage &image)
Definition: wallpaperscript.cpp:221
Plasma::WallpaperScript::urlDropped
virtual void urlDropped(const KUrl &url)
Definition: wallpaperscript.cpp:226
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
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
package.h
wallpaperscript.h
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