From b6a86918ff55531b29c5e227f17fd1957aae14d9 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 12 Feb 2024 18:48:10 +0400 Subject: [PATCH] ContentManager::updateDownload() became a slot --- src/contentmanager.cpp | 5 ++++- src/contentmanager.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index 21de2e1..158f2cd 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -133,6 +133,9 @@ ContentManager::ContentManager(Library* library, kiwix::Downloader* downloader, m_downloadUpdateTimer.start(1000); connect(&m_downloadUpdateTimer, &QTimer::timeout, this, &ContentManager::updateDownloads); + + connect(this, &ContentManager::downloadUpdated, + this, &ContentManager::updateDownload); } void ContentManager::updateModel() @@ -497,7 +500,7 @@ void ContentManager::updateDownloads() for ( const auto& bookId : m_downloads.keys() ) { const auto downloadInfo = getDownloadInfo(bookId); - updateDownload(bookId, downloadInfo); + emit downloadUpdated(bookId, downloadInfo); } } diff --git a/src/contentmanager.h b/src/contentmanager.h index f947a69..e27d88b 100644 --- a/src/contentmanager.h +++ b/src/contentmanager.h @@ -44,6 +44,7 @@ signals: void categoriesLoaded(QStringList); void languagesLoaded(LanguageList); void localChanged(const bool); + void downloadUpdated(QString bookId, const DownloadInfo& ); public slots: QStringList getTranslations(const QStringList &keys); @@ -66,6 +67,7 @@ public slots: void onCustomContextMenu(const QPoint &point); void openBookWithIndex(const QModelIndex& index); void updateDownloads(); + void updateDownload(QString bookId, const DownloadInfo& downloadInfo); private: // functions QStringList getBookIds(); @@ -83,7 +85,6 @@ private: // functions const kiwix::Book& getRemoteOrLocalBook(const QString &id); std::string startDownload(const kiwix::Book& book); - void updateDownload(QString bookId, const DownloadInfo& downloadInfo); void removeDownload(QString bookId); void downloadStarted(const kiwix::Book& book, const std::string& downloadId); void downloadDisappeared(QString bookId);