mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Made DownloadManager::Downloads private
This commit is contained in:
parent
e6c2effa0f
commit
efddb36fef
@ -187,7 +187,9 @@ void ContentManager::updateModel()
|
||||
auto mp = getBookInfos(bookId, keys);
|
||||
bookList.append(mp);
|
||||
}
|
||||
managerModel->setBooksData(bookList, m_downloads);
|
||||
|
||||
const DownloadManager& downloadMgr = *this;
|
||||
managerModel->setBooksData(bookList, downloadMgr);
|
||||
}
|
||||
|
||||
void ContentManager::onCustomContextMenu(const QPoint &point)
|
||||
|
@ -153,7 +153,7 @@ QVariant ContentManagerModel::headerData(int section, Qt::Orientation orientatio
|
||||
}
|
||||
}
|
||||
|
||||
void ContentManagerModel::setBooksData(const BookInfoList& data, const Downloads& downloads)
|
||||
void ContentManagerModel::setBooksData(const BookInfoList& data, const DownloadManager& downloadMgr)
|
||||
{
|
||||
rootNode = std::shared_ptr<RowNode>(new RowNode({tr("Icon"), tr("Name"), tr("Date"), tr("Size"), tr("Content Type"), tr("Download")}, "", std::weak_ptr<RowNode>()));
|
||||
beginResetModel();
|
||||
@ -162,7 +162,7 @@ void ContentManagerModel::setBooksData(const BookInfoList& data, const Downloads
|
||||
const auto rowNode = createNode(bookItem);
|
||||
|
||||
// Restore download state during model updates (filtering, etc)
|
||||
rowNode->setDownloadState(downloads.value(rowNode->getBookId()));
|
||||
rowNode->setDownloadState(downloadMgr.getDownloadState(rowNode->getBookId()));
|
||||
|
||||
bookIdToRowMap[bookItem["id"].toString()] = rootNode->childCount();
|
||||
rootNode->appendChild(rowNode);
|
||||
|
@ -23,8 +23,6 @@ public: // types
|
||||
typedef QMap<QString, QVariant> BookInfo;
|
||||
typedef QList<BookInfo> BookInfoList;
|
||||
|
||||
typedef DownloadManager::Downloads Downloads;
|
||||
|
||||
public: // functions
|
||||
explicit ContentManagerModel(ContentManager* contentMgr);
|
||||
~ContentManagerModel();
|
||||
@ -38,7 +36,7 @@ public: // functions
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
void setBooksData(const BookInfoList& data, const Downloads& downloads);
|
||||
void setBooksData(const BookInfoList& data, const DownloadManager& downloadMgr);
|
||||
bool hasChildren(const QModelIndex &parent) const override;
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
||||
|
||||
|
@ -35,6 +35,7 @@ class DownloadManager : public QObject
|
||||
public: // types
|
||||
typedef std::shared_ptr<DownloadState> DownloadStatePtr;
|
||||
|
||||
private:
|
||||
// BookId -> DownloadState map
|
||||
class Downloads
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user