qBittorrent
|
#include <transferlistmodel.h>
Public Types | |
enum | Column { TR_QUEUE_POSITION , TR_NAME , TR_SIZE , TR_TOTAL_SIZE , TR_PROGRESS , TR_STATUS , TR_SEEDS , TR_PEERS , TR_DLSPEED , TR_UPSPEED , TR_ETA , TR_RATIO , TR_CATEGORY , TR_TAGS , TR_ADD_DATE , TR_SEED_DATE , TR_TRACKER , TR_DLLIMIT , TR_UPLIMIT , TR_AMOUNT_DOWNLOADED , TR_AMOUNT_UPLOADED , TR_AMOUNT_DOWNLOADED_SESSION , TR_AMOUNT_UPLOADED_SESSION , TR_AMOUNT_LEFT , TR_TIME_ELAPSED , TR_SAVE_PATH , TR_COMPLETED , TR_RATIO_LIMIT , TR_SEEN_COMPLETE_DATE , TR_LAST_ACTIVITY , TR_AVAILABILITY , NB_COLUMNS } |
enum | DataRole { UnderlyingDataRole = Qt::UserRole , AdditionalUnderlyingDataRole } |
Public Member Functions | |
TransferListModel (QObject *parent=nullptr) | |
int | rowCount (const QModelIndex &parent={}) const override |
int | columnCount (const QModelIndex &parent={}) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
BitTorrent::Torrent * | torrentHandle (const QModelIndex &index) const |
Private Types | |
enum class | HideZeroValuesMode { Never , Paused , Always } |
Private Slots | |
void | addTorrent (BitTorrent::Torrent *const torrent) |
void | handleTorrentAboutToBeRemoved (BitTorrent::Torrent *const torrent) |
void | handleTorrentStatusUpdated (BitTorrent::Torrent *const torrent) |
void | handleTorrentsUpdated (const QVector< BitTorrent::Torrent * > &torrents) |
Private Member Functions | |
void | configure () |
QString | displayValue (const BitTorrent::Torrent *torrent, int column) const |
QVariant | internalValue (const BitTorrent::Torrent *torrent, int column, bool alt) const |
Private Attributes | |
QList< BitTorrent::Torrent * > | m_torrentList |
QHash< BitTorrent::Torrent *, int > | m_torrentMap |
const QHash< BitTorrent::TorrentState, QString > | m_statusStrings |
const QHash< BitTorrent::TorrentState, QColor > | m_stateThemeColors |
HideZeroValuesMode | m_hideZeroValuesMode = HideZeroValuesMode::Never |
Definition at line 44 of file transferlistmodel.h.
Definition at line 50 of file transferlistmodel.h.
Enumerator | |
---|---|
UnderlyingDataRole | |
AdditionalUnderlyingDataRole |
Definition at line 87 of file transferlistmodel.h.
|
strongprivate |
Enumerator | |
---|---|
Never | |
Paused | |
Always |
Definition at line 121 of file transferlistmodel.h.
|
explicit |
Definition at line 108 of file transferlistmodel.cpp.
References BitTorrent::CheckingDownloading, BitTorrent::CheckingResumeData, BitTorrent::CheckingUploading, BitTorrent::Downloading, BitTorrent::DownloadingMetadata, BitTorrent::Error, BitTorrent::ForcedDownloading, BitTorrent::ForcedDownloadingMetadata, BitTorrent::ForcedUploading, BitTorrent::MissingFiles, BitTorrent::Moving, BitTorrent::PausedDownloading, BitTorrent::PausedUploading, BitTorrent::QueuedDownloading, BitTorrent::QueuedUploading, BitTorrent::StalledDownloading, BitTorrent::StalledUploading, and BitTorrent::Uploading.
|
privateslot |
Definition at line 568 of file transferlistmodel.cpp.
References m_torrentList, and m_torrentMap.
|
override |
Definition at line 158 of file transferlistmodel.cpp.
References NB_COLUMNS.
Referenced by configure(), TransferListWidget::displayDLHoSMenu(), handleTorrentStatusUpdated(), and handleTorrentsUpdated().
|
private |
Definition at line 640 of file transferlistmodel.cpp.
References Always, columnCount(), Preferences::getHideZeroComboValues(), Preferences::getHideZeroValues(), Preferences::instance(), m_hideZeroValuesMode, Never, Paused, and rowCount().
|
override |
Definition at line 482 of file transferlistmodel.cpp.
References AdditionalUnderlyingDataRole, displayValue(), getDefaultColorByState(), getIconByState(), internalValue(), m_stateThemeColors, m_torrentList, BitTorrent::Torrent::state(), TR_AMOUNT_DOWNLOADED, TR_AMOUNT_DOWNLOADED_SESSION, TR_AMOUNT_LEFT, TR_AMOUNT_UPLOADED, TR_AMOUNT_UPLOADED_SESSION, TR_AVAILABILITY, TR_CATEGORY, TR_COMPLETED, TR_DLLIMIT, TR_DLSPEED, TR_ETA, TR_LAST_ACTIVITY, TR_NAME, TR_PEERS, TR_QUEUE_POSITION, TR_RATIO, TR_RATIO_LIMIT, TR_SAVE_PATH, TR_SEEDS, TR_SIZE, TR_STATUS, TR_TAGS, TR_TOTAL_SIZE, TR_TRACKER, TR_UPLIMIT, TR_UPSPEED, and UnderlyingDataRole.
|
private |
Definition at line 239 of file transferlistmodel.cpp.
References BitTorrent::Torrent::activeTime(), BitTorrent::Torrent::addedTime(), Always, C_INFINITY, BitTorrent::Torrent::category(), BitTorrent::Torrent::completedSize(), BitTorrent::Torrent::completedTime(), BitTorrent::Torrent::currentTracker(), BitTorrent::Torrent::distributedCopies(), BitTorrent::Torrent::downloadLimit(), BitTorrent::Torrent::downloadPayloadRate(), BitTorrent::Error, BitTorrent::Torrent::error(), BitTorrent::Torrent::eta(), BitTorrent::Torrent::finishedTime(), Utils::Misc::friendlyUnit(), Utils::String::fromDouble(), OrderedSet< T, Compare >::join(), BitTorrent::Torrent::lastSeenComplete(), BitTorrent::Torrent::leechsCount(), m_hideZeroValuesMode, m_statusStrings, MAX_ETA, BitTorrent::Torrent::MAX_RATIO, BitTorrent::Torrent::maxRatio(), BitTorrent::Torrent::name(), Paused, BitTorrent::PausedDownloading, BitTorrent::Torrent::progress(), BitTorrent::Torrent::queuePosition(), BitTorrent::Torrent::realRatio(), BitTorrent::Torrent::remainingSize(), BitTorrent::Torrent::savePath(), BitTorrent::Torrent::seedsCount(), BitTorrent::Torrent::state(), BitTorrent::Torrent::tags(), BitTorrent::Torrent::timeSinceActivity(), Utils::Fs::toNativePath(), BitTorrent::Torrent::totalDownload(), BitTorrent::Torrent::totalLeechersCount(), BitTorrent::Torrent::totalPayloadDownload(), BitTorrent::Torrent::totalPayloadUpload(), BitTorrent::Torrent::totalSeedsCount(), BitTorrent::Torrent::totalSize(), BitTorrent::Torrent::totalUpload(), TR_ADD_DATE, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_DOWNLOADED_SESSION, TR_AMOUNT_LEFT, TR_AMOUNT_UPLOADED, TR_AMOUNT_UPLOADED_SESSION, TR_AVAILABILITY, TR_CATEGORY, TR_COMPLETED, TR_DLLIMIT, TR_DLSPEED, TR_ETA, TR_LAST_ACTIVITY, TR_NAME, TR_PEERS, TR_PROGRESS, TR_QUEUE_POSITION, TR_RATIO, TR_RATIO_LIMIT, TR_SAVE_PATH, TR_SEED_DATE, TR_SEEDS, TR_SEEN_COMPLETE_DATE, TR_SIZE, TR_STATUS, TR_TAGS, TR_TIME_ELAPSED, TR_TOTAL_SIZE, TR_TRACKER, TR_UPLIMIT, TR_UPSPEED, Utils::Misc::unitString(), BitTorrent::Torrent::uploadLimit(), BitTorrent::Torrent::uploadPayloadRate(), Utils::Misc::userFriendlyDuration(), anonymous_namespace{preferences.cpp}::value(), and BitTorrent::Torrent::wantedSize().
Referenced by data().
|
override |
Definition at line 580 of file transferlistmodel.cpp.
|
privateslot |
Definition at line 595 of file transferlistmodel.cpp.
References m_torrentList, m_torrentMap, and anonymous_namespace{preferences.cpp}::value().
|
privateslot |
Definition at line 611 of file transferlistmodel.cpp.
References columnCount(), and m_torrentMap.
|
privateslot |
Definition at line 619 of file transferlistmodel.cpp.
References columnCount(), m_torrentList, m_torrentMap, and rowCount().
|
override |
Definition at line 163 of file transferlistmodel.cpp.
References TR_ADD_DATE, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_DOWNLOADED_SESSION, TR_AMOUNT_LEFT, TR_AMOUNT_UPLOADED, TR_AMOUNT_UPLOADED_SESSION, TR_AVAILABILITY, TR_CATEGORY, TR_COMPLETED, TR_DLLIMIT, TR_DLSPEED, TR_ETA, TR_LAST_ACTIVITY, TR_NAME, TR_PEERS, TR_PROGRESS, TR_QUEUE_POSITION, TR_RATIO, TR_RATIO_LIMIT, TR_SAVE_PATH, TR_SEED_DATE, TR_SEEDS, TR_SEEN_COMPLETE_DATE, TR_SIZE, TR_STATUS, TR_TAGS, TR_TIME_ELAPSED, TR_TOTAL_SIZE, TR_TRACKER, TR_UPLIMIT, and TR_UPSPEED.
Referenced by TransferListWidget::displayDLHoSMenu().
|
private |
Definition at line 411 of file transferlistmodel.cpp.
References BitTorrent::Torrent::activeTime(), BitTorrent::Torrent::addedTime(), BitTorrent::Torrent::category(), BitTorrent::Torrent::completedSize(), BitTorrent::Torrent::completedTime(), BitTorrent::Torrent::currentTracker(), BitTorrent::Torrent::distributedCopies(), BitTorrent::Torrent::downloadLimit(), BitTorrent::Torrent::downloadPayloadRate(), BitTorrent::Torrent::eta(), BitTorrent::Torrent::finishedTime(), BitTorrent::Torrent::lastSeenComplete(), BitTorrent::Torrent::leechsCount(), BitTorrent::Torrent::maxRatio(), BitTorrent::Torrent::name(), BitTorrent::Torrent::progress(), BitTorrent::Torrent::queuePosition(), BitTorrent::Torrent::realRatio(), BitTorrent::Torrent::remainingSize(), BitTorrent::Torrent::savePath(), BitTorrent::Torrent::seedsCount(), BitTorrent::Torrent::state(), BitTorrent::Torrent::tags(), BitTorrent::Torrent::timeSinceActivity(), Utils::Fs::toNativePath(), BitTorrent::Torrent::totalDownload(), BitTorrent::Torrent::totalLeechersCount(), BitTorrent::Torrent::totalPayloadDownload(), BitTorrent::Torrent::totalPayloadUpload(), BitTorrent::Torrent::totalSeedsCount(), BitTorrent::Torrent::totalSize(), BitTorrent::Torrent::totalUpload(), TR_ADD_DATE, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_DOWNLOADED_SESSION, TR_AMOUNT_LEFT, TR_AMOUNT_UPLOADED, TR_AMOUNT_UPLOADED_SESSION, TR_AVAILABILITY, TR_CATEGORY, TR_COMPLETED, TR_DLLIMIT, TR_DLSPEED, TR_ETA, TR_LAST_ACTIVITY, TR_NAME, TR_PEERS, TR_PROGRESS, TR_QUEUE_POSITION, TR_RATIO, TR_RATIO_LIMIT, TR_SAVE_PATH, TR_SEED_DATE, TR_SEEDS, TR_SEEN_COMPLETE_DATE, TR_SIZE, TR_STATUS, TR_TAGS, TR_TIME_ELAPSED, TR_TOTAL_SIZE, TR_TRACKER, TR_UPLIMIT, TR_UPSPEED, BitTorrent::Torrent::uploadLimit(), BitTorrent::Torrent::uploadPayloadRate(), and BitTorrent::Torrent::wantedSize().
Referenced by data().
|
override |
Definition at line 153 of file transferlistmodel.cpp.
References m_torrentList.
Referenced by configure(), handleTorrentsUpdated(), and MainWindow::updateNbTorrents().
|
override |
Definition at line 545 of file transferlistmodel.cpp.
References m_torrentList, BitTorrent::Torrent::setCategory(), BitTorrent::Torrent::setName(), TR_CATEGORY, TR_NAME, and anonymous_namespace{preferences.cpp}::value().
Referenced by TransferListWidget::renameSelectedTorrent(), and TransferListWidget::setSelectionCategory().
BitTorrent::Torrent * TransferListModel::torrentHandle | ( | const QModelIndex & | index | ) | const |
Definition at line 588 of file transferlistmodel.cpp.
References m_torrentList.
Referenced by TransferListWidget::applyToSelectedTorrents(), TransferListWidget::currentChanged(), TransferListWidget::displayListMenu(), TransferListWidget::getSelectedTorrents(), TransferListWidget::getVisibleTorrents(), TransferListWidget::renameSelectedTorrent(), and TransferListWidget::torrentDoubleClicked().
|
private |
Definition at line 128 of file transferlistmodel.h.
Referenced by configure(), and displayValue().
|
private |
Definition at line 119 of file transferlistmodel.h.
Referenced by data().
|
private |
Definition at line 117 of file transferlistmodel.h.
Referenced by displayValue().
|
private |
Definition at line 115 of file transferlistmodel.h.
Referenced by addTorrent(), data(), handleTorrentAboutToBeRemoved(), handleTorrentsUpdated(), rowCount(), setData(), and torrentHandle().
|
private |
Definition at line 116 of file transferlistmodel.h.
Referenced by addTorrent(), handleTorrentAboutToBeRemoved(), handleTorrentStatusUpdated(), and handleTorrentsUpdated().