mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-21 02:51:26 -04:00
DownloadManager::startDownload()
This commit is contained in:
parent
f0e91f11f9
commit
b5e3c30d46
@ -622,12 +622,7 @@ std::string ContentManager::startDownload(const kiwix::Book& book)
|
||||
auto downloadPath = getSettingsManager()->getDownloadDir();
|
||||
checkThatBookCanBeSaved(book, downloadPath);
|
||||
|
||||
typedef std::vector<std::pair<std::string, std::string>> DownloadOptions;
|
||||
|
||||
const DownloadOptions downloadOptions{{"dir", downloadPath.toStdString()}};
|
||||
|
||||
const auto d = mp_downloader->startDownload(book.getUrl(), downloadOptions);
|
||||
return d->getDid();
|
||||
return DownloadManager::startDownload(book.getUrl(), downloadPath.toStdString());
|
||||
}
|
||||
|
||||
void ContentManager::downloadBook(const QString &id)
|
||||
|
@ -104,6 +104,16 @@ DownloadInfo DownloadManager::getDownloadInfo(QString bookId) const
|
||||
};
|
||||
}
|
||||
|
||||
std::string DownloadManager::startDownload(const std::string& url, const std::string& downloadDirPath)
|
||||
{
|
||||
typedef std::vector<std::pair<std::string, std::string>> DownloadOptions;
|
||||
|
||||
const DownloadOptions downloadOptions{{"dir", downloadDirPath}};
|
||||
|
||||
const auto d = mp_downloader->startDownload(url, downloadOptions);
|
||||
return d->getDid();
|
||||
}
|
||||
|
||||
void DownloadManager::pauseDownload(const QString& bookId)
|
||||
{
|
||||
const auto downloadId = mp_library->getBookById(bookId).getDownloadId();
|
||||
|
@ -73,6 +73,9 @@ public: // functions
|
||||
DownloadInfo getDownloadInfo(QString bookId) const;
|
||||
void restoreDownloads();
|
||||
void updateDownloads();
|
||||
|
||||
// returns the download id
|
||||
std::string startDownload(const std::string& url, const std::string& downloadDirPath);
|
||||
void pauseDownload(const QString& bookId);
|
||||
void resumeDownload(const QString& bookId);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user