Move pdf related header stuff to pdf_comic.h (and fix indentations in comic.h)

This commit is contained in:
Felix Kauselmann 2016-10-17 22:40:09 +02:00
parent dbada0bd3d
commit 98bccee00d
2 changed files with 60 additions and 51 deletions

View File

@ -7,30 +7,18 @@
#include <QMap>
#include "extract_delegate.h"
#include "bookmarks.h"
#ifdef Q_OS_MAC
#include "pdf_comic.h"
#else
#if QT_VERSION >= 0x050000
#include "poppler-qt5.h"
#else
#include "poppler-qt4.h"
#endif
#endif
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
{
Q_OBJECT
protected:
//Comic pages, one QPixmap for each file.
QVector<QByteArray> _pages;
QVector<bool> _loadedPages;
@ -88,7 +76,9 @@ class ComicDB;
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();
void removeBookmark();
@ -96,7 +86,9 @@ class ComicDB;
void checkIsBookmark(int index);
void updateBookmarkImage(int);
void setPageLoaded(int page);
signals:
void imagesLoaded();
void imageLoaded(int index);
void imageLoaded(int index,const QByteArray & image);
@ -110,15 +102,18 @@ class ComicDB;
void bookmarksUpdated();
void isCover();
void isLast();
};
class FileComic : public Comic, public ExtractDelegate
{
Q_OBJECT
private:
QList<QVector<quint32> > getSections(int & sectionIndex);
public:
FileComic();
FileComic(const QString & path, int atPage = -1);
~FileComic();
@ -128,29 +123,36 @@ class ComicDB;
void crcError(int index);
void unknownError(int index);
static QList<QString> filter(const QList<QString> & src);
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();
public slots:
void process();
};
class PDFComic : public Comic
{
Q_OBJECT
private:
//pdf
#ifdef Q_OS_MAC
@ -161,14 +163,18 @@ class ComicDB;
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();
};
@ -177,6 +183,4 @@ class ComicDB;
public:
static Comic * newComic(const QString & path);
};
#endif

View File

@ -4,6 +4,7 @@
#include <QObject>
#include <QImage>
#ifdef Q_OS_MAC
class MacOSXPDFComic
{
public:
@ -19,4 +20,8 @@ private:
void * lastPageData;
};
#else
#include "poppler-qt5.h"
#endif // Q_OS_MAC
#endif // PDF_COMIC_H