diff --git a/Changelog b/Changelog index ff4e25afb..e54a0fe83 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 590426911..9367d4401 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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); } diff --git a/src/properties/propertieswidget.ui b/src/properties/propertieswidget.ui index 10785888f..e9c7a94e5 100644 --- a/src/properties/propertieswidget.ui +++ b/src/properties/propertieswidget.ui @@ -53,7 +53,7 @@ 0 - -92 + 0 520 377 @@ -293,7 +293,7 @@ - Time elapsed: + Time active: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index 1bf1d2ee1..05a6fac88 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -184,6 +184,8 @@ QVariant TorrentModelItem::data(int column, int role) const return static_cast(m_torrent.total_wanted_done()); case TR_AMOUNT_LEFT: return static_cast(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(); } @@ -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(); } diff --git a/src/qtlibtorrent/torrentmodel.h b/src/qtlibtorrent/torrentmodel.h index 32bcef8f5..5cd341c1f 100644 --- a/src/qtlibtorrent/torrentmodel.h +++ b/src/qtlibtorrent/torrentmodel.h @@ -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); diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index f05fa68f3..34bd8740e 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -137,6 +137,15 @@ public: 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); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 430e3fcc4..a437fcf28 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -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);