mirror of
https://github.com/YACReader/yacreader
synced 2025-07-22 15:04:40 -04:00
Modificada la clase Comic por una jerarqu?a y una factory
corregido bug en go_to_flow_gl
This commit is contained in:
@ -10,10 +10,10 @@
|
||||
|
||||
#include "poppler-qt4.h"
|
||||
|
||||
class Comic : public QThread
|
||||
class Comic : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
protected:
|
||||
//Comic pages, one QPixmap for each file.
|
||||
QVector<QByteArray> _pages;
|
||||
QVector<bool> _loadedPages;
|
||||
@ -24,26 +24,25 @@
|
||||
int _index;
|
||||
QString _path;
|
||||
bool _loaded;
|
||||
QProcess * _7z;
|
||||
QProcess * _7ze;
|
||||
|
||||
int _cfi;
|
||||
QString _pathDir;
|
||||
|
||||
Bookmarks * bm;
|
||||
void run();
|
||||
//pdf
|
||||
Poppler::Document * pdfComic;
|
||||
|
||||
|
||||
bool _isPDF;
|
||||
public:
|
||||
//Constructors
|
||||
Comic();
|
||||
Comic(const QString pathFile);
|
||||
Comic(const QString & pathFile);
|
||||
~Comic();
|
||||
void setup();
|
||||
//Load pages from file
|
||||
bool load(const QString & path);
|
||||
void loadFromFile(const QString & pathFile);
|
||||
virtual bool load(const QString & path) = 0;
|
||||
|
||||
/*void loadFromFile(const QString & pathFile);
|
||||
void loadFromDir(const QString & pathDir);
|
||||
void loadFromPDF(const QString & pathPDF);
|
||||
void loadFromPDF(const QString & pathPDF);*/
|
||||
int nextPage();
|
||||
int previousPage();
|
||||
void setIndex(unsigned int index);
|
||||
@ -57,9 +56,6 @@
|
||||
bool pageIsLoaded(int page);
|
||||
|
||||
public slots:
|
||||
void loadImages();
|
||||
void loadSizes();
|
||||
void openingError(QProcess::ProcessError error);
|
||||
void loadFinished();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
@ -79,69 +75,64 @@
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Comic2 : public QObject
|
||||
class FileComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//Comic pages, one QPixmap for each file.
|
||||
QVector<QByteArray> _pages;
|
||||
QVector<bool> _loadedPages;
|
||||
QVector<uint> _sizes;
|
||||
QStringList _fileNames;
|
||||
QMap<QString,int> _newOrder;
|
||||
QVector<QString> _order;
|
||||
int _index;
|
||||
QString _path;
|
||||
bool _loaded;
|
||||
QProcess * _7z;
|
||||
QProcess * _7ze;
|
||||
int _cfi;
|
||||
QString _pathDir;
|
||||
|
||||
public:
|
||||
//Constructors
|
||||
Comic2();
|
||||
Comic2(const QString pathFile);
|
||||
~Comic2();
|
||||
void setup();
|
||||
//Load pages from file
|
||||
bool load(const QString & path);
|
||||
void loadFromFile(const QString & pathFile);
|
||||
int nextPage();
|
||||
int previousPage();
|
||||
void setIndex(unsigned int index);
|
||||
unsigned int getIndex(){return _index;};
|
||||
unsigned int numPages(){return _pages.size();}
|
||||
QPixmap * currentPage();
|
||||
bool loaded();
|
||||
QPixmap * operator[](unsigned int index);
|
||||
QVector<QByteArray> * getRawData(){return &_pages;};
|
||||
QByteArray getRawPage(int page);
|
||||
bool pageIsLoaded(int page);
|
||||
FileComic();
|
||||
FileComic(const QString & path);
|
||||
~FileComic();
|
||||
|
||||
public slots:
|
||||
void loadImages();
|
||||
void loadSizes();
|
||||
void openingError(QProcess::ProcessError error);
|
||||
void loadFinished();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
void saveBookmarks();
|
||||
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);
|
||||
void pageChanged(int index);
|
||||
void numPages(unsigned int numPages);
|
||||
void errorOpening();
|
||||
void isBookmark(bool);
|
||||
void bookmarksLoaded(const Bookmarks &);
|
||||
virtual bool load(const QString & path);
|
||||
|
||||
public slots:
|
||||
void loadImages();
|
||||
void loadSizes();
|
||||
void openingError(QProcess::ProcessError error);
|
||||
};
|
||||
|
||||
class FolderComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//void run();
|
||||
public:
|
||||
FolderComic();
|
||||
FolderComic(const QString & path);
|
||||
~FolderComic();
|
||||
|
||||
virtual bool load(const QString & path);
|
||||
public slots:
|
||||
void process();
|
||||
|
||||
};
|
||||
|
||||
class PDFComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//pdf
|
||||
Poppler::Document * pdfComic;
|
||||
|
||||
//void run();
|
||||
public:
|
||||
PDFComic();
|
||||
PDFComic(const QString & path);
|
||||
~PDFComic();
|
||||
|
||||
virtual bool load(const QString & path);
|
||||
public slots:
|
||||
void process();
|
||||
};
|
||||
|
||||
class FactoryComic
|
||||
{
|
||||
public:
|
||||
static Comic * newComic(const QString & path);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user