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

Plasma

wallpaperscript.cpp
Go to the documentation of this file.
00001 /*
00002  *   Copyright 2009 by Aaron Seigo <aseigo@kde.org>
00003  *   Copyright 2009 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 #include "wallpaperscript.h"
00022 #include "private/wallpaper_p.h"
00023 #include "package.h"
00024 
00025 namespace Plasma
00026 {
00027 
00028 class WallpaperScriptPrivate
00029 {
00030 public:
00031     Wallpaper *wallpaper;
00032 };
00033 
00034 WallpaperScript::WallpaperScript(QObject *parent)
00035     : ScriptEngine(parent),
00036       d(new WallpaperScriptPrivate)
00037 {
00038 }
00039 
00040 WallpaperScript::~WallpaperScript()
00041 {
00042     delete d;
00043 }
00044 
00045 void WallpaperScript::setWallpaper(Wallpaper *wallpaper)
00046 {
00047     d->wallpaper = wallpaper;
00048     connect(wallpaper, SIGNAL(renderCompleted(const QImage&)),
00049             this, SLOT(renderCompleted(const QImage&)));
00050     connect(wallpaper, SIGNAL(urlDropped(const KUrl&)),
00051             this, SLOT(urlDropped(const KUrl&)));
00052 }
00053 
00054 Wallpaper *WallpaperScript::wallpaper() const
00055 {
00056     return d->wallpaper;
00057 }
00058 
00059 QString WallpaperScript::mainScript() const
00060 {
00061     Q_ASSERT(d->wallpaper);
00062     return d->wallpaper->package()->filePath("mainscript");
00063 }
00064 
00065 const Package *WallpaperScript::package() const
00066 {
00067     Q_ASSERT(d->wallpaper);
00068     return d->wallpaper->package();
00069 }
00070 
00071 KPluginInfo WallpaperScript::description() const
00072 {
00073     Q_ASSERT(d->wallpaper);
00074     return d->wallpaper->d->wallpaperDescription;
00075 }
00076 
00077 void WallpaperScript::initWallpaper(const KConfigGroup &config)
00078 {
00079     Q_UNUSED(config)
00080 }
00081 
00082 void WallpaperScript::paint(QPainter *painter, const QRectF &exposedRect)
00083 {
00084     Q_UNUSED(painter)
00085     Q_UNUSED(exposedRect)
00086 }
00087 
00088 void WallpaperScript::save(KConfigGroup &config)
00089 {
00090     Q_UNUSED(config)
00091 }
00092 
00093 QWidget *WallpaperScript::createConfigurationInterface(QWidget *parent)
00094 {
00095     Q_UNUSED(parent)
00096     return 0;
00097 }
00098 
00099 void WallpaperScript::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
00100 {
00101     Q_UNUSED(event)
00102 }
00103 
00104 void WallpaperScript::mousePressEvent(QGraphicsSceneMouseEvent *event)
00105 {
00106     Q_UNUSED(event)
00107 }
00108 
00109 void WallpaperScript::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
00110 {
00111     Q_UNUSED(event)
00112 }
00113 
00114 void WallpaperScript::wheelEvent(QGraphicsSceneWheelEvent *event)
00115 {
00116     Q_UNUSED(event)
00117 }
00118 
00119 void WallpaperScript::setUrls(const KUrl::List urls)
00120 {
00121     //TODO KDE5 replace urlDropped with addUrls
00122     foreach (const KUrl &url, urls) {
00123         urlDropped(url);
00124     }
00125 }
00126 
00127 bool WallpaperScript::isInitialized() const
00128 {
00129     if (d->wallpaper) {
00130         return d->wallpaper->isInitialized();
00131     }
00132     return false;
00133 }
00134 
00135 QRectF WallpaperScript::boundingRect() const
00136 {
00137     if (d->wallpaper) {
00138         return d->wallpaper->boundingRect();
00139     }
00140     return QRectF();
00141 }
00142 
00143 DataEngine *WallpaperScript::dataEngine(const QString &name) const
00144 {
00145     Q_ASSERT(d->wallpaper);
00146     return d->wallpaper->dataEngine(name);
00147 }
00148 
00149 void WallpaperScript::setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod)
00150 {
00151     if (d->wallpaper) {
00152         d->wallpaper->setResizeMethodHint(resizeMethod);
00153     }
00154 }
00155 
00156 void WallpaperScript::setTargetSizeHint(const QSizeF &targetSize)
00157 {
00158     if (d->wallpaper) {
00159         d->wallpaper->setTargetSizeHint(targetSize);
00160     }
00161 }
00162 
00163 void WallpaperScript::setConfigurationRequired(bool needsConfiguring, const QString &reason)
00164 {
00165     if (d->wallpaper) {
00166         d->wallpaper->setConfigurationRequired(needsConfiguring, reason);
00167     }
00168 }
00169 
00170 void WallpaperScript::render(const QString &sourceImagePath, const QSize &size,
00171         Wallpaper::ResizeMethod resizeMethod, const QColor &color)
00172 {
00173     if (d->wallpaper) {
00174         d->wallpaper->render(sourceImagePath, size, resizeMethod, color);
00175     }
00176 }
00177 
00178 void WallpaperScript::setUsingRenderingCache(bool useCache)
00179 {
00180     if (d->wallpaper) {
00181         d->wallpaper->setUsingRenderingCache(useCache);
00182     }
00183 }
00184 
00185 bool WallpaperScript::findInCache(const QString &key, QImage &image, unsigned int lastModified)
00186 {
00187     if (d->wallpaper) {
00188         return d->wallpaper->findInCache(key, image, lastModified);
00189     }
00190     return false;
00191 }
00192 
00193 void WallpaperScript::insertIntoCache(const QString& key, const QImage &image)
00194 {
00195     if (d->wallpaper) {
00196         d->wallpaper->insertIntoCache(key, image);
00197     }
00198 }
00199 
00200 void WallpaperScript::setContextualActions(const QList<QAction*> &actions)
00201 {
00202     if (d->wallpaper) {
00203         d->wallpaper->setContextualActions(actions);
00204     }
00205 }
00206 
00207 void WallpaperScript::update(const QRectF &exposedArea)
00208 {
00209     if (d->wallpaper) {
00210         d->wallpaper->update(exposedArea);
00211     }
00212 }
00213 
00214 void WallpaperScript::configNeedsSaving()
00215 {
00216     if (d->wallpaper) {
00217         d->wallpaper->configNeedsSaving();
00218     }
00219 }
00220 
00221 void WallpaperScript::renderCompleted(const QImage &image)
00222 {
00223     Q_UNUSED(image)
00224 }
00225 
00226 void WallpaperScript::urlDropped(const KUrl &url)
00227 {
00228     Q_UNUSED(url)
00229 }
00230 
00231 } // Plasma namespace
00232 
00233 #include "wallpaperscript.moc"

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