mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-21 02:51:26 -04:00
Extracted ContentManager::downloadStarted()
This commit is contained in:
parent
2fbfe40c11
commit
b0b592dfd8
@ -366,6 +366,15 @@ QString getDownloadInfo(const kiwix::Download& d, const QString& k)
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
void ContentManager::downloadStarted(const kiwix::Book& book, const std::string& downloadId)
|
||||
{
|
||||
kiwix::Book bookCopy(book);
|
||||
bookCopy.setDownloadId(downloadId);
|
||||
mp_library->addBookToLibrary(bookCopy);
|
||||
mp_library->save();
|
||||
emit(oneBookChanged(QString::fromStdString(book.getId())));
|
||||
}
|
||||
|
||||
void ContentManager::downloadCancelled(QString bookId)
|
||||
{
|
||||
kiwix::Book bCopy(mp_library->getBookById(bookId));
|
||||
@ -485,11 +494,7 @@ QString ContentManager::downloadBook(const QString &id)
|
||||
} catch (std::exception& e) {
|
||||
return "";
|
||||
}
|
||||
kiwix::Book bookCopy(book);
|
||||
bookCopy.setDownloadId(download->getDid());
|
||||
mp_library->addBookToLibrary(bookCopy);
|
||||
mp_library->save();
|
||||
emit(oneBookChanged(id));
|
||||
downloadStarted(book, download->getDid());
|
||||
return QString::fromStdString(download->getDid());
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,8 @@ private:
|
||||
QMutex remoteLibraryLocker;
|
||||
void setCategories();
|
||||
void setLanguages();
|
||||
|
||||
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
|
||||
void downloadCancelled(QString bookId);
|
||||
void downloadCompleted(QString bookId, QString path);
|
||||
DownloadInfo getDownloadInfo(QString bookId, const QStringList& keys) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user