FEATURE: Added "Time Active/Seeded" column to transfer list

This commit is contained in:
Christophe Dumez 2010-12-21 18:25:44 +00:00
parent a421c2aa63
commit bc035b3873
7 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -53,7 +53,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-92</y>
<y>0</y>
<width>520</width>
<height>377</height>
</rect>
@ -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>

View file

@ -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();
}
@ -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();
}

View file

@ -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);

View file

@ -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);

View file

@ -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);