mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -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()
|
||||
:_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();
|
||||
}
|
||||
@ -204,6 +204,7 @@ void Comic::setPageLoaded(int page)
|
||||
|
||||
void Comic::invalidate()
|
||||
{
|
||||
_invalidated = true;
|
||||
emit invalidated();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -591,10 +592,20 @@ void FileComic::process()
|
||||
|
||||
for(int i = sectionIndex; i<sections.count() ; i++)
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
archive.getAllData(sections.at(i),this);
|
||||
}
|
||||
for(int i = 0; i<sectionIndex; i++)
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
archive.getAllData(sections.at(i),this);
|
||||
}
|
||||
//archive.getAllData(QVector<quint32>(),this);
|
||||
@ -694,6 +705,12 @@ void FolderComic::process()
|
||||
int i=_firstPage;
|
||||
while(count<nPages)
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
|
||||
QFile f(list.at(i).absoluteFilePath());
|
||||
f.open(QIODevice::ReadOnly);
|
||||
_pages[i]=f.readAll();
|
||||
@ -849,10 +866,23 @@ void PDFComic::process()
|
||||
int buffered_index = _index;
|
||||
for(int i=buffered_index;i<nPages;i++)
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
delete pdfComic;
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
|
||||
renderPage(i);
|
||||
}
|
||||
for(int i=0;i<buffered_index;i++)
|
||||
{
|
||||
if(_invalidated)
|
||||
{
|
||||
delete pdfComic;
|
||||
moveToThread(QCoreApplication::instance()->thread());
|
||||
return;
|
||||
}
|
||||
renderPage(i);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ class Comic : public QObject
|
||||
|
||||
bool _isPDF;
|
||||
|
||||
bool _invalidated;
|
||||
|
||||
public:
|
||||
|
||||
static const QStringList imageExtensions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user