Got rid of ContentManager::startDownload()

This commit is contained in:
Veloman Yunkan 2024-05-30 13:36:03 +04:00 committed by Kelson
parent 6bbbe7dafc
commit f8a140404e
2 changed files with 4 additions and 12 deletions

View File

@ -595,14 +595,6 @@ QString ContentManager::getRemoteLibraryUrl() const
: "http://" + host + ":" + QString::number(port);
}
std::string ContentManager::startDownload(const kiwix::Book& book)
{
auto downloadPath = getSettingsManager()->getDownloadDir();
checkThatBookCanBeSaved(book, downloadPath);
return DownloadManager::startDownload(book, downloadPath.toStdString());
}
void ContentManager::downloadBook(const QString &id)
{
if ( ! DownloadManager::downloadingFunctionalityAvailable() )
@ -610,11 +602,12 @@ void ContentManager::downloadBook(const QString &id)
const auto& book = getRemoteOrLocalBook(id);
const auto downloadPath = getSettingsManager()->getDownloadDir();
checkThatBookCanBeSaved(book, downloadPath);
std::string downloadId;
try {
downloadId = startDownload(book);
} catch (const ContentManagerError& ) {
throw;
downloadId = DownloadManager::startDownload(book, downloadPath.toStdString());
} catch (std::exception& e) {
throwDownloadUnavailableError();
}

View File

@ -121,7 +121,6 @@ private: // functions
const kiwix::Book& getRemoteOrLocalBook(const QString &id);
QString getRemoteLibraryUrl() const;
std::string startDownload(const kiwix::Book& book);
void removeDownload(QString bookId);
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
void downloadDisappeared(QString bookId);