mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-23 12:07:00 -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
|
} // 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)
|
void ContentManager::downloadCancelled(QString bookId)
|
||||||
{
|
{
|
||||||
kiwix::Book bCopy(mp_library->getBookById(bookId));
|
kiwix::Book bCopy(mp_library->getBookById(bookId));
|
||||||
@ -485,11 +494,7 @@ QString ContentManager::downloadBook(const QString &id)
|
|||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
kiwix::Book bookCopy(book);
|
downloadStarted(book, download->getDid());
|
||||||
bookCopy.setDownloadId(download->getDid());
|
|
||||||
mp_library->addBookToLibrary(bookCopy);
|
|
||||||
mp_library->save();
|
|
||||||
emit(oneBookChanged(id));
|
|
||||||
return QString::fromStdString(download->getDid());
|
return QString::fromStdString(download->getDid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ private:
|
|||||||
QMutex remoteLibraryLocker;
|
QMutex remoteLibraryLocker;
|
||||||
void setCategories();
|
void setCategories();
|
||||||
void setLanguages();
|
void setLanguages();
|
||||||
|
|
||||||
|
void downloadStarted(const kiwix::Book& book, const std::string& downloadId);
|
||||||
void downloadCancelled(QString bookId);
|
void downloadCancelled(QString bookId);
|
||||||
void downloadCompleted(QString bookId, QString path);
|
void downloadCompleted(QString bookId, QString path);
|
||||||
DownloadInfo getDownloadInfo(QString bookId, const QStringList& keys) const;
|
DownloadInfo getDownloadInfo(QString bookId, const QStringList& keys) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user