mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Got rid of a ContentManager::downloadBook() overload
This commit is contained in:
parent
d0a8f2519b
commit
b753a47fbc
@ -511,18 +511,21 @@ void ContentManager::downloadBook(const QString &id)
|
|||||||
kiwix::Book book = getRemoteOrLocalBook(id);
|
kiwix::Book book = getRemoteOrLocalBook(id);
|
||||||
const auto downloadPath = getSettingsManager()->getDownloadDir();
|
const auto downloadPath = getSettingsManager()->getDownloadDir();
|
||||||
|
|
||||||
try
|
std::string downloadId;
|
||||||
{
|
try {
|
||||||
downloadBook(book, downloadPath);
|
downloadId = DownloadManager::startDownload(book, downloadPath);
|
||||||
|
} catch ( const KiwixAppError& err ) {
|
||||||
|
showErrorBox(err, mp_view);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
book.setDownloadId(downloadId);
|
||||||
|
mp_library->addBookBeingDownloaded(book, downloadPath);
|
||||||
|
mp_library->save();
|
||||||
const auto downloadState = DownloadManager::getDownloadState(id);
|
const auto downloadState = DownloadManager::getDownloadState(id);
|
||||||
managerModel->setDownloadState(id, downloadState);
|
managerModel->setDownloadState(id, downloadState);
|
||||||
emit(oneBookChanged(id));
|
emit(oneBookChanged(id));
|
||||||
}
|
}
|
||||||
catch ( const KiwixAppError& err )
|
|
||||||
{
|
|
||||||
showErrorBox(err, mp_view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const kiwix::Book& ContentManager::getRemoteOrLocalBook(const QString &id)
|
const kiwix::Book& ContentManager::getRemoteOrLocalBook(const QString &id)
|
||||||
{
|
{
|
||||||
@ -542,15 +545,6 @@ QString ContentManager::getRemoteLibraryUrl() const
|
|||||||
: "http://" + host + ":" + QString::number(port);
|
: "http://" + host + ":" + QString::number(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentManager::downloadBook(kiwix::Book book, const QString& downloadPath)
|
|
||||||
{
|
|
||||||
const std::string downloadId = DownloadManager::startDownload(book, downloadPath);
|
|
||||||
|
|
||||||
book.setDownloadId(downloadId);
|
|
||||||
mp_library->addBookBeingDownloaded(book, downloadPath);
|
|
||||||
mp_library->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char MSG_FOR_PREVENTED_RMSTAR_OPERATION[] = R"(
|
static const char MSG_FOR_PREVENTED_RMSTAR_OPERATION[] = R"(
|
||||||
BUG: Errare humanum est.
|
BUG: Errare humanum est.
|
||||||
BUG: Kiwix developers are human, but we try to ensure that our mistakes
|
BUG: Kiwix developers are human, but we try to ensure that our mistakes
|
||||||
|
@ -121,7 +121,6 @@ private: // functions
|
|||||||
void removeDownload(QString bookId);
|
void removeDownload(QString bookId);
|
||||||
void downloadDisappeared(QString bookId);
|
void downloadDisappeared(QString bookId);
|
||||||
void downloadCompleted(QString bookId, QString path);
|
void downloadCompleted(QString bookId, QString path);
|
||||||
void downloadBook(kiwix::Book book, const QString& downloadPath);
|
|
||||||
|
|
||||||
private: // data
|
private: // data
|
||||||
Library* mp_library;
|
Library* mp_library;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user