Preparing to make updateDownload() a slot

... that can be called from a worker thread.
This commit is contained in:
Veloman Yunkan 2024-02-12 18:35:44 +04:00
parent a1a298af58
commit 32e3c743f7
2 changed files with 5 additions and 5 deletions

View File

@ -477,12 +477,10 @@ DownloadInfo ContentManager::getDownloadInfo(QString bookId) const
};
}
void ContentManager::updateDownload(QString bookId)
void ContentManager::updateDownload(QString bookId, const DownloadInfo& downloadInfo)
{
const auto downloadState = m_downloads.value(bookId);
if ( downloadState && !downloadState->paused ) {
const auto downloadInfo = getDownloadInfo(bookId);
if ( downloadInfo.isEmpty() ) {
downloadDisappeared(bookId);
} else if ( downloadInfo["status"] == "completed" ) {
@ -497,7 +495,9 @@ void ContentManager::updateDownload(QString bookId)
void ContentManager::updateDownloads()
{
for ( const auto& bookId : m_downloads.keys() ) {
updateDownload(bookId);
const auto downloadInfo = getDownloadInfo(bookId);
updateDownload(bookId, downloadInfo);
}
}

View File

@ -83,7 +83,7 @@ private: // functions
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
std::string startDownload(const kiwix::Book& book);
void updateDownload(QString bookId);
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);