diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 956a18e5..ec604098 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -742,20 +742,29 @@ void MainWindowViewer::open(QString path, qint64 comicId, qint64 libraryId) void MainWindowViewer::openComicFromPath(QString pathFile) { - QFileInfo fi(pathFile); - currentDirectory = fi.dir().absolutePath(); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); - - enableActions(); - - viewer->open(pathFile); - - isClient = false; - + openComic(pathFile); + isClient = false; //this method is used for direct openings } +//isClient shouldn't be modified when a siblinig comic is opened +void MainWindowViewer::openSiblingComic(QString pathFile) +{ + openComic(pathFile); +} + +void MainWindowViewer::openComic(QString pathFile) +{ + QFileInfo fi(pathFile); + currentDirectory = fi.dir().absolutePath(); + getSiblingComics(fi.absolutePath(),fi.fileName()); + + setWindowTitle("YACReader - " + fi.fileName()); + + enableActions(); + + viewer->open(pathFile); + } + void MainWindowViewer::openFolder() { QFileDialog openDialog; @@ -1275,11 +1284,7 @@ void MainWindowViewer::openPreviousComic() } if(!previousComicPath.isEmpty()) { - viewer->open(previousComicPath); - QFileInfo fi(previousComicPath); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); + openSiblingComic(previousComicPath); } } @@ -1302,11 +1307,7 @@ void MainWindowViewer::openNextComic() } if(!nextComicPath.isEmpty()) { - viewer->open(nextComicPath); - QFileInfo fi(nextComicPath); - getSiblingComics(fi.absolutePath(),fi.fileName()); - - setWindowTitle("YACReader - " + fi.fileName()); + openSiblingComic(nextComicPath); } } diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index 108e8dae..00bf9f77 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -48,9 +48,11 @@ class EditShortcutsDialog; void newVersion(); void openPreviousComic(); void openNextComic(); - void openComicFromPath(QString pathFile); - void openFolderFromPath(QString pathDir); - void openFolderFromPath(QString pathFile, QString atFileName); + void openComicFromPath(QString pathFile); + void openSiblingComic(QString pathFile); + void openComic(QString pathFile); + void openFolderFromPath(QString pathDir); + void openFolderFromPath(QString pathFile, QString atFileName); void alwaysOnTopSwitch(); void adjustToFullSizeSwitch(); void fitToPageSwitch(); @@ -71,7 +73,8 @@ class EditShortcutsDialog; void next(); void updatePage();*/ - private: + + private: //!State bool fullscreen; bool toolbars; @@ -168,6 +171,5 @@ signals: public: MainWindowViewer(); ~MainWindowViewer(); - -}; + }; #endif diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 155c1a5a..9ae7cf36 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -937,25 +937,31 @@ void Render::setNumPages(unsigned int numPages) void Render::pageRawDataReady(int page) { - pagesEmited.push_back(page); - if(pageRenders.size()>0) - { - for(int i=0;i currentIndex-numLeftPages)) || - ((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) ) - { - fillBuffer(); - } - } - } - pagesEmited.clear(); - } + if (!hasLoadedComic()) + return; + + pagesEmited.push_back(page); + if(pageRenders.size()>0) + { + for(int i=0;i= pagesReady.size()) + return; //Oooops, something went wrong + + pagesReady[pagesEmited.at(i)] = true; + if(pagesEmited.at(i) == currentIndex) + update(); + else + { + if ( ((pagesEmited.at(i) < currentIndex) && (pagesEmited.at(i) > currentIndex-numLeftPages)) || + ((pagesEmited.at(i) > currentIndex) && (pagesEmited.at(i) < currentIndex+numRightPages)) ) + { + fillBuffer(); + } + } + } + pagesEmited.clear(); + } } //sólo se renderiza la página, si ha habido un cambio de página