reintroduced epub support
This commit is contained in:
49 files changed
+5048
-205
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include "EntryImageProvider.h"
|
||||
#include "backend/FormatReader.h"
|
||||
#include "backend/formats/comic/ComicReader.h"
|
||||
#include "backend/formats/EpubReader.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QQmlEngine>
|
||||
@@ -19,6 +20,17 @@ FormatSpec FormatSpec::comic(const QString &ext, bool matchesDirectory, const QS
|
||||
};
|
||||
}
|
||||
|
||||
FormatSpec FormatSpec::epub(SourceFactory makeSource)
|
||||
{
|
||||
return FormatSpec{
|
||||
QStringLiteral("epub"),
|
||||
false,
|
||||
QStringLiteral("epub"),
|
||||
[makeSource] { return std::make_unique<EpubReader>(makeSource, QStringLiteral("epub")); },
|
||||
makeSource
|
||||
};
|
||||
}
|
||||
|
||||
FormatRegistry::FormatRegistry(QVector<FormatSpec> specs)
|
||||
: m_specs(std::move(specs))
|
||||
{
|
||||
@@ -43,6 +55,15 @@ std::unique_ptr<FormatReader> FormatRegistry::createReader(const QString &filePa
|
||||
return spec ? spec->makeReader() : nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<IByteSource> FormatRegistry::createByteSourceForScheme(const QString &scheme) const
|
||||
{
|
||||
for (const FormatSpec &spec : m_specs) {
|
||||
if (spec.scheme == scheme && spec.makeSource)
|
||||
return spec.makeSource();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QStringList FormatRegistry::supportedExtensions() const
|
||||
{
|
||||
QStringList out;
|
||||
|
||||
Reference in new issue
Block a user