From e8f31b39ee0c3378f719c105afccf79c00e086dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 15 Oct 2022 12:53:02 +0200 Subject: [PATCH] Update the current comic model when the server gets a syn request Sadly the grid view resets its scroll to origin. Not sure if it is going to bother anyone, we'll see. --- YACReaderLibrary/db/comic_model.cpp | 21 +++++++++++++++++++++ YACReaderLibrary/db/comic_model.h | 1 + YACReaderLibrary/library_window.cpp | 1 + 3 files changed, 23 insertions(+) diff --git a/YACReaderLibrary/db/comic_model.cpp b/YACReaderLibrary/db/comic_model.cpp index 099fa0f7..e5fcce18 100644 --- a/YACReaderLibrary/db/comic_model.cpp +++ b/YACReaderLibrary/db/comic_model.cpp @@ -896,6 +896,27 @@ void ComicModel::reloadContinueReading() setupReadingModelData(_databasePath); } +void ComicModel::reload() +{ + switch (mode) { + case Folder: + setupFolderModelData(sourceId, _databasePath); + break; + case Favorites: + setupFavoritesModelData(_databasePath); + break; + case Reading: + setupReadingModelData(_databasePath); + break; + case Label: + setupLabelModelData(sourceId, _databasePath); + break; + case ReadingList: + setupReadingListModelData(sourceId, _databasePath); + break; + } +} + void ComicModel::remove(int row) { removeInTransaction(row); diff --git a/YACReaderLibrary/db/comic_model.h b/YACReaderLibrary/db/comic_model.h index fa45df28..af6e05bd 100644 --- a/YACReaderLibrary/db/comic_model.h +++ b/YACReaderLibrary/db/comic_model.h @@ -112,6 +112,7 @@ public: // void remove(ComicDB * comic, int row); void removeInTransaction(int row); void reloadContinueReading(); + void reload(); void reload(const ComicDB &comic); void resetComicRating(const QModelIndex &mi); diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index d4c76b16..047a88c9 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -2812,6 +2812,7 @@ void LibraryWindow::importLibraryPackage() void LibraryWindow::updateViewsOnClientSync() { + comicsModel->reload(); contentViewsManager->updateCurrentComicView(); contentViewsManager->updateContinueReadingView(); }