mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 07:24:58 -04:00
Merge - 9.0.0 release
This commit is contained in:
134
common/comic.h
134
common/comic.h
@ -7,30 +7,19 @@
|
||||
#include <QMap>
|
||||
|
||||
#include "extract_delegate.h"
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
#ifndef NO_PDF
|
||||
#include "pdf_comic.h"
|
||||
|
||||
#else
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include "poppler-qt5.h"
|
||||
#else
|
||||
#include "poppler-qt4.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#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
|
||||
{
|
||||
class Comic : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
|
||||
//Comic pages, one QPixmap for each file.
|
||||
QVector<QByteArray> _pages;
|
||||
QVector<bool> _loadedPages;
|
||||
@ -49,14 +38,16 @@ class ComicDB;
|
||||
|
||||
bool _isPDF;
|
||||
|
||||
bool _invalidated;
|
||||
|
||||
public:
|
||||
|
||||
static const QStringList imageExtensions;
|
||||
static const QStringList literalImageExtensions;
|
||||
static const QStringList comicExtensions;
|
||||
static const QStringList literalComicExtensions;
|
||||
|
||||
static const QStringList imageExtensions;
|
||||
static const QStringList literalImageExtensions;
|
||||
static const QStringList comicExtensions;
|
||||
static const QStringList literalComicExtensions;
|
||||
|
||||
Bookmarks * bm;
|
||||
Bookmarks * bm;
|
||||
|
||||
//Constructors
|
||||
Comic();
|
||||
@ -78,16 +69,17 @@ class ComicDB;
|
||||
//QPixmap * currentPage();
|
||||
bool loaded();
|
||||
//QPixmap * operator[](unsigned int index);
|
||||
QVector<QByteArray> * getRawData(){return &_pages;}
|
||||
QVector<QByteArray> * getRawData(){return &_pages;}
|
||||
QByteArray getRawPage(int page);
|
||||
bool pageIsLoaded(int page);
|
||||
|
||||
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
||||
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
||||
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
||||
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
||||
|
||||
static bool fileIsComic(const QString &path);
|
||||
static QList<QString> findValidComicFiles(const QList<QUrl> & list);
|
||||
static QList<QString> findValidComicFilesInFolder(const QString &path);
|
||||
static bool fileIsComic(const QString &path);
|
||||
static QList<QString> findValidComicFiles(const QList<QUrl> & list);
|
||||
static QList<QString> findValidComicFilesInFolder(const QString &path);
|
||||
|
||||
public slots:
|
||||
void loadFinished();
|
||||
void setBookmark();
|
||||
@ -96,7 +88,11 @@ class ComicDB;
|
||||
void checkIsBookmark(int index);
|
||||
void updateBookmarkImage(int);
|
||||
void setPageLoaded(int page);
|
||||
void invalidate();
|
||||
|
||||
signals:
|
||||
void invalidated();
|
||||
void destroyed();
|
||||
void imagesLoaded();
|
||||
void imageLoaded(int index);
|
||||
void imageLoaded(int index,const QByteArray & image);
|
||||
@ -110,73 +106,91 @@ class ComicDB;
|
||||
void bookmarksUpdated();
|
||||
void isCover();
|
||||
void isLast();
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
class FileComic : public Comic, public ExtractDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
class FileComic : public Comic, public ExtractDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QList<QVector<quint32> > getSections(int & sectionIndex);
|
||||
|
||||
QList<QVector<quint32> > getSections(int & sectionIndex);
|
||||
|
||||
public:
|
||||
|
||||
FileComic();
|
||||
FileComic(const QString & path, int atPage = -1);
|
||||
~FileComic();
|
||||
void fileExtracted(int index, const QByteArray & rawData);
|
||||
virtual bool load(const QString & path, int atPage = -1);
|
||||
virtual bool load(const QString & path, const ComicDB & comic);
|
||||
static QList<QString> filter(const QList<QString> & src);
|
||||
|
||||
//ExtractDelegate
|
||||
void fileExtracted(int index, const QByteArray & rawData);
|
||||
void crcError(int index);
|
||||
void unknownError(int index);
|
||||
static QList<QString> filter(const QList<QString> & src);
|
||||
public slots:
|
||||
void process();
|
||||
};
|
||||
bool isCancelled();
|
||||
|
||||
class FolderComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
public slots:
|
||||
|
||||
void process();
|
||||
};
|
||||
|
||||
class FolderComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
//void run();
|
||||
|
||||
public:
|
||||
|
||||
FolderComic();
|
||||
FolderComic(const QString & path, int atPage = -1);
|
||||
~FolderComic();
|
||||
|
||||
virtual bool load(const QString & path, int atPage = -1);
|
||||
|
||||
public slots:
|
||||
|
||||
void process();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class PDFComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
#ifndef NO_PDF
|
||||
class PDFComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
//pdf
|
||||
#ifdef Q_OS_MAC
|
||||
MacOSXPDFComic * pdfComic;
|
||||
#else
|
||||
#if defined Q_OS_MAC && defined USE_PDFKIT
|
||||
MacOSXPDFComic * pdfComic;
|
||||
#elif defined USE_PDFIUM
|
||||
PdfiumComic * pdfComic;
|
||||
#else
|
||||
Poppler::Document * pdfComic;
|
||||
#endif
|
||||
#endif
|
||||
void renderPage(int page);
|
||||
|
||||
//void run();
|
||||
|
||||
public:
|
||||
|
||||
PDFComic();
|
||||
PDFComic(const QString & path, int atPage = -1);
|
||||
~PDFComic();
|
||||
|
||||
virtual bool load(const QString & path, int atPage = -1);
|
||||
virtual bool load(const QString & path, const ComicDB & comic);
|
||||
|
||||
public slots:
|
||||
|
||||
void process();
|
||||
};
|
||||
|
||||
class FactoryComic
|
||||
{
|
||||
};
|
||||
#endif //NO_PDF
|
||||
class FactoryComic
|
||||
{
|
||||
public:
|
||||
static Comic * newComic(const QString & path);
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user