mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
DownloadManager::startDownloadUpdaterThread()
Moved the download updater thread from ContentManager to DownloadManager.
This commit is contained in:
parent
e5f4a4b55f
commit
8fbb867270
@ -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
|
// so that DownloadInfo can be copied across threads
|
||||||
qRegisterMetaType<DownloadInfo>("DownloadInfo");
|
qRegisterMetaType<DownloadInfo>("DownloadInfo");
|
||||||
@ -168,7 +168,7 @@ void ContentManager::startDownloadUpdaterThread()
|
|||||||
mp_downloadUpdaterThread->start();
|
mp_downloadUpdaterThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentManager::~ContentManager()
|
DownloadManager::~DownloadManager()
|
||||||
{
|
{
|
||||||
if ( mp_downloadUpdaterThread )
|
if ( mp_downloadUpdaterThread )
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,6 @@ public: // types
|
|||||||
|
|
||||||
public: // functions
|
public: // functions
|
||||||
ContentManager(Library* library, kiwix::Downloader *downloader);
|
ContentManager(Library* library, kiwix::Downloader *downloader);
|
||||||
virtual ~ContentManager();
|
|
||||||
|
|
||||||
ContentManagerView* getView() { return mp_view; }
|
ContentManagerView* getView() { return mp_view; }
|
||||||
void setLocal(bool local);
|
void setLocal(bool local);
|
||||||
@ -122,7 +121,6 @@ private: // functions
|
|||||||
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
|
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
|
||||||
QString getRemoteLibraryUrl() const;
|
QString getRemoteLibraryUrl() const;
|
||||||
|
|
||||||
void startDownloadUpdaterThread();
|
|
||||||
std::string startDownload(const kiwix::Book& book);
|
std::string startDownload(const kiwix::Book& book);
|
||||||
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);
|
||||||
@ -132,7 +130,6 @@ private: // functions
|
|||||||
private: // data
|
private: // data
|
||||||
Library* mp_library;
|
Library* mp_library;
|
||||||
kiwix::LibraryPtr mp_remoteLibrary;
|
kiwix::LibraryPtr mp_remoteLibrary;
|
||||||
QThread* mp_downloadUpdaterThread = nullptr;
|
|
||||||
OpdsRequestManager m_remoteLibraryManager;
|
OpdsRequestManager m_remoteLibraryManager;
|
||||||
ContentManagerView* mp_view;
|
ContentManagerView* mp_view;
|
||||||
bool m_local = true;
|
bool m_local = true;
|
||||||
|
@ -70,6 +70,9 @@ private:
|
|||||||
|
|
||||||
public: // functions
|
public: // functions
|
||||||
DownloadManager(const Library* lib, kiwix::Downloader *downloader);
|
DownloadManager(const Library* lib, kiwix::Downloader *downloader);
|
||||||
|
virtual ~DownloadManager();
|
||||||
|
|
||||||
|
void startDownloadUpdaterThread();
|
||||||
|
|
||||||
DownloadInfo getDownloadInfo(QString bookId) const;
|
DownloadInfo getDownloadInfo(QString bookId) const;
|
||||||
void restoreDownloads();
|
void restoreDownloads();
|
||||||
@ -97,6 +100,7 @@ protected: // data
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Downloads m_downloads;
|
Downloads m_downloads;
|
||||||
|
QThread* mp_downloadUpdaterThread = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOWNLOADMANAGEMENT_H
|
#endif // DOWNLOADMANAGEMENT_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user