mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Keep track of erros while opening a comic
This way we can query if an error ocurred opening a comic.
This commit is contained in:
parent
6542162293
commit
aba45b3011
@ -44,13 +44,13 @@ const QStringList Comic::literalComicExtensions = LiteralComicArchiveExtensions;
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Comic::Comic()
|
Comic::Comic()
|
||||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_invalidated(false)
|
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_invalidated(false),_errorOpening(false)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Comic::Comic(const QString & pathFile, int atPage )
|
Comic::Comic(const QString & pathFile, int atPage )
|
||||||
:_pages(),_index(0),_path(pathFile),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_firstPage(atPage)
|
:_pages(),_index(0),_path(pathFile),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_firstPage(atPage),_errorOpening(false)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
@ -66,6 +66,16 @@ void Comic::setup()
|
|||||||
connect(this,SIGNAL(pageChanged(int)),this,SLOT(checkIsBookmark(int)));
|
connect(this,SIGNAL(pageChanged(int)),this,SLOT(checkIsBookmark(int)));
|
||||||
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(updateBookmarkImage(int)));
|
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(updateBookmarkImage(int)));
|
||||||
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(setPageLoaded(int)));
|
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(setPageLoaded(int)));
|
||||||
|
|
||||||
|
auto l = [&](){ _errorOpening = true; };
|
||||||
|
|
||||||
|
void (Comic::* errorOpeningPtr)() = &Comic::errorOpening;
|
||||||
|
void (Comic::* errorOpeningWithStringPtr)(QString) = &Comic::errorOpening;
|
||||||
|
|
||||||
|
connect(this, errorOpeningPtr, l);
|
||||||
|
connect(this, errorOpeningWithStringPtr, l);
|
||||||
|
|
||||||
|
connect(this, &Comic::crcErrorFound, l);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int Comic::nextPage()
|
int Comic::nextPage()
|
||||||
@ -230,6 +240,11 @@ bool Comic::pageIsLoaded(int page)
|
|||||||
return _loadedPages[page];
|
return _loadedPages[page];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Comic::hasBeenAnErrorOpening()
|
||||||
|
{
|
||||||
|
return _errorOpening;
|
||||||
|
}
|
||||||
|
|
||||||
bool Comic::fileIsComic(const QString &path)
|
bool Comic::fileIsComic(const QString &path)
|
||||||
{
|
{
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
|
@ -40,6 +40,8 @@ class Comic : public QObject
|
|||||||
|
|
||||||
bool _invalidated;
|
bool _invalidated;
|
||||||
|
|
||||||
|
bool _errorOpening;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const QStringList imageExtensions;
|
static const QStringList imageExtensions;
|
||||||
@ -73,6 +75,9 @@ class Comic : public QObject
|
|||||||
QByteArray getRawPage(int page);
|
QByteArray getRawPage(int page);
|
||||||
bool pageIsLoaded(int page);
|
bool pageIsLoaded(int page);
|
||||||
|
|
||||||
|
//check if the comic has failed loading
|
||||||
|
bool hasBeenAnErrorOpening();
|
||||||
|
|
||||||
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
inline static QStringList getSupportedImageFormats() { return imageExtensions;}
|
||||||
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
inline static QStringList getSupportedImageLiteralFormats() { return literalImageExtensions;}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user