From ccf0002c0fb4bd3b115afd08d2051c7f10b1b759 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 9 Oct 2010 15:23:51 +0000 Subject: [PATCH] FEATURE: Added a transfer list column to display the current tracker --- Changelog | 1 + src/transferlistdelegate.h | 2 +- src/transferlistwidget.cpp | 15 ++++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 3efea5e1b..557b5fae9 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,6 @@ * Unreleased - Christophe Dumez - v2.5.0 - FEATURE: Added feature to shutdown qbittorrent on torrents completion + - FEATURE: Added a transfer list column to display the current tracker * Tue Aug 24 2010 - Christophe Dumez - v2.4.0 - FEATURE: Added actions to "Move to top/bottom" of priority queue diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index 3319defca..c3c676ee4 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -47,7 +47,7 @@ // Defines for download list list columns enum TorrentState {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_DLLIMIT, TR_UPLIMIT, TR_HASH}; +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_HASH}; class TransferListDelegate: public QItemDelegate { Q_OBJECT diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 98796bfda..a69e9c6fe 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -63,7 +63,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittor setItemDelegate(listDelegate); // Create transfer list model - listModel = new QStandardItemModel(0,17); + listModel = new QStandardItemModel(0,18); listModel->setHeaderData(TR_NAME, Qt::Horizontal, tr("Name", "i.e: torrent name")); listModel->setHeaderData(TR_PRIORITY, Qt::Horizontal, "#"); listModel->horizontalHeaderItem(TR_PRIORITY)->setTextAlignment(Qt::AlignRight); @@ -86,6 +86,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittor listModel->setHeaderData(TR_LABEL, Qt::Horizontal, tr("Label")); listModel->setHeaderData(TR_ADD_DATE, Qt::Horizontal, tr("Added On", "Torrent was added to transfer list on 01/01/2010 08:00")); listModel->setHeaderData(TR_SEED_DATE, Qt::Horizontal, tr("Completed On", "Torrent was completed on 01/01/2010 08:00")); + listModel->setHeaderData(TR_TRACKER, Qt::Horizontal, tr("Tracker")); listModel->setHeaderData(TR_DLLIMIT, Qt::Horizontal, tr("Down Limit", "i.e: Download limit")); listModel->horizontalHeaderItem(TR_DLLIMIT)->setTextAlignment(Qt::AlignRight); listModel->setHeaderData(TR_UPLIMIT, Qt::Horizontal, tr("Up Limit", "i.e: Upload limit"));; @@ -358,6 +359,9 @@ int TransferListWidget::updateTorrent(int row) { peers += 1; listModel->setData(listModel->index(row, TR_PEERS), QVariant(peers)); } + if(!isColumnHidden(TR_TRACKER)) { + listModel->setData(listModel->index(row, TR_TRACKER), QVariant(h.current_tracker())); + } // Update torrent size. It changes when files are filtered from torrent properties // or Web UI listModel->setData(listModel->index(row, TR_SIZE), QVariant((qlonglong)h.actual_size())); @@ -1005,6 +1009,7 @@ bool TransferListWidget::loadHiddenColumns() { setColumnHidden(TR_SEED_DATE, true); setColumnHidden(TR_UPLIMIT, true); setColumnHidden(TR_DLLIMIT, true); + setColumnHidden(TR_TRACKER, true); } return loaded; } @@ -1465,13 +1470,13 @@ void TransferListWidget::applyStatusFilter(int f) { switch(f) { case FILTER_DOWNLOADING: statusFilterModel->setFilterRegExp(QRegExp(QString::number(STATE_DOWNLOADING)+"|"+QString::number(STATE_STALLED_DL)+"|"+ - QString::number(STATE_PAUSED_DL)+"|"+QString::number(STATE_CHECKING_DL)+"|"+ - QString::number(STATE_QUEUED_DL), Qt::CaseSensitive)); + QString::number(STATE_PAUSED_DL)+"|"+QString::number(STATE_CHECKING_DL)+"|"+ + QString::number(STATE_QUEUED_DL), Qt::CaseSensitive)); break; case FILTER_COMPLETED: statusFilterModel->setFilterRegExp(QRegExp(QString::number(STATE_SEEDING)+"|"+QString::number(STATE_STALLED_UP)+"|"+ - QString::number(STATE_PAUSED_UP)+"|"+QString::number(STATE_CHECKING_UP)+"|"+ - QString::number(STATE_QUEUED_UP), Qt::CaseSensitive)); + QString::number(STATE_PAUSED_UP)+"|"+QString::number(STATE_CHECKING_UP)+"|"+ + QString::number(STATE_QUEUED_UP), Qt::CaseSensitive)); break; case FILTER_ACTIVE: statusFilterModel->setFilterRegExp(QRegExp(QString::number(STATE_DOWNLOADING)+"|"+QString::number(STATE_SEEDING), Qt::CaseSensitive));