qBittorrent
|
#include <torrentcontentmodel.h>
Public Types | |
enum | Roles { UnderlyingDataRole = Qt::UserRole } |
Public Slots | |
void | selectAll () |
void | selectNone () |
Signals | |
void | filteredFilesChanged () |
Public Member Functions | |
TorrentContentModel (QObject *parent=nullptr) | |
~TorrentContentModel () override | |
void | updateFilesProgress (const QVector< qreal > &fp) |
void | updateFilesPriorities (const QVector< BitTorrent::DownloadPriority > &fprio) |
void | updateFilesAvailability (const QVector< qreal > &fa) |
QVector< BitTorrent::DownloadPriority > | getFilePriorities () const |
bool | allFiltered () const |
int | columnCount (const QModelIndex &parent={}) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
TorrentContentModelItem::ItemType | itemType (const QModelIndex &index) const |
int | getFileIndex (const QModelIndex &index) |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent={}) const override |
QModelIndex | parent (const QModelIndex &index) const override |
int | rowCount (const QModelIndex &parent={}) const override |
void | clear () |
void | setupModelData (const BitTorrent::AbstractFileStorage &info) |
Private Attributes | |
TorrentContentModelFolder * | m_rootItem |
QVector< TorrentContentModelFile * > | m_filesIndex |
QFileIconProvider * | m_fileIconProvider |
Definition at line 47 of file torrentcontentmodel.h.
TorrentContentModel::TorrentContentModel | ( | QObject * | parent = nullptr | ) |
Definition at line 191 of file torrentcontentmodel.cpp.
|
override |
Definition at line 205 of file torrentcontentmodel.cpp.
References m_fileIconProvider, and m_rootItem.
bool TorrentContentModel::allFiltered | ( | ) | const |
Definition at line 262 of file torrentcontentmodel.cpp.
References m_filesIndex.
void TorrentContentModel::clear | ( | ) |
Definition at line 479 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::deleteAllChildren(), m_filesIndex, and m_rootItem.
Referenced by PropertiesWidget::clear(), AddNewTorrentDialog::contentLayoutChanged(), and PropertiesWidget::loadTorrentInfos().
|
override |
Definition at line 270 of file torrentcontentmodel.cpp.
References TorrentContentModelItem::columnCount(), m_rootItem, and parent().
Referenced by selectAll(), selectNone(), setData(), updateFilesAvailability(), updateFilesPriorities(), and updateFilesProgress().
|
override |
Definition at line 343 of file torrentcontentmodel.cpp.
References TorrentContentModelItem::COL_NAME, TorrentContentModelItem::COL_REMAINING, TorrentContentModelItem::COL_SIZE, TorrentContentModelItem::FolderType, BitTorrent::Ignored, index(), m_fileIconProvider, and BitTorrent::Mixed.
|
signal |
Referenced by setData(), AddNewTorrentDialog::setupTreeview(), and TorrentContentFilterModel::TorrentContentFilterModel().
|
override |
Definition at line 390 of file torrentcontentmodel.cpp.
References TorrentContentModelItem::COL_PRIO, TorrentContentModelItem::FolderType, index(), and itemType().
int TorrentContentModel::getFileIndex | ( | const QModelIndex & | index | ) |
Definition at line 333 of file torrentcontentmodel.cpp.
References TorrentContentModelFile::fileIndex(), TorrentContentModelItem::FileType, and index().
Referenced by TorrentContentFilterModel::getFileIndex().
QVector< BitTorrent::DownloadPriority > TorrentContentModel::getFilePriorities | ( | ) | const |
Definition at line 253 of file torrentcontentmodel.cpp.
References asConst(), file(), and m_filesIndex.
Referenced by AddNewTorrentDialog::accept(), PropertiesWidget::applyPriorities(), AddNewTorrentDialog::contentLayoutChanged(), and AddNewTorrentDialog::updateDiskSpaceLabel().
|
override |
Definition at line 404 of file torrentcontentmodel.cpp.
References TorrentContentModelItem::COL_REMAINING, TorrentContentModelItem::COL_SIZE, TorrentContentModelItem::displayData(), and m_rootItem.
|
override |
Definition at line 425 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::child(), TorrentContentModelFolder::childCount(), m_rootItem, TorrentContentModelItem::NB_COL, and parent().
Referenced by data(), TorrentContentFilterModel::filterAcceptsRow(), flags(), getFileIndex(), TorrentContentFilterModel::hasFiltered(), itemType(), TorrentContentFilterModel::lessThan(), parent(), selectAll(), selectNone(), setData(), updateFilesAvailability(), updateFilesPriorities(), and updateFilesProgress().
TorrentContentModelItem::ItemType TorrentContentModel::itemType | ( | const QModelIndex & | index | ) | const |
Definition at line 328 of file torrentcontentmodel.cpp.
References index().
Referenced by TorrentContentFilterModel::filterAcceptsRow(), flags(), TorrentContentFilterModel::itemType(), and TorrentContentFilterModel::lessThan().
|
override |
Definition at line 449 of file torrentcontentmodel.cpp.
References index(), m_rootItem, TorrentContentModelItem::parent(), and TorrentContentModelItem::row().
Referenced by columnCount(), index(), TorrentContentFilterModel::parent(), and rowCount().
|
override |
Definition at line 465 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::childCount(), m_rootItem, and parent().
Referenced by TorrentContentFilterModel::hasFiltered(), selectAll(), selectNone(), setData(), updateFilesAvailability(), updateFilesPriorities(), and updateFilesProgress().
|
slot |
Definition at line 531 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::child(), TorrentContentModelFolder::childCount(), columnCount(), BitTorrent::Ignored, index(), m_rootItem, BitTorrent::Normal, TorrentContentModelItem::priority(), rowCount(), and TorrentContentModelItem::setPriority().
|
slot |
Definition at line 542 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::child(), TorrentContentModelFolder::childCount(), columnCount(), BitTorrent::Ignored, index(), m_rootItem, rowCount(), and TorrentContentModelItem::setPriority().
|
override |
Definition at line 278 of file torrentcontentmodel.cpp.
References TorrentContentModelItem::COL_NAME, TorrentContentModelItem::COL_PRIO, columnCount(), filteredFilesChanged(), BitTorrent::Ignored, index(), m_rootItem, BitTorrent::Mixed, BitTorrent::Normal, TorrentContentModelFolder::recalculateAvailability(), TorrentContentModelFolder::recalculateProgress(), rowCount(), and anonymous_namespace{preferences.cpp}::value().
void TorrentContentModel::setupModelData | ( | const BitTorrent::AbstractFileStorage & | info | ) |
Definition at line 488 of file torrentcontentmodel.cpp.
References TorrentContentModelFolder::appendChild(), asConst(), TorrentContentModelFolder::childFolderWithName(), Utils::Fs::fileName(), BitTorrent::AbstractFileStorage::filePath(), BitTorrent::AbstractFileStorage::filesCount(), BitTorrent::AbstractFileStorage::fileSize(), m_filesIndex, m_rootItem, and Utils::Fs::toUniformPath().
Referenced by AddNewTorrentDialog::contentLayoutChanged(), PropertiesWidget::loadDynamicData(), and AddNewTorrentDialog::setupTreeview().
void TorrentContentModel::updateFilesAvailability | ( | const QVector< qreal > & | fa | ) |
Definition at line 239 of file torrentcontentmodel.cpp.
References columnCount(), index(), m_filesIndex, m_rootItem, TorrentContentModelFolder::recalculateProgress(), and rowCount().
Referenced by PropertiesWidget::loadDynamicData().
void TorrentContentModel::updateFilesPriorities | ( | const QVector< BitTorrent::DownloadPriority > & | fprio | ) |
Definition at line 226 of file torrentcontentmodel.cpp.
References columnCount(), index(), m_filesIndex, and rowCount().
Referenced by AddNewTorrentDialog::contentLayoutChanged(), and PropertiesWidget::loadDynamicData().
void TorrentContentModel::updateFilesProgress | ( | const QVector< qreal > & | fp | ) |
Definition at line 211 of file torrentcontentmodel.cpp.
References columnCount(), index(), m_filesIndex, m_rootItem, TorrentContentModelFolder::recalculateAvailability(), TorrentContentModelFolder::recalculateProgress(), and rowCount().
Referenced by PropertiesWidget::loadDynamicData().
|
private |
Definition at line 89 of file torrentcontentmodel.h.
Referenced by data(), and ~TorrentContentModel().
|
private |
Definition at line 88 of file torrentcontentmodel.h.
Referenced by allFiltered(), clear(), getFilePriorities(), setupModelData(), updateFilesAvailability(), updateFilesPriorities(), and updateFilesProgress().
|
private |
Definition at line 87 of file torrentcontentmodel.h.
Referenced by clear(), columnCount(), headerData(), index(), parent(), rowCount(), selectAll(), selectNone(), setData(), setupModelData(), updateFilesAvailability(), updateFilesProgress(), and ~TorrentContentModel().