From 0d83e0a117a5efa2e5fb75b3dcacd24b0395a2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 20 Jul 2013 08:53:15 +0200 Subject: [PATCH] bug fixed onpening next/previous folder --- YACReader/comic.cpp | 3 +++ YACReader/main_window_viewer.cpp | 17 +++++++++++++---- compressed_archive/compressed_archive.cpp | 4 +--- compressed_archive/compressed_archive.h | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/YACReader/comic.cpp b/YACReader/comic.cpp index b9e9d83f..030d3e7e 100644 --- a/YACReader/comic.cpp +++ b/YACReader/comic.cpp @@ -424,6 +424,7 @@ void FileComic::process() out << "--tiempo en copiar datos : " << myTimer.elapsed() << endl; f.close(); emit imagesLoaded(); + moveToThread(QApplication::instance()->thread()); } //----------------------------------------------------------------------------- void FileComic::loadSizes() @@ -544,6 +545,7 @@ void FolderComic::process() } } emit imagesLoaded(); + moveToThread(QApplication::instance()->thread()); } //////////////////////////////////////////////////////////////////////////////// @@ -618,6 +620,7 @@ void PDFComic::process() delete pdfComic; emit imagesLoaded(); + moveToThread(QApplication::instance()->thread()); } void PDFComic::renderPage(int page) diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index ec8e240d..6ca4dee7 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -863,8 +863,13 @@ void MainWindowViewer::openPreviousComic() if(!siblingComics.isEmpty()) { int currentIndex = siblingComics.indexOf(currentComicDB); - currentComicDB = siblingComics.at(currentIndex-1); - open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics); + if (currentIndex == -1) + return; + if(currentIndex-1 >= 0 && currentIndex-1 < siblingComics.count()) + { + currentComicDB = siblingComics.at(currentIndex-1); + open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics); + } return; } if(!previousComicPath.isEmpty()) @@ -882,9 +887,13 @@ void MainWindowViewer::openNextComic() if(!siblingComics.isEmpty()) { int currentIndex = siblingComics.indexOf(currentComicDB); + if (currentIndex == -1) + return; if(currentIndex+1 > 0 && currentIndex+1 < siblingComics.count()) - currentComicDB = siblingComics.at(currentIndex+1); - open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics); + { + currentComicDB = siblingComics.at(currentIndex+1); + open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics); + } return; } if(!nextComicPath.isEmpty()) diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index 25d35e7e..423c7fd6 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -54,12 +54,10 @@ struct SevenZipInterface { }; //SevenZipInterface * szInterface; -QLibrary * sevenzLib = 0; CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) : - QObject(parent) + QObject(parent),sevenzLib(0) { - szInterface = new SevenZipInterface; //load functions loadFunctions(); diff --git a/compressed_archive/compressed_archive.h b/compressed_archive/compressed_archive.h index 8429a1f2..8b75e6b2 100644 --- a/compressed_archive/compressed_archive.h +++ b/compressed_archive/compressed_archive.h @@ -42,7 +42,7 @@ public slots: QList getFileNames(); private: SevenZipInterface * szInterface; - + QLibrary * sevenzLib; void loadFunctions(); };