From 72880cb59e521fc31c1f8c70f5cb56c3bb158895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 27 Sep 2017 19:43:07 +0200 Subject: [PATCH] Finish processing a comic if it has been invalidated. --- common/comic.cpp | 32 +++++++++++++++++++++++++++++++- common/comic.h | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/common/comic.cpp b/common/comic.cpp index eb8afaaf..00dc3581 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -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; ithread()); + return; + } archive.getAllData(sections.at(i),this); } for(int i = 0; ithread()); + return; + } archive.getAllData(sections.at(i),this); } //archive.getAllData(QVector(),this); @@ -694,6 +705,12 @@ void FolderComic::process() int i=_firstPage; while(countthread()); + 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;ithread()); + return; + } + renderPage(i); } for(int i=0;ithread()); + return; + } renderPage(i); } diff --git a/common/comic.h b/common/comic.h index 6b6e183e..90cc314f 100644 --- a/common/comic.h +++ b/common/comic.h @@ -38,6 +38,8 @@ class Comic : public QObject bool _isPDF; + bool _invalidated; + public: static const QStringList imageExtensions;