From 19fa2966efae211f210ef0a761040d8bf2b7edfb Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 9 May 2018 23:08:44 +0200 Subject: Dive pictures: Import camera icon Import a camera icon from the KDE breeze theme, which is licensed under the LGPL. Use this icon to display not-yet-loaded images in the photos tab and the profile. Source: https://github.com/KDE/breeze-icons Signed-off-by: Berthold Stoeger --- core/imagedownloader.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'core/imagedownloader.cpp') diff --git a/core/imagedownloader.cpp b/core/imagedownloader.cpp index cbff1489c..b56dd8b04 100644 --- a/core/imagedownloader.cpp +++ b/core/imagedownloader.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include @@ -140,8 +142,17 @@ QImage getHashedImage(const QString &file) return res; } -Thumbnailer::Thumbnailer() : failImage(QImage(":filter-close").scaled(maxThumbnailSize(), maxThumbnailSize(), Qt::KeepAspectRatio)), // TODO: Don't misuse filter close icon - dummyImage(QImage(":photo-icon").scaled(maxThumbnailSize(), maxThumbnailSize(), Qt::KeepAspectRatio)) // TODO: Don't misuse photo-icon +static QImage renderIcon(const char *id, int size) +{ + QImage res(size, size, QImage::Format_ARGB32); + QSvgRenderer svg{QString(id)}; + QPainter painter(&res); + svg.render(&painter); + return res; +} + +Thumbnailer::Thumbnailer() : failImage(renderIcon(":filter-close", maxThumbnailSize())), // TODO: Don't misuse filter close icon + dummyImage(renderIcon(":camera-icon", maxThumbnailSize())) { // Currently, we only process one image at a time. Stefan Fuchs reported problems when // calculating multiple thumbnails at once and this hopefully helps. -- cgit v1.2.3-70-g09d2