mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add no_pdf build option
This commit is contained in:
parent
36ef664d65
commit
464a3b6649
@ -58,16 +58,22 @@ win32 {
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
!CONFIG(pdfium){
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
} else {
|
||||
DEFINES += "USE_PDFIUM"
|
||||
INCLUDEPATH += /usr/include/pdfium
|
||||
LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
|
||||
-lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
|
||||
-lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
|
||||
-lfxedit -Wl,--end-group -lfreetype
|
||||
!CONFIG(no_pdf){
|
||||
!CONFIG(pdfium){
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
} else {
|
||||
#static pdfium libraries have to be included *before* dynamic libraries
|
||||
DEFINES += "USE_PDFIUM"
|
||||
INCLUDEPATH += /usr/include/pdfium
|
||||
LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
|
||||
-lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
|
||||
-lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
|
||||
-lfxedit -Wl,--end-group -lfreetype
|
||||
}
|
||||
}
|
||||
else {
|
||||
DEFINES += "NO_PDF"
|
||||
}
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
|
@ -46,18 +46,23 @@ win32 {
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
!CONFIG(pdfium) {
|
||||
!CONFIG(no_pdf){
|
||||
!CONFIG(pdfium){
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
else {
|
||||
DEFINES += "USE_PDFIUM"
|
||||
INCLUDEPATH += /usr/include/pdfium
|
||||
LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
|
||||
} else {
|
||||
#static pdfium libraries have to be included *before* dynamic libraries
|
||||
DEFINES += "USE_PDFIUM"
|
||||
INCLUDEPATH += /usr/include/pdfium
|
||||
LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
|
||||
-lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
|
||||
-lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
|
||||
-lfxedit -Wl,--end-group -lfreetype
|
||||
}
|
||||
}
|
||||
else {
|
||||
DEFINES += "NO_PDF"
|
||||
}
|
||||
|
||||
!CONFIG(no_opengl) {
|
||||
LIBS += -lGLU
|
||||
|
@ -579,7 +579,7 @@ void ThumbnailCreator::create()
|
||||
QLOG_WARN() << "Extracting cover: file not found " << _fileSource;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NO_PDF
|
||||
if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
#if defined Q_OS_MAC && defined USE_PDFKIT
|
||||
@ -632,7 +632,7 @@ void ThumbnailCreator::create()
|
||||
#endif
|
||||
#else
|
||||
QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72);
|
||||
#endif
|
||||
#endif //
|
||||
_cover = p;
|
||||
if(_target!="")
|
||||
{
|
||||
@ -656,78 +656,77 @@ void ThumbnailCreator::create()
|
||||
}
|
||||
delete pdfComic;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif //NO_PDF
|
||||
|
||||
if(crash)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CompressedArchive archive(_fileSource);
|
||||
if(!archive.toolsLoaded())
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: 7z lib not loaded";
|
||||
crash = true;
|
||||
return;
|
||||
}
|
||||
if(!archive.isValid())
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource;
|
||||
}
|
||||
//se filtran para obtener sólo los formatos soportados
|
||||
QList<QString> order = archive.getFileNames();
|
||||
QList<QString> fileNames = FileComic::filter(order);
|
||||
_numPages = fileNames.size();
|
||||
if(_numPages == 0)
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: empty comic " << _fileSource;
|
||||
_cover.load(":/images/notCover.png");
|
||||
if(_target!="")
|
||||
{
|
||||
_cover.save(_target);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_coverPage > _numPages)
|
||||
{
|
||||
_coverPage = 1;
|
||||
}
|
||||
qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI);
|
||||
int index = order.indexOf(fileNames.at(_coverPage-1));
|
||||
|
||||
if(crash)
|
||||
if(_target=="")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CompressedArchive archive(_fileSource);
|
||||
if(!archive.toolsLoaded())
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: 7z lib not loaded";
|
||||
crash = true;
|
||||
return;
|
||||
}
|
||||
if(!archive.isValid())
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: file format not supported " << _fileSource;
|
||||
}
|
||||
//se filtran para obtener sólo los formatos soportados
|
||||
QList<QString> order = archive.getFileNames();
|
||||
QList<QString> fileNames = FileComic::filter(order);
|
||||
_numPages = fileNames.size();
|
||||
if(_numPages == 0)
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: empty comic " << _fileSource;
|
||||
_cover.load(":/images/notCover.png");
|
||||
if(_target!="")
|
||||
if(!_cover.loadFromData(archive.getRawDataAtIndex(index)))
|
||||
{
|
||||
_cover.save(_target);
|
||||
QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource;
|
||||
_cover.load(":/images/notCover.png");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_coverPage > _numPages)
|
||||
QImage p;
|
||||
if(p.loadFromData(archive.getRawDataAtIndex(index)))
|
||||
{
|
||||
_coverPage = 1;
|
||||
}
|
||||
qSort(fileNames.begin(),fileNames.end(), naturalSortLessThanCI);
|
||||
int index = order.indexOf(fileNames.at(_coverPage-1));
|
||||
|
||||
if(_target=="")
|
||||
{
|
||||
if(!_cover.loadFromData(archive.getRawDataAtIndex(index)))
|
||||
QImage scaled;
|
||||
if(p.width()>p.height()) //landscape??
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource;
|
||||
_cover.load(":/images/notCover.png");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QImage p;
|
||||
if(p.loadFromData(archive.getRawDataAtIndex(index)))
|
||||
{
|
||||
QImage scaled;
|
||||
if(p.width()>p.height()) //landscape??
|
||||
{
|
||||
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
||||
}
|
||||
else
|
||||
{
|
||||
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
||||
}
|
||||
scaled.save(_target,0,75);
|
||||
scaled = p.scaledToWidth(640,Qt::SmoothTransformation);
|
||||
}
|
||||
else
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource;
|
||||
//p.load(":/images/notCover.png");
|
||||
//p.save(_target);
|
||||
scaled = p.scaledToWidth(480,Qt::SmoothTransformation);
|
||||
}
|
||||
scaled.save(_target,0,75);
|
||||
}
|
||||
else
|
||||
{
|
||||
QLOG_WARN() << "Extracting cover: unable to load image from extracted cover " << _fileSource;
|
||||
//p.load(":/images/notCover.png");
|
||||
//p.save(_target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,20 @@ const QStringList Comic::imageExtensions = QStringList() << "*.jpg" << "*.jpeg"
|
||||
const QStringList Comic::literalImageExtensions = QStringList() << "jpg" << "jpeg" << "png" << "gif" << "tiff" << "tif" << "bmp" << "webp";
|
||||
|
||||
#ifndef use_unarr
|
||||
const QStringList Comic::comicExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.7z" << "*.cb7" << "*.arj" << "*.cbt";
|
||||
const QStringList Comic::literalComicExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "7z" << "cb7" << "arj" << "cbt";
|
||||
const QStringList ComicArchiveExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.7z" << "*.cb7" << "*.arj" << "*.cbt";
|
||||
const QStringList LiteralComicArchiveExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "7z" << "cb7" << "arj" << "cbt";
|
||||
#else
|
||||
const QStringList Comic::comicExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.cbt";
|
||||
const QStringList Comic::literalComicExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "cbt";
|
||||
#endif
|
||||
const QStringList ComicArchiveExtensions = QStringList() << "*.cbr" << "*.cbz" << "*.rar" << "*.zip" << "*.tar" << "*.pdf" << "*.cbt";
|
||||
const QStringList LiteralComicArchiveExtensions = QStringList() << "cbr" << "cbz" << "rar" << "zip" << "tar" << "pdf" << "cbt";
|
||||
#endif //use_unarr
|
||||
#ifndef NO_PDF
|
||||
const QStringList Comic::comicExtensions = QStringList() << ComicArchiveExtensions << "*.pdf";
|
||||
const QStringList Comic::literalComicExtensions = QStringList() << LiteralComicArchiveExtensions << "pdf";
|
||||
#else
|
||||
const QStringList Comic::comicExtensions = QStringList() << ComicArchiveExtensions << "*.pdf";
|
||||
const QStringList Comic::literalComicExtensions = QStringList() << LiteralComicArchiveExtensions << "pdf";
|
||||
#endif //NO_PDF
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::Comic()
|
||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false)
|
||||
@ -701,6 +709,8 @@ void FolderComic::process()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef NO_PDF
|
||||
|
||||
PDFComic::PDFComic()
|
||||
:Comic()
|
||||
{
|
||||
@ -872,6 +882,8 @@ void PDFComic::renderPage(int page)
|
||||
}
|
||||
}
|
||||
|
||||
#endif //NO_PDF
|
||||
|
||||
Comic * FactoryComic::newComic(const QString & path)
|
||||
{
|
||||
|
||||
@ -879,7 +891,8 @@ Comic * FactoryComic::newComic(const QString & path)
|
||||
if(fi.exists())
|
||||
{
|
||||
if(fi.isFile())
|
||||
{
|
||||
{
|
||||
#ifndef NO_PDF
|
||||
if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return new PDFComic();
|
||||
@ -888,6 +901,9 @@ Comic * FactoryComic::newComic(const QString & path)
|
||||
{
|
||||
return new FileComic();
|
||||
}
|
||||
#else
|
||||
return new FileComic();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8,8 +8,9 @@
|
||||
|
||||
#include "extract_delegate.h"
|
||||
#include "bookmarks.h"
|
||||
#ifndef NO_PDF
|
||||
#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()
|
||||
@ -149,6 +150,7 @@ class FolderComic : public Comic
|
||||
void process();
|
||||
};
|
||||
|
||||
#ifndef NO_PDF
|
||||
class PDFComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -179,7 +181,7 @@ class PDFComic : public Comic
|
||||
|
||||
void process();
|
||||
};
|
||||
|
||||
#endif //NO_PDF
|
||||
class FactoryComic
|
||||
{
|
||||
public:
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "comic.h"
|
||||
#include "pdf_comic.h"
|
||||
#ifdef USE_PDFIUM
|
||||
#if defined USE_PDFIUM && !defined NO_PDF
|
||||
PdfiumComic::PdfiumComic()
|
||||
{
|
||||
FPDF_InitLibrary();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef PDF_COMIC_H
|
||||
#if !defined PDF_COMIC_H && !defined NO_PDF
|
||||
#define PDF_COMIC_H
|
||||
|
||||
#include <QObject>
|
||||
|
Loading…
Reference in New Issue
Block a user