Add support for poppler-qt6

Fixes #352
This commit is contained in:
Felix Kauselmann
2022-11-13 17:05:29 +01:00
parent be85954b0c
commit 4a59dd6db6
6 changed files with 38 additions and 14 deletions

View File

@ -808,8 +808,13 @@ void PDFComic::process()
return;
}
#else
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
pdfComic = Poppler::Document::load(_path);
#else
auto _pdfComic = Poppler::Document::load(_path);
pdfComic = std::unique_ptr<Poppler::Document>(_pdfComic);
#endif
if (!pdfComic) {
moveToThread(QCoreApplication::instance()->thread());
@ -877,7 +882,7 @@ void PDFComic::renderPage(int page)
QImage img = pdfComic->getPage(page);
if (!img.isNull()) {
#else
std::unique_ptr<Poppler::Page> pdfpage (pdfComic->page(page));
std::unique_ptr<Poppler::Page> pdfpage(pdfComic->page(page));
if (pdfpage) {
QImage img = pdfpage->renderToImage(150, 150);
#endif

View File

@ -12,7 +12,7 @@
#include "pdf_comic.h"
#endif // NO_PDF
class ComicDB;
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()
//#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats()
class Comic : public QObject
{
@ -172,6 +172,7 @@ private:
std::unique_ptr<Poppler::Document> pdfComic;
#endif
void renderPage(int page);
// void run();
public:

View File

@ -5,6 +5,7 @@
#include <QImage>
#include <QFile>
#include <QMutex>
#include <QtGlobal>
#if defined Q_OS_MAC && defined USE_PDFKIT
class MacOSXPDFComic
@ -45,6 +46,10 @@ private:
QFile pdfFile;
};
#else
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <poppler-qt6.h>
#else
#include "poppler-qt5.h"
#endif // QT_VERSION
#endif // Q_OS_MAC
#endif // PDF_COMIC_H