summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-05-09 23:08:44 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-05-13 13:52:35 -0700
commit19fa2966efae211f210ef0a761040d8bf2b7edfb (patch)
tree4ecc1ed6de22497d9b097d3387594b1914ad230b /core
parentb450c155fd78e304f07549c35667dc4e6349ec32 (diff)
downloadsubsurface-19fa2966efae211f210ef0a761040d8bf2b7edfb.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
-rw-r--r--core/imagedownloader.cpp15
1 files changed, 13 insertions, 2 deletions
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 <QString>
#include <QImageReader>
#include <QDataStream>
+#include <QSvgRenderer>
+#include <QPainter>
#include <QtConcurrent>
@@ -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.