From bb5a57bc26a9d5cbcc26668e86a8b6e409d1ea9b Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 2 Apr 2009 17:21:42 +0000 Subject: [PATCH] we can't queue signals with our own enum type, but since this is all internal to the lib and doesn't ever escape into the public API, just pass it around as an int. svn path=/trunk/KDE/kdelibs/; revision=948269 --- private/wallpaperrenderthread_p.h | 2 +- wallpaper.cpp | 18 +++++++++++------- wallpaper.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/private/wallpaperrenderthread_p.h b/private/wallpaperrenderthread_p.h index 93cbd876b..201ae68a5 100644 --- a/private/wallpaperrenderthread_p.h +++ b/private/wallpaperrenderthread_p.h @@ -49,7 +49,7 @@ public: Q_SIGNALS: void done(int token, const QImage &pixmap, const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color); + int resizeMethod, const QColor &color); protected: virtual void run(); diff --git a/wallpaper.cpp b/wallpaper.cpp index 81e052a7e..5205891a7 100644 --- a/wallpaper.cpp +++ b/wallpaper.cpp @@ -52,12 +52,12 @@ public: }; QString cachePath(const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color) const; + int resizeMethod, const QColor &color) const; void renderCompleted(int token, const QImage &image, const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color); + int resizeMethod, const QColor &color); static WallpaperRenderThread s_renderer; static PackageStructure::Ptr packageStructure; @@ -88,8 +88,8 @@ Wallpaper::Wallpaper(QObject *parentObject, const QVariantList &args) } setParent(parentObject); - connect(&WallpaperPrivate::s_renderer, SIGNAL(done(int,QImage,QString,QSize,Wallpaper::ResizeMethod,QColor)), - this, SLOT(renderCompleted(int,QImage,QString,QSize,Wallpaper::ResizeMethod,QColor))); + connect(&WallpaperPrivate::s_renderer, SIGNAL(done(int,QImage,QString,QSize,int,QColor)), + this, SLOT(renderCompleted(int,QImage,QString,QSize,int,QColor))); } Wallpaper::~Wallpaper() @@ -315,13 +315,14 @@ void Wallpaper::render(const QString &sourceImagePath, const QSize &size, Wallpaper::ResizeMethod resizeMethod, const QColor &color) { if (sourceImagePath.isEmpty() || !QFile::exists(sourceImagePath)) { + //kDebug() << "failed on:" << sourceImagePath; return; } if (d->cacheRendering) { QString cache = d->cachePath(sourceImagePath, size, resizeMethod, color); if (QFile::exists(cache)) { - kDebug() << "loading cached wallpaper from" << cache; + //kDebug() << "loading cached wallpaper from" << cache; QImage img(cache); emit renderCompleted(img); return; @@ -329,10 +330,11 @@ void Wallpaper::render(const QString &sourceImagePath, const QSize &size, } d->renderToken = WallpaperPrivate::s_renderer.render(sourceImagePath, size, resizeMethod, color); + //kDebug() << "rendering" << sourceImagePath << ", token is" << d->renderToken; } QString WallpaperPrivate::cachePath(const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color) const + int resizeMethod, const QColor &color) const { const QString id = QString("plasma-wallpapers/%5_%3_%4_%1x%2.png") .arg(size.width()).arg(size.height()).arg(color.name()) @@ -342,9 +344,10 @@ QString WallpaperPrivate::cachePath(const QString &sourceImagePath, const QSize void WallpaperPrivate::renderCompleted(int token, const QImage &image, const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color) + int resizeMethod, const QColor &color) { if (token != renderToken) { + //kDebug() << "render token mismatch" << token << renderToken; return; } @@ -352,6 +355,7 @@ void WallpaperPrivate::renderCompleted(int token, const QImage &image, image.save(cachePath(sourceImagePath, size, resizeMethod, color)); } + //kDebug() << "rendering complete!"; emit q->renderCompleted(image); } diff --git a/wallpaper.h b/wallpaper.h index 350d34187..089944b6e 100644 --- a/wallpaper.h +++ b/wallpaper.h @@ -356,7 +356,7 @@ class PLASMA_EXPORT Wallpaper : public QObject private: Q_PRIVATE_SLOT(d, void renderCompleted(int token, const QImage &image, const QString &sourceImagePath, const QSize &size, - Wallpaper::ResizeMethod resizeMethod, const QColor &color)) + int resizeMethod, const QColor &color)) friend class WallpaperPrivate; WallpaperPrivate *const d;