From 582dce0cedd1f1136498cb4c9d73262fe1b54f96 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sat, 10 Feb 2024 15:51:10 +0400 Subject: [PATCH] ContentManager::updateDownload() --- src/contentmanager.cpp | 9 ++++++++- src/contentmanager.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index ffcd191..474bf9a 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -476,6 +476,13 @@ ContentManager::DownloadInfo ContentManager::updateDownloadInfos(QString bookId, return result; } +void ContentManager::updateDownload(QString bookId) +{ + // This calls ContentManager::updateDownloadInfos() in a convoluted way + // and also has some other side-effects + managerModel->updateDownload(bookId); +} + namespace { @@ -497,7 +504,7 @@ void ContentManager::downloadBook(const QString &id, QModelIndex index) node->setDownloadState(newDownload); QTimer *timer = newDownload->getDownloadUpdateTimer(); connect(timer, &QTimer::timeout, [=]() { - managerModel->updateDownload(id); + this->updateDownload(id); }); } catch ( const ContentManagerError& err ) diff --git a/src/contentmanager.h b/src/contentmanager.h index b19a80a..8741f4c 100644 --- a/src/contentmanager.h +++ b/src/contentmanager.h @@ -86,6 +86,7 @@ private: // functions const kiwix::Book& getRemoteOrLocalBook(const QString &id); std::string startDownload(const kiwix::Book& book); + void updateDownload(QString bookId); void downloadStarted(const kiwix::Book& book, const std::string& downloadId); void downloadCancelled(QString bookId); void downloadCompleted(QString bookId, QString path);