mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-20 18:33:38 -04:00
Made DownloadManager::mp_downloader private
This commit is contained in:
parent
fffe7586b4
commit
6bbbe7dafc
@ -149,7 +149,7 @@ ContentManager::ContentManager(Library* library, kiwix::Downloader* downloader)
|
||||
connect(this, &DownloadManager::downloadDisappeared,
|
||||
this, &ContentManager::downloadDisappeared);
|
||||
|
||||
if ( mp_downloader ) {
|
||||
if ( DownloadManager::downloadingFunctionalityAvailable() ) {
|
||||
startDownloadUpdaterThread();
|
||||
}
|
||||
}
|
||||
@ -605,7 +605,7 @@ std::string ContentManager::startDownload(const kiwix::Book& book)
|
||||
|
||||
void ContentManager::downloadBook(const QString &id)
|
||||
{
|
||||
if (!mp_downloader)
|
||||
if ( ! DownloadManager::downloadingFunctionalityAvailable() )
|
||||
throwDownloadUnavailableError();
|
||||
|
||||
const auto& book = getRemoteOrLocalBook(id);
|
||||
|
@ -56,6 +56,11 @@ DownloadManager::~DownloadManager()
|
||||
}
|
||||
}
|
||||
|
||||
bool DownloadManager::downloadingFunctionalityAvailable() const
|
||||
{
|
||||
return mp_downloader != nullptr;
|
||||
}
|
||||
|
||||
void DownloadManager::startDownloadUpdaterThread()
|
||||
{
|
||||
// so that DownloadInfo can be copied across threads
|
||||
|
@ -72,6 +72,8 @@ public: // functions
|
||||
DownloadManager(const Library* lib, kiwix::Downloader *downloader);
|
||||
virtual ~DownloadManager();
|
||||
|
||||
bool downloadingFunctionalityAvailable() const;
|
||||
|
||||
void startDownloadUpdaterThread();
|
||||
|
||||
DownloadInfo getDownloadInfo(QString bookId) const;
|
||||
@ -94,11 +96,9 @@ signals:
|
||||
void downloadUpdated(QString bookId, const DownloadInfo& );
|
||||
void downloadDisappeared(QString bookId);
|
||||
|
||||
protected: // data
|
||||
private: // data
|
||||
const Library* const mp_library;
|
||||
kiwix::Downloader* const mp_downloader;
|
||||
|
||||
private:
|
||||
Downloads m_downloads;
|
||||
QThread* mp_downloadUpdaterThread = nullptr;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user