mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 03:26:05 -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)
|
void ContentManager::removeDownload(QString bookId)
|
||||||
{
|
{
|
||||||
DownloadManager::removeDownload(bookId);
|
DownloadManager::removeDownload(bookId);
|
||||||
managerModel->removeDownload(bookId);
|
managerModel->setDownloadState(bookId, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentManager::downloadDisappeared(QString bookId)
|
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
|
try
|
||||||
{
|
{
|
||||||
downloadBook(id);
|
downloadBook(id);
|
||||||
const auto node = static_cast<RowNode*>(index.internalPointer());
|
const auto downloadState = DownloadManager::getDownloadState(id);
|
||||||
node->setDownloadState(DownloadManager::getDownloadState(id));
|
managerModel->setDownloadState(id, downloadState);
|
||||||
}
|
}
|
||||||
catch ( const ContentManagerError& err )
|
catch ( const ContentManagerError& err )
|
||||||
{
|
{
|
||||||
|
@ -265,14 +265,14 @@ void ContentManagerModel::triggerDataUpdateAt(QModelIndex index)
|
|||||||
emit dataChanged(index, 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);
|
const auto it = bookIdToRowMap.constFind(bookId);
|
||||||
if ( it == bookIdToRowMap.constEnd() )
|
if ( it == bookIdToRowMap.constEnd() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const size_t row = it.value();
|
const size_t row = it.value();
|
||||||
getRowNode(row)->setDownloadState(nullptr);
|
getRowNode(row)->setDownloadState(ds);
|
||||||
triggerDataUpdateAt( this->index(row, 5) );
|
triggerDataUpdateAt( this->index(row, 5) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public: // functions
|
|||||||
public slots:
|
public slots:
|
||||||
void updateImage(QString bookId, QString url, QByteArray imageData);
|
void updateImage(QString bookId, QString url, QByteArray imageData);
|
||||||
void triggerDataUpdateAt(QModelIndex index);
|
void triggerDataUpdateAt(QModelIndex index);
|
||||||
void removeDownload(QString bookId);
|
void setDownloadState(QString bookId, std::shared_ptr<DownloadState> ds);
|
||||||
void updateDownload(QString bookId);
|
void updateDownload(QString bookId);
|
||||||
|
|
||||||
private: // functions
|
private: // functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user