mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -04:00
Move pdf related header stuff to pdf_comic.h (and fix indentations in comic.h)
This commit is contained in:
parent
dbada0bd3d
commit
98bccee00d
106
common/comic.h
106
common/comic.h
@ -7,30 +7,18 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
#include "extract_delegate.h"
|
#include "extract_delegate.h"
|
||||||
|
|
||||||
#include "bookmarks.h"
|
#include "bookmarks.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
|
|
||||||
#include "pdf_comic.h"
|
#include "pdf_comic.h"
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
#include "poppler-qt5.h"
|
|
||||||
#else
|
|
||||||
#include "poppler-qt4.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ComicDB;
|
class ComicDB;
|
||||||
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()
|
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()
|
||||||
//#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats()
|
//#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats()
|
||||||
class Comic : public QObject
|
class Comic : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//Comic pages, one QPixmap for each file.
|
//Comic pages, one QPixmap for each file.
|
||||||
QVector<QByteArray> _pages;
|
QVector<QByteArray> _pages;
|
||||||
QVector<bool> _loadedPages;
|
QVector<bool> _loadedPages;
|
||||||
@ -50,13 +38,13 @@ class ComicDB;
|
|||||||
bool _isPDF;
|
bool _isPDF;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static const QStringList imageExtensions;
|
||||||
|
static const QStringList literalImageExtensions;
|
||||||
|
static const QStringList comicExtensions;
|
||||||
|
static const QStringList literalComicExtensions;
|
||||||
|
|
||||||
static const QStringList imageExtensions;
|
Bookmarks * bm;
|
||||||
static const QStringList literalImageExtensions;
|
|
||||||
static const QStringList comicExtensions;
|
|
||||||
static const QStringList literalComicExtensions;
|
|
||||||
|
|
||||||
Bookmarks * bm;
|
|
||||||
|
|
||||||
//Constructors
|
//Constructors
|
||||||
Comic();
|
Comic();
|
||||||
@ -78,17 +66,19 @@ class ComicDB;
|
|||||||
//QPixmap * currentPage();
|
//QPixmap * currentPage();
|
||||||
bool loaded();
|
bool loaded();
|
||||||
//QPixmap * operator[](unsigned int index);
|
//QPixmap * operator[](unsigned int index);
|
||||||
QVector<QByteArray> * getRawData(){return &_pages;}
|
QVector<QByteArray> * getRawData(){return &_pages;}
|
||||||
QByteArray getRawPage(int page);
|
QByteArray getRawPage(int page);
|
||||||
bool pageIsLoaded(int page);
|
bool pageIsLoaded(int page);
|
||||||
|
|
||||||
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
||||||
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
||||||
|
|
||||||
static bool fileIsComic(const QString &path);
|
static bool fileIsComic(const QString &path);
|
||||||
static QList<QString> findValidComicFiles(const QList<QUrl> & list);
|
static QList<QString> findValidComicFiles(const QList<QUrl> & list);
|
||||||
static QList<QString> findValidComicFilesInFolder(const QString &path);
|
static QList<QString> findValidComicFilesInFolder(const QString &path);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void loadFinished();
|
void loadFinished();
|
||||||
void setBookmark();
|
void setBookmark();
|
||||||
void removeBookmark();
|
void removeBookmark();
|
||||||
@ -96,7 +86,9 @@ class ComicDB;
|
|||||||
void checkIsBookmark(int index);
|
void checkIsBookmark(int index);
|
||||||
void updateBookmarkImage(int);
|
void updateBookmarkImage(int);
|
||||||
void setPageLoaded(int page);
|
void setPageLoaded(int page);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void imagesLoaded();
|
void imagesLoaded();
|
||||||
void imageLoaded(int index);
|
void imageLoaded(int index);
|
||||||
void imageLoaded(int index,const QByteArray & image);
|
void imageLoaded(int index,const QByteArray & image);
|
||||||
@ -110,15 +102,18 @@ class ComicDB;
|
|||||||
void bookmarksUpdated();
|
void bookmarksUpdated();
|
||||||
void isCover();
|
void isCover();
|
||||||
void isLast();
|
void isLast();
|
||||||
|
};
|
||||||
};
|
|
||||||
|
|
||||||
class FileComic : public Comic, public ExtractDelegate
|
class FileComic : public Comic, public ExtractDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QVector<quint32> > getSections(int & sectionIndex);
|
|
||||||
|
QList<QVector<quint32> > getSections(int & sectionIndex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FileComic();
|
FileComic();
|
||||||
FileComic(const QString & path, int atPage = -1);
|
FileComic(const QString & path, int atPage = -1);
|
||||||
~FileComic();
|
~FileComic();
|
||||||
@ -128,55 +123,64 @@ class ComicDB;
|
|||||||
void crcError(int index);
|
void crcError(int index);
|
||||||
void unknownError(int index);
|
void unknownError(int index);
|
||||||
static QList<QString> filter(const QList<QString> & src);
|
static QList<QString> filter(const QList<QString> & src);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FolderComic : public Comic
|
class FolderComic : public Comic
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//void run();
|
//void run();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FolderComic();
|
FolderComic();
|
||||||
FolderComic(const QString & path, int atPage = -1);
|
FolderComic(const QString & path, int atPage = -1);
|
||||||
~FolderComic();
|
~FolderComic();
|
||||||
|
|
||||||
virtual bool load(const QString & path, int atPage = -1);
|
virtual bool load(const QString & path, int atPage = -1);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
};
|
||||||
|
|
||||||
};
|
class PDFComic : public Comic
|
||||||
|
{
|
||||||
class PDFComic : public Comic
|
Q_OBJECT
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
private:
|
private:
|
||||||
//pdf
|
//pdf
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
MacOSXPDFComic * pdfComic;
|
MacOSXPDFComic * pdfComic;
|
||||||
#else
|
#else
|
||||||
Poppler::Document * pdfComic;
|
Poppler::Document * pdfComic;
|
||||||
#endif
|
#endif
|
||||||
void renderPage(int page);
|
void renderPage(int page);
|
||||||
|
|
||||||
//void run();
|
//void run();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PDFComic();
|
PDFComic();
|
||||||
PDFComic(const QString & path, int atPage = -1);
|
PDFComic(const QString & path, int atPage = -1);
|
||||||
~PDFComic();
|
~PDFComic();
|
||||||
|
|
||||||
virtual bool load(const QString & path, int atPage = -1);
|
virtual bool load(const QString & path, int atPage = -1);
|
||||||
virtual bool load(const QString & path, const ComicDB & comic);
|
virtual bool load(const QString & path, const ComicDB & comic);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FactoryComic
|
class FactoryComic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Comic * newComic(const QString & path);
|
static Comic * newComic(const QString & path);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
|
@ -4,6 +4,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
class MacOSXPDFComic
|
class MacOSXPDFComic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -19,4 +20,8 @@ private:
|
|||||||
void * lastPageData;
|
void * lastPageData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
#include "poppler-qt5.h"
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
#endif // PDF_COMIC_H
|
#endif // PDF_COMIC_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user