diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 6b7605e8..60617c3e 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -906,20 +906,40 @@ void LibraryWindow::openComic() } } -void LibraryWindow::setCurrentComicReaded() +void LibraryWindow::setCurrentComicsStatusReaded(bool readed) { - comicFlow->markSlide(comicFlow->centerIndex()); + QModelIndexList indexList = comicView->selectionModel()->selectedRows(); + + QList comics = dmCV->getComics(indexList); + + foreach (QModelIndex mi, indexList) + { + if(readed) + comicFlow->markSlide(mi.row()); + else + comicFlow->unmarkSlide(mi.row()); + + } comicFlow->updateMarks(); - ComicDB c = dmCV->getComic(comicView->currentIndex()); - c.info.read = true; QSqlDatabase db = DataBaseManagement::loadDatabase(dm->getDatabase()); db.open(); - c.info.updateRead(db); + db.transaction(); + foreach (ComicDB c, comics) + { + c.info.read = readed; + c.info.updateRead(db); + } + db.commit(); db.close(); QSqlDatabase::removeDatabase(dm->getDatabase()); } +void LibraryWindow::setCurrentComicReaded() +{ + this->setCurrentComicsStatusReaded(true); +} + void LibraryWindow::setComicsReaded() { comicFlow->setMarks(dmCV->setAllComicsRead(true)); @@ -928,17 +948,7 @@ void LibraryWindow::setComicsReaded() void LibraryWindow::setCurrentComicUnreaded() { - comicFlow->unmarkSlide(comicFlow->centerIndex()); - comicFlow->updateMarks(); - - ComicDB c = dmCV->getComic(comicView->currentIndex()); - c.info.read = false; - QSqlDatabase db = DataBaseManagement::loadDatabase(dm->getDatabase()); - db.open(); - c.info.updateRead(db); - db.close(); - QSqlDatabase::removeDatabase(dm->getDatabase()); - + this->setCurrentComicsStatusReaded(false); } void LibraryWindow::setComicsUnreaded() @@ -1169,8 +1179,6 @@ void LibraryWindow::toggleFullScreen() void LibraryWindow::toFullScreen() { - fromMaximized = this->isMaximized(); - comicFlow->hide(); comicFlow->setSlideSize(slideSizeF); comicFlow->setCenterIndex(comicFlow->centerIndex()); @@ -1201,10 +1209,7 @@ void LibraryWindow::toNormal() libraryToolBar->show(); comicFlow->show(); - if(fromMaximized) - showMaximized(); - else - showNormal(); + showNormal(); } void LibraryWindow::setFoldersFilter(QString filter) @@ -1484,5 +1489,5 @@ QString LibraryWindow::getFolderName(const QString & libraryName, qulonglong id) void LibraryWindow::closeEvent ( QCloseEvent * event ) { settings->setValue(MAIN_WINDOW_GEOMETRY, saveGeometry()); - //settings->setValue(MAIN_WINDOW_STATE, saveState()); + settings->setValue(MAIN_WINDOW_STATE, saveState()); } \ No newline at end of file diff --git a/YACReaderLibrary/library_window.h b/YACReaderLibrary/library_window.h index 7d75b297..984efe3d 100644 --- a/YACReaderLibrary/library_window.h +++ b/YACReaderLibrary/library_window.h @@ -50,8 +50,6 @@ private: PropertiesDialog * propertiesDialog; bool fullscreen; bool importedCovers; //if true, the library is read only (not updates,open comic or properties) - bool fromMaximized; - //Ya no se usan proxies, el rendimiento de la BD es suficiente //YACReaderTreeSearch * proxyFilter; //YACReaderSortComics * proxySort; @@ -202,6 +200,7 @@ public: void importLibrary(QString clc,QString destPath,QString name); void reloadOptions(); void updateFoldersView(QString); + void setCurrentComicsStatusReaded(bool readed); void setCurrentComicReaded(); void setCurrentComicUnreaded(); void setComicsReaded();