old render cleanup part 3

This commit is contained in:
Agel committed 2026-10-25 15:43:51 +01:00
1 parent cef762c3ee
commit 3faedd4251
45 files changed
+1057 -1135

No files matched your search

+3 -35
View File
@@ -1,9 +1,7 @@
#include "EntryImageProvider.h"
#include <QImage>
#include <QMutexLocker>
#include <QThreadPool>
#include <QUrl>
#include "AsyncImageResponse.h"
#include "ImageScaling.h"
@@ -36,20 +34,14 @@ EntryImageProvider::EntryImageProvider(SourceFactory sourceFactory, QString sche
QQuickImageResponse *EntryImageProvider::requestImageResponse(const QString &id,
const QSize &requestedSize)
{
QString sourcePath;
{
QMutexLocker lock(&m_mutex);
sourcePath = m_sourcePath;
}
// id may be "entry/name.jpg?src=<encoded-path>"
const ImageUrl::Parsed parsed = ImageUrl::parseProviderId(id);
const QString entryName = parsed.entry;
if (!parsed.sourcePath.isEmpty())
sourcePath = parsed.sourcePath;
const QString sourcePath = parsed.sourcePath;
auto *response = new AsyncImageResponse(
[factory = m_sourceFactory, sourcePath, entryName, requestedSize]() -> QImage {
if (sourcePath.isEmpty())
return {};
auto source = factory();
if (!source->open(sourcePath))
return {};
@@ -58,27 +50,3 @@ QQuickImageResponse *EntryImageProvider::requestImageResponse(const QString &id,
QThreadPool::globalInstance()->start(response);
return response;
}
void EntryImageProvider::setFilePath(const QString &filePath)
{
QMutexLocker lock(&m_mutex);
m_sourcePath = filePath;
}
QString EntryImageProvider::coverImageUrl(const QString &coverPath) const
{
QString sourcePath;
{ QMutexLocker lock(&m_mutex); sourcePath = m_sourcePath; }
return ImageUrl::build(m_scheme, coverPath, sourcePath);
}
QString EntryImageProvider::scheme() const
{
return m_scheme;
}
void EntryImageProvider::clear()
{
QMutexLocker lock(&m_mutex);
m_sourcePath.clear();
}