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>
This commit is contained in:
Berthold Stoeger 2018-05-09 23:08:44 +02:00 committed by Dirk Hohndel
parent b450c155fd
commit 19fa2966ef
3 changed files with 330 additions and 2 deletions

View file

@ -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.