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