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

+15 -9
View File
@@ -2,10 +2,23 @@
#include "EntryImageProvider.h"
#include "backend/FormatReader.h"
#include "backend/formats/comic/ComicReader.h"
#include <QFileInfo>
#include <QQmlEngine>
FormatSpec FormatSpec::comic(const QString &ext, bool matchesDirectory, const QString &scheme,
SourceFactory makeSource)
{
return FormatSpec{
ext,
matchesDirectory,
scheme,
[makeSource, scheme] { return std::make_unique<ComicReader>(makeSource, scheme); },
makeSource
};
}
FormatRegistry::FormatRegistry(QVector<FormatSpec> specs)
: m_specs(std::move(specs))
{
@@ -30,14 +43,6 @@ std::unique_ptr<FormatReader> FormatRegistry::createReader(const QString &filePa
return spec ? spec->makeReader() : nullptr;
}
IImageProvider *FormatRegistry::createImageProvider(const QString &filePath) const
{
const FormatSpec *spec = specFor(filePath);
if (!spec || spec->scheme.isEmpty() || !spec->makeSource)
return nullptr;
return new EntryImageProvider(spec->makeSource, spec->scheme);
}
QStringList FormatRegistry::supportedExtensions() const
{
QStringList out;
@@ -49,8 +54,9 @@ QStringList FormatRegistry::supportedExtensions() const
void FormatRegistry::registerImageProviders(QQmlEngine &engine) const
{
for (const FormatSpec &spec : m_specs)
for (const FormatSpec &spec : m_specs) {
if (!spec.scheme.isEmpty() && spec.makeSource)
engine.addImageProvider(spec.scheme,
new EntryImageProvider(spec.makeSource, spec.scheme));
}
}