From 0398b8ca5792f73880e8a3d4e6cd9e5703eb7860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Mon, 15 Jul 2013 11:35:20 +0200 Subject: [PATCH] removed completely the lag from information label comics are now opened by the last read page --- YACReader/comic.cpp | 5 +++-- YACReader/comic.h | 1 + YACReader/render.cpp | 11 ++++++++++- YACReader/render.h | 2 ++ YACReader/viewer.cpp | 3 ++- compressed_archive/compressed_archive.cpp | 5 +++++ compressed_archive/compressed_archive.h | 1 + 7 files changed, 24 insertions(+), 4 deletions(-) diff --git a/YACReader/comic.cpp b/YACReader/comic.cpp index 1a61282d..b073a825 100644 --- a/YACReader/comic.cpp +++ b/YACReader/comic.cpp @@ -393,8 +393,9 @@ void FileComic::process() out << "tiempo en ordenar : " << myTimer.elapsed() << endl; - _firstPage = 0; - _index = 0; + _firstPage = bm->getLastPage(); + _index = bm->getLastPage(); + emit(openAt(_index)); int sectionIndex; QList > sections = getSections(sectionIndex); diff --git a/YACReader/comic.h b/YACReader/comic.h index e2811efd..6bb1ce33 100644 --- a/YACReader/comic.h +++ b/YACReader/comic.h @@ -72,6 +72,7 @@ void imageLoaded(int index); void imageLoaded(int index,const QByteArray & image); void pageChanged(int index); + void openAt(int index); void numPages(unsigned int numPages); void errorOpening(); void isBookmark(bool); diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 94516dcf..9e783bda 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -589,7 +589,7 @@ void Render::load(const QString & path) connect(comic,SIGNAL(errorOpening()),this,SLOT(reset())); connect(comic,SIGNAL(imageLoaded(int)),this,SIGNAL(imageLoaded(int))); connect(comic,SIGNAL(imageLoaded(int)),this,SLOT(pageRawDataReady(int))); - //connect(comic,SIGNAL(pageChanged(int)),this,SIGNAL(pageChanged(int))); + connect(comic,SIGNAL(openAt(int)),this,SLOT(renderAt(int))); connect(comic,SIGNAL(numPages(unsigned int)),this,SIGNAL(numPages(unsigned int))); connect(comic,SIGNAL(numPages(unsigned int)),this,SLOT(setNumPages(unsigned int))); connect(comic,SIGNAL(imageLoaded(int,QByteArray)),this,SIGNAL(imageLoaded(int,QByteArray))); @@ -624,6 +624,12 @@ void Render::load(const QString & path) } +void Render::renderAt(int page) +{ + previousIndex = currentIndex = page; + emit pageChanged(page); +} + void Render::reset() { loadedComic = false; @@ -655,6 +661,7 @@ void Render::nextPage() previousIndex = currentIndex; currentIndex = nextPage; update(); + emit pageChanged(currentIndex); } else emit isLast(); @@ -685,6 +692,7 @@ void Render::previousPage() previousIndex = currentIndex; currentIndex = previousPage; update(); + emit pageChanged(currentIndex); } else emit isCover(); @@ -761,6 +769,7 @@ void Render::goTo(int index) invalidate(); update(); + emit pageChanged(currentIndex); } } diff --git a/YACReader/render.h b/YACReader/render.h index 662d0593..495a2b1c 100644 --- a/YACReader/render.h +++ b/YACReader/render.h @@ -149,6 +149,8 @@ public slots: void reset(); void reload(); Bookmarks * getBookmarks(); + //sets the firt page to render + void renderAt(int page); signals: void currentPageReady(); diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 143d08b4..568b4bb5 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -140,11 +140,12 @@ void Viewer::createConnections() connect(render,SIGNAL(errorOpening()),this,SLOT(showMessageErrorOpening())); connect(render,SIGNAL(numPages(unsigned int)),goToFlow,SLOT(setNumSlides(unsigned int))); connect(render,SIGNAL(numPages(unsigned int)),goToDialog,SLOT(setNumPages(unsigned int))); - connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation())); + //connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation())); connect(render,SIGNAL(imageLoaded(int,QByteArray)),goToFlow,SLOT(setImageReady(int,QByteArray))); connect(render,SIGNAL(currentPageReady()),this,SLOT(updatePage())); connect(render,SIGNAL(processingPage()),this,SLOT(setLoadingMessage())); connect(render,SIGNAL(currentPageIsBookmark(bool)),this,SIGNAL(pageIsBookmark(bool))); + connect(render,SIGNAL(pageChanged(int)),this,SLOT(updateInformation())); //connect(render,SIGNAL(bookmarksLoaded(Bookmarks)),this,SLOT(setBookmarks(Bookmarks))); connect(render,SIGNAL(isLast()),this,SLOT(showIsLastMessage())); diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index 0c55c08d..25d35e7e 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -101,6 +101,11 @@ CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) } } +CompressedArchive::~CompressedArchive() +{ + //TODO +} + void CompressedArchive::loadFunctions() { //LOAD library diff --git a/compressed_archive/compressed_archive.h b/compressed_archive/compressed_archive.h index 23935753..8429a1f2 100644 --- a/compressed_archive/compressed_archive.h +++ b/compressed_archive/compressed_archive.h @@ -31,6 +31,7 @@ class CompressedArchive : public QObject Q_OBJECT public: explicit CompressedArchive(const QString & filePath, QObject *parent = 0); + ~CompressedArchive(); signals: