From 680998f9c2af02edfacb5813422e35e26cdb540b Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Thu, 27 Dec 2012 17:55:40 +0400 Subject: [PATCH 1/2] Add 'Uploaded' column to main view --- src/qtlibtorrent/torrentmodel.cpp | 4 ++++ src/qtlibtorrent/torrentmodel.h | 2 +- src/transferlistdelegate.h | 1 + src/transferlistwidget.cpp | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index b91e52450..245092c5e 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -191,6 +191,8 @@ QVariant TorrentModelItem::data(int column, int role) const return m_torrent.upload_limit(); case TR_AMOUNT_DOWNLOADED: return static_cast(m_torrent.total_wanted_done()); + case TR_AMOUNT_UPLOADED: + return static_cast(m_torrent.all_time_upload()); case TR_AMOUNT_LEFT: return static_cast(m_torrent.total_wanted() - m_torrent.total_wanted_done()); case TR_TIME_ELAPSED: @@ -261,6 +263,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, 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_UPLOADED: return tr("Amount uploaded", "Amount of data uploaded (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: @@ -279,6 +282,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, case TorrentModelItem::TR_DLLIMIT: case TorrentModelItem::TR_UPLIMIT: case TorrentModelItem::TR_AMOUNT_DOWNLOADED: + case TorrentModelItem::TR_AMOUNT_UPLOADED: case TorrentModelItem::TR_AMOUNT_LEFT: return Qt::AlignRight; case TorrentModelItem::TR_PROGRESS: diff --git a/src/qtlibtorrent/torrentmodel.h b/src/qtlibtorrent/torrentmodel.h index 33057b28e..328e604c1 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, TR_TIME_ELAPSED, 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_UPLOADED, TR_AMOUNT_LEFT, TR_TIME_ELAPSED, NB_COLUMNS}; public: TorrentModelItem(const QTorrentHandle& h); diff --git a/src/transferlistdelegate.h b/src/transferlistdelegate.h index 9926fa0c4..778d2e770 100644 --- a/src/transferlistdelegate.h +++ b/src/transferlistdelegate.h @@ -62,6 +62,7 @@ public: painter->save(); switch(index.column()) { case TorrentModelItem::TR_AMOUNT_DOWNLOADED: + case TorrentModelItem::TR_AMOUNT_UPLOADED: case TorrentModelItem::TR_AMOUNT_LEFT: case TorrentModelItem::TR_SIZE:{ QItemDelegate::drawBackground(painter, opt, index); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index eca0135ff..abe5865d3 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -120,6 +120,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window, setColumnHidden(TorrentModelItem::TR_DLLIMIT, true); setColumnHidden(TorrentModelItem::TR_TRACKER, true); setColumnHidden(TorrentModelItem::TR_AMOUNT_DOWNLOADED, true); + setColumnHidden(TorrentModelItem::TR_AMOUNT_UPLOADED, true); setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true); setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true); } From 54e99b73d6da72ddeb3d606a5362c236fb474623 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Thu, 27 Dec 2012 17:57:31 +0400 Subject: [PATCH 2/2] Fix 'Amount Uploaded' contradiction between main view and properties widget --- src/qtlibtorrent/torrentmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index 245092c5e..2dde082b0 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -190,7 +190,7 @@ QVariant TorrentModelItem::data(int column, int role) const case TR_UPLIMIT: return m_torrent.upload_limit(); case TR_AMOUNT_DOWNLOADED: - return static_cast(m_torrent.total_wanted_done()); + return static_cast(m_torrent.all_time_download()); case TR_AMOUNT_UPLOADED: return static_cast(m_torrent.all_time_upload()); case TR_AMOUNT_LEFT: