From f8a140404e1be14637f8eb83bbcc5b2b4b651da6 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 30 May 2024 13:36:03 +0400 Subject: [PATCH] Got rid of ContentManager::startDownload() --- src/contentmanager.cpp | 15 ++++----------- src/contentmanager.h | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index c9c921f..a65a592 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -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(); } diff --git a/src/contentmanager.h b/src/contentmanager.h index c51b319..939db91 100644 --- a/src/contentmanager.h +++ b/src/contentmanager.h @@ -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);