Commit 102cb64b authored by Stefan Brüns's avatar Stefan Brüns
Browse files

[EBook Thumb] Load thumbnail from QIODevice instead of a temporary QByteArray

QImage can directly load from a QIODevice, while `loadFromData` wraps
the QByteArray into a QBuffer to have an QIODevice.
parent 5d0bc126
......@@ -192,7 +192,8 @@ bool EbookCreator::createEpub(const QString &path, QImage &image)
// Maybe we're lucky and the archive contains an iTunesArtwork file from iBooks
entry = zip.directory()->file(QStringLiteral("iTunesArtwork"));
if (entry) {
return image.loadFromData(entry->data());
zipDevice.reset(entry->createDevice());
return image.load(zipDevice.data(), "");
}
// Maybe there's a file called "cover" somewhere
......@@ -208,7 +209,8 @@ bool EbookCreator::createEpub(const QString &path, QImage &image)
continue;
}
if (image.loadFromData(entry->data())) {
zipDevice.reset(entry->createDevice());
if (image.load(zipDevice.data(), "")) {
return true;
}
}
......@@ -229,7 +231,8 @@ bool EbookCreator::createEpub(const QString &path, QImage &image)
// Finally, just load the cover image file
entry = zip.directory()->file(coverHref);
if (entry) {
return image.loadFromData(entry->data());
zipDevice.reset(entry->createDevice());
return image.load(zipDevice.data(), "");
}
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment