mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Finish processing a comic if it has been invalidated.
This commit is contained in:
parent
79beadb952
commit
72880cb59e
@ -44,7 +44,7 @@ const QStringList Comic::literalComicExtensions = LiteralComicArchiveExtensions;
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Comic::Comic()
|
Comic::Comic()
|
||||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false)
|
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_invalidated(false)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
@ -204,6 +204,7 @@ void Comic::setPageLoaded(int page)
|
|||||||
|
|
||||||
void Comic::invalidate()
|
void Comic::invalidate()
|
||||||
{
|
{
|
||||||
|
_invalidated = true;
|
||||||
emit invalidated();
|
emit invalidated();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -591,10 +592,20 @@ void FileComic::process()
|
|||||||
|
|
||||||
for(int i = sectionIndex; i<sections.count() ; i++)
|
for(int i = sectionIndex; i<sections.count() ; i++)
|
||||||
{
|
{
|
||||||
|
if(_invalidated)
|
||||||
|
{
|
||||||
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
return;
|
||||||
|
}
|
||||||
archive.getAllData(sections.at(i),this);
|
archive.getAllData(sections.at(i),this);
|
||||||
}
|
}
|
||||||
for(int i = 0; i<sectionIndex; i++)
|
for(int i = 0; i<sectionIndex; i++)
|
||||||
{
|
{
|
||||||
|
if(_invalidated)
|
||||||
|
{
|
||||||
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
return;
|
||||||
|
}
|
||||||
archive.getAllData(sections.at(i),this);
|
archive.getAllData(sections.at(i),this);
|
||||||
}
|
}
|
||||||
//archive.getAllData(QVector<quint32>(),this);
|
//archive.getAllData(QVector<quint32>(),this);
|
||||||
@ -694,6 +705,12 @@ void FolderComic::process()
|
|||||||
int i=_firstPage;
|
int i=_firstPage;
|
||||||
while(count<nPages)
|
while(count<nPages)
|
||||||
{
|
{
|
||||||
|
if(_invalidated)
|
||||||
|
{
|
||||||
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QFile f(list.at(i).absoluteFilePath());
|
QFile f(list.at(i).absoluteFilePath());
|
||||||
f.open(QIODevice::ReadOnly);
|
f.open(QIODevice::ReadOnly);
|
||||||
_pages[i]=f.readAll();
|
_pages[i]=f.readAll();
|
||||||
@ -849,10 +866,23 @@ void PDFComic::process()
|
|||||||
int buffered_index = _index;
|
int buffered_index = _index;
|
||||||
for(int i=buffered_index;i<nPages;i++)
|
for(int i=buffered_index;i<nPages;i++)
|
||||||
{
|
{
|
||||||
|
if(_invalidated)
|
||||||
|
{
|
||||||
|
delete pdfComic;
|
||||||
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
renderPage(i);
|
renderPage(i);
|
||||||
}
|
}
|
||||||
for(int i=0;i<buffered_index;i++)
|
for(int i=0;i<buffered_index;i++)
|
||||||
{
|
{
|
||||||
|
if(_invalidated)
|
||||||
|
{
|
||||||
|
delete pdfComic;
|
||||||
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
|
return;
|
||||||
|
}
|
||||||
renderPage(i);
|
renderPage(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ class Comic : public QObject
|
|||||||
|
|
||||||
bool _isPDF;
|
bool _isPDF;
|
||||||
|
|
||||||
|
bool _invalidated;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const QStringList imageExtensions;
|
static const QStringList imageExtensions;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user