mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-20 18:33:38 -04:00
ContentManagerModel::{removeDownload -> setDownloadState}()
This commit is contained in:
parent
a7fb85b8b0
commit
4f6b0f1bab
@ -506,7 +506,7 @@ void ContentManager::downloadStarted(const kiwix::Book& book, const std::string&
|
||||
void ContentManager::removeDownload(QString bookId)
|
||||
{
|
||||
DownloadManager::removeDownload(bookId);
|
||||
managerModel->removeDownload(bookId);
|
||||
managerModel->setDownloadState(bookId, nullptr);
|
||||
}
|
||||
|
||||
void ContentManager::downloadDisappeared(QString bookId)
|
||||
@ -553,13 +553,13 @@ void ContentManager::updateDownload(QString bookId, const DownloadInfo& download
|
||||
}
|
||||
}
|
||||
|
||||
void ContentManager::downloadBook(const QString &id, QModelIndex index)
|
||||
void ContentManager::downloadBook(const QString &id, QModelIndex /*index*/)
|
||||
{
|
||||
try
|
||||
{
|
||||
downloadBook(id);
|
||||
const auto node = static_cast<RowNode*>(index.internalPointer());
|
||||
node->setDownloadState(DownloadManager::getDownloadState(id));
|
||||
const auto downloadState = DownloadManager::getDownloadState(id);
|
||||
managerModel->setDownloadState(id, downloadState);
|
||||
}
|
||||
catch ( const ContentManagerError& err )
|
||||
{
|
||||
|
@ -265,14 +265,14 @@ void ContentManagerModel::triggerDataUpdateAt(QModelIndex index)
|
||||
emit dataChanged(index, index);
|
||||
}
|
||||
|
||||
void ContentManagerModel::removeDownload(QString bookId)
|
||||
void ContentManagerModel::setDownloadState(QString bookId, std::shared_ptr<DownloadState> ds)
|
||||
{
|
||||
const auto it = bookIdToRowMap.constFind(bookId);
|
||||
if ( it == bookIdToRowMap.constEnd() )
|
||||
return;
|
||||
|
||||
const size_t row = it.value();
|
||||
getRowNode(row)->setDownloadState(nullptr);
|
||||
getRowNode(row)->setDownloadState(ds);
|
||||
triggerDataUpdateAt( this->index(row, 5) );
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public: // functions
|
||||
public slots:
|
||||
void updateImage(QString bookId, QString url, QByteArray imageData);
|
||||
void triggerDataUpdateAt(QModelIndex index);
|
||||
void removeDownload(QString bookId);
|
||||
void setDownloadState(QString bookId, std::shared_ptr<DownloadState> ds);
|
||||
void updateDownload(QString bookId);
|
||||
|
||||
private: // functions
|
||||
|
Loading…
x
Reference in New Issue
Block a user