Skip to content

Commit

Permalink
FEATURE: Added "Time Active/Seeded" column to transfer list
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Dumez committed Dec 21, 2010
1 parent a421c2a commit bc035b3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- FEATURE: Simplify program preferences
- FEATURE: Software update check can now be disabled (Mac OS X / Windows)
- FEATURE: Display pieces size in torrent properties
- FEATURE: Added "Time Active/Seeded" column to transfer list
- COSMETIC: Same deletion confirmation dialog in the GUI and Web UI
- COSMETIC: Simplified the top toolbar
- COSMETIC: Display execution log as a tab instead of a modal window
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,8 +1268,8 @@ void MainWindow::on_actionExecution_Logs_triggered(bool checked)
int index_tab = tabs->addTab(m_executionLog, tr("Execution Log"));
tabs->setTabIcon(index_tab, misc::getIcon("view-calendar-journal"));
} else {
Q_ASSERT(m_executionLog);
delete m_executionLog;
if(m_executionLog)
delete m_executionLog;
}
Preferences().setExecutionLogEnabled(checked);
}
4 changes: 2 additions & 2 deletions src/properties/propertieswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-92</y>
<y>0</y>
<width>520</width>
<height>377</height>
</rect>
Expand Down Expand Up @@ -293,7 +293,7 @@
<item row="2" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Time elapsed:</string>
<string extracomment="Time (duration) the torrent is active (not paused)">Time active:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
Expand Down
3 changes: 3 additions & 0 deletions src/qtlibtorrent/torrentmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ QVariant TorrentModelItem::data(int column, int role) const
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());
case TR_TIME_ELAPSED:
return (role == Qt::DisplayRole) ? m_torrent.active_time() : m_torrent.seeding_time();
default:
return QVariant();
}
Expand Down Expand Up @@ -247,6 +249,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation,
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)");
case TorrentModelItem::TR_TIME_ELAPSED: return tr("Time Active", "Time (duration) the torrent is active (not paused)");
default:
return QVariant();
}
Expand Down
2 changes: 1 addition & 1 deletion src/qtlibtorrent/torrentmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, TR_AMOUNT_DOWNLOADED, TR_AMOUNT_LEFT, 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, TR_TIME_ELAPSED, NB_COLUMNS};

public:
TorrentModelItem(const QTorrentHandle& h);
Expand Down
9 changes: 9 additions & 0 deletions src/transferlistdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ class TransferListDelegate: public QItemDelegate {
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8(""));
break;
}
case TorrentModelItem::TR_TIME_ELAPSED: {
QItemDelegate::drawBackground(painter, opt, index);
QString txt = misc::userFriendlyDuration(index.data().toLongLong());
qlonglong seeding_time = index.data(Qt::UserRole).toLongLong();
if(seeding_time > 0)
txt += " ("+tr("Seeded for %1", "e.g. Seeded for 3m10s").arg(misc::userFriendlyDuration(seeding_time))+")";
QItemDelegate::drawDisplay(painter, opt, opt.rect, txt);
break;
}
case TorrentModelItem::TR_ADD_DATE:
case TorrentModelItem::TR_SEED_DATE:
QItemDelegate::drawBackground(painter, opt, index);
Expand Down
1 change: 1 addition & 0 deletions src/transferlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window,
setColumnHidden(TorrentModelItem::TR_TRACKER, true);
setColumnHidden(TorrentModelItem::TR_AMOUNT_DOWNLOADED, true);
setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true);
setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true);

setContextMenuPolicy(Qt::CustomContextMenu);

Expand Down

0 comments on commit bc035b3

Please sign in to comment.