Add back history view cover photos

This commit is contained in:
Agel committed 2026-04-17 00:12:13 +02:00
1 parent 9e19a76a5a
commit 116fcdf7a4
11 files changed
+476 -28

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
#include "FileIconProvider.h"
#include <QFileIconProvider>
#include <QFileInfo>
#include <QIcon>
FileIconProvider::FileIconProvider()
: QQuickImageProvider(QQuickImageProvider::Image)
{}
QImage FileIconProvider::requestImage(const QString &id, QSize *size,
const QSize &requestedSize)
{
// QML strips the leading slash from the URL path component, so restore it on Unix.
QString filePath = id.startsWith(QLatin1Char('/')) ? id : QLatin1Char('/') + id;
QFileIconProvider iconProvider;
QIcon icon = iconProvider.icon(QFileInfo(filePath));
if (icon.isNull())
icon = iconProvider.icon(QFileIconProvider::File);
QSize target = (requestedSize.width() > 0 && requestedSize.height() > 0)
? requestedSize : QSize(60, 80);
QImage image = icon.pixmap(target).toImage();
if (size)
*size = image.size();
return image;
}