DownloadManager::startDownloadUpdaterThread()

Moved the download updater thread from ContentManager to
DownloadManager.
This commit is contained in:
Veloman Yunkan 2024-05-30 11:46:00 +04:00 committed by Kelson
parent e5f4a4b55f
commit 8fbb867270
3 changed files with 6 additions and 5 deletions

View File

@ -154,7 +154,7 @@ ContentManager::ContentManager(Library* library, kiwix::Downloader* downloader)
}
}
void ContentManager::startDownloadUpdaterThread()
void DownloadManager::startDownloadUpdaterThread()
{
// so that DownloadInfo can be copied across threads
qRegisterMetaType<DownloadInfo>("DownloadInfo");
@ -168,7 +168,7 @@ void ContentManager::startDownloadUpdaterThread()
mp_downloadUpdaterThread->start();
}
ContentManager::~ContentManager()
DownloadManager::~DownloadManager()
{
if ( mp_downloadUpdaterThread )
{

View File

@ -59,7 +59,6 @@ public: // types
public: // functions
ContentManager(Library* library, kiwix::Downloader *downloader);
virtual ~ContentManager();
ContentManagerView* getView() { return mp_view; }
void setLocal(bool local);
@ -122,7 +121,6 @@ private: // functions
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
QString getRemoteLibraryUrl() const;
void startDownloadUpdaterThread();
std::string startDownload(const kiwix::Book& book);
void removeDownload(QString bookId);
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
@ -132,7 +130,6 @@ private: // functions
private: // data
Library* mp_library;
kiwix::LibraryPtr mp_remoteLibrary;
QThread* mp_downloadUpdaterThread = nullptr;
OpdsRequestManager m_remoteLibraryManager;
ContentManagerView* mp_view;
bool m_local = true;

View File

@ -70,6 +70,9 @@ private:
public: // functions
DownloadManager(const Library* lib, kiwix::Downloader *downloader);
virtual ~DownloadManager();
void startDownloadUpdaterThread();
DownloadInfo getDownloadInfo(QString bookId) const;
void restoreDownloads();
@ -97,6 +100,7 @@ protected: // data
private:
Downloads m_downloads;
QThread* mp_downloadUpdaterThread = nullptr;
};
#endif // DOWNLOADMANAGEMENT_H