ContentManager::updateDownload() became a slot

This commit is contained in:
Veloman Yunkan 2024-02-12 18:48:10 +04:00
parent 32e3c743f7
commit b6a86918ff
2 changed files with 6 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);