mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Preparing to make updateDownload() a slot
... that can be called from a worker thread.
This commit is contained in:
parent
a1a298af58
commit
32e3c743f7
@ -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);
|
const auto downloadState = m_downloads.value(bookId);
|
||||||
if ( downloadState && !downloadState->paused ) {
|
if ( downloadState && !downloadState->paused ) {
|
||||||
const auto downloadInfo = getDownloadInfo(bookId);
|
|
||||||
|
|
||||||
if ( downloadInfo.isEmpty() ) {
|
if ( downloadInfo.isEmpty() ) {
|
||||||
downloadDisappeared(bookId);
|
downloadDisappeared(bookId);
|
||||||
} else if ( downloadInfo["status"] == "completed" ) {
|
} else if ( downloadInfo["status"] == "completed" ) {
|
||||||
@ -497,7 +495,9 @@ void ContentManager::updateDownload(QString bookId)
|
|||||||
void ContentManager::updateDownloads()
|
void ContentManager::updateDownloads()
|
||||||
{
|
{
|
||||||
for ( const auto& bookId : m_downloads.keys() ) {
|
for ( const auto& bookId : m_downloads.keys() ) {
|
||||||
updateDownload(bookId);
|
const auto downloadInfo = getDownloadInfo(bookId);
|
||||||
|
|
||||||
|
updateDownload(bookId, downloadInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ private: // functions
|
|||||||
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
|
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
|
||||||
|
|
||||||
std::string startDownload(const kiwix::Book& book);
|
std::string startDownload(const kiwix::Book& book);
|
||||||
void updateDownload(QString bookId);
|
void updateDownload(QString bookId, const DownloadInfo& downloadInfo);
|
||||||
void removeDownload(QString bookId);
|
void removeDownload(QString bookId);
|
||||||
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
|
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
|
||||||
void downloadDisappeared(QString bookId);
|
void downloadDisappeared(QString bookId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user