mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 10:46:15 +03:00
FEATURE: Added "Amount downloaded/left" columns to transfer list
Fix bug in column display menu
This commit is contained in:
parent
3144bfebc7
commit
a640b08414
7 changed files with 21 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
- FEATURE: The optimal piece size is now automatically computed in the torrent creation tool
|
||||
- FEATURE: Bring up the connection settings when clicking on the connection status icon
|
||||
- FEATURE: Major code refactoring and optimization
|
||||
- FEATURE: Added "Amount downloaded/left" columns to transfer list
|
||||
- COSMETIC: Replaced message box by on-screen notification for download errors
|
||||
- COSMETIC: Improved the torrent creation tool appearance
|
||||
- OTHERS: Dropped support for Qt <= 4.4
|
||||
|
|
|
@ -146,6 +146,10 @@ size_type QTorrentHandle::total_wanted_done() const {
|
|||
return torrent_handle::status().total_wanted_done;
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_wanted() const {
|
||||
return torrent_handle::status().total_wanted;
|
||||
}
|
||||
|
||||
float QTorrentHandle::download_payload_rate() const {
|
||||
return torrent_handle::status().download_payload_rate;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ class QTorrentHandle : public torrent_handle {
|
|||
size_type piece_length() const;
|
||||
int num_pieces() const;
|
||||
size_type total_wanted_done() const;
|
||||
size_type total_wanted() const;
|
||||
float download_payload_rate() const;
|
||||
float upload_payload_rate() const;
|
||||
int num_connections() const;
|
||||
|
|
|
@ -180,6 +180,10 @@ QVariant TorrentModelItem::data(int column, int role) const
|
|||
return m_torrent.download_limit();
|
||||
case TR_UPLIMIT:
|
||||
return m_torrent.upload_limit();
|
||||
case TR_AMOUNT_DOWNLOADED:
|
||||
return static_cast<qlonglong>(m_torrent.total_wanted_done());
|
||||
case TR_AMOUNT_LEFT:
|
||||
return static_cast<qlonglong>(m_torrent.total_wanted() - m_torrent.total_wanted_done());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -241,6 +245,8 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation,
|
|||
case TorrentModelItem::TR_TRACKER: return tr("Tracker");
|
||||
case TorrentModelItem::TR_DLLIMIT: return tr("Down Limit", "i.e: Download limit");
|
||||
case TorrentModelItem::TR_UPLIMIT: return tr("Up Limit", "i.e: Upload limit");
|
||||
case TorrentModelItem::TR_AMOUNT_DOWNLOADED: return tr("Amount downloaded", "Amount of data downloaded (e.g. in MB)");
|
||||
case TorrentModelItem::TR_AMOUNT_LEFT: return tr("Amount left", "Amount of data left to download (e.g. in MB)");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -256,6 +262,8 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation,
|
|||
case TorrentModelItem::TR_RATIO:
|
||||
case TorrentModelItem::TR_DLLIMIT:
|
||||
case TorrentModelItem::TR_UPLIMIT:
|
||||
case TorrentModelItem::TR_AMOUNT_DOWNLOADED:
|
||||
case TorrentModelItem::TR_AMOUNT_LEFT:
|
||||
return Qt::AlignRight;
|
||||
case TorrentModelItem::TR_PROGRESS:
|
||||
return Qt::AlignHCenter;
|
||||
|
@ -299,7 +307,7 @@ int TorrentModel::torrentRow(const QString &hash) const
|
|||
QList<TorrentModelItem*>::const_iterator it;
|
||||
int row = 0;
|
||||
for(it = m_torrents.constBegin(); it != m_torrents.constEnd(); it++) {
|
||||
if((*it)->hash() == hash) return row;
|
||||
if((*it)->hash() == hash) return row;
|
||||
++row;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -49,7 +49,7 @@ Q_OBJECT
|
|||
|
||||
public:
|
||||
enum State {STATE_DOWNLOADING, STATE_STALLED_DL, STATE_STALLED_UP, STATE_SEEDING, STATE_PAUSED_DL, STATE_PAUSED_UP, STATE_QUEUED_DL, STATE_QUEUED_UP, STATE_CHECKING_UP, STATE_CHECKING_DL, STATE_INVALID};
|
||||
enum Column {TR_NAME, TR_PRIORITY, TR_SIZE, TR_PROGRESS, TR_STATUS, TR_SEEDS, TR_PEERS, TR_DLSPEED, TR_UPSPEED, TR_ETA, TR_RATIO, TR_LABEL, TR_ADD_DATE, TR_SEED_DATE, TR_TRACKER, TR_DLLIMIT, TR_UPLIMIT, NB_COLUMNS};
|
||||
enum Column {TR_NAME, TR_PRIORITY, TR_SIZE, TR_PROGRESS, TR_STATUS, TR_SEEDS, TR_PEERS, TR_DLSPEED, TR_UPSPEED, TR_ETA, TR_RATIO, TR_LABEL, TR_ADD_DATE, TR_SEED_DATE, TR_TRACKER, TR_DLLIMIT, TR_UPLIMIT, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_LEFT, NB_COLUMNS};
|
||||
|
||||
public:
|
||||
TorrentModelItem(const QTorrentHandle& h);
|
||||
|
|
|
@ -60,6 +60,8 @@ public:
|
|||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
painter->save();
|
||||
switch(index.column()){
|
||||
case TorrentModelItem::TR_AMOUNT_DOWNLOADED:
|
||||
case TorrentModelItem::TR_AMOUNT_LEFT:
|
||||
case TorrentModelItem::TR_SIZE:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
opt.displayAlignment = Qt::AlignRight;
|
||||
|
|
|
@ -512,6 +512,8 @@ bool TransferListWidget::loadHiddenColumns() {
|
|||
setColumnHidden(TorrentModelItem::TR_UPLIMIT, true);
|
||||
setColumnHidden(TorrentModelItem::TR_DLLIMIT, true);
|
||||
setColumnHidden(TorrentModelItem::TR_TRACKER, true);
|
||||
setColumnHidden(TorrentModelItem::TR_AMOUNT_DOWNLOADED, true);
|
||||
setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true);
|
||||
}
|
||||
return loaded;
|
||||
}
|
||||
|
@ -521,7 +523,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&){
|
|||
QMenu hideshowColumn(this);
|
||||
hideshowColumn.setTitle(tr("Column visibility"));
|
||||
QList<QAction*> actions;
|
||||
for(int i=0; i < listModel->rowCount(); ++i) {
|
||||
for(int i=0; i < listModel->columnCount(); ++i) {
|
||||
if(!BTSession->isQueueingEnabled() && i == TorrentModelItem::TR_PRIORITY) {
|
||||
actions.append(0);
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue