diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index debde3626..95554036c 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -210,18 +210,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const { void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) { if (h.is_valid() && h == _h) { - QString p; - if (h.has_metadata() && h.num_files() == 1) { - p = h.firstFileSavePath(); - } else { - p = TorrentPersistentData::getSavePath(h.hash()); - if (p.isEmpty()) - p = h.save_path(); - } -#if defined(Q_WS_WIN) || defined(Q_OS_OS2) - p.replace("/", "\\"); -#endif - save_path->setText(p); + save_path->setText(h.save_path_parsed()); } } diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index 10ca92193..687e07c25 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -277,6 +277,21 @@ QString QTorrentHandle::save_path() const { #endif } +QString QTorrentHandle::save_path_parsed() const { + QString p; + if (has_metadata() && num_files() == 1) { + p = firstFileSavePath(); + } else { + p = TorrentPersistentData::getSavePath(hash()); + if (p.isEmpty()) + p = save_path(); + } +#if defined(Q_WS_WIN) || defined(Q_OS_OS2) + p.replace("/", "\\"); +#endif + return p; +} + QStringList QTorrentHandle::url_seeds() const { QStringList res; try { diff --git a/src/qtlibtorrent/qtorrenthandle.h b/src/qtlibtorrent/qtorrenthandle.h index 5a60a4d00..a32453f48 100644 --- a/src/qtlibtorrent/qtorrenthandle.h +++ b/src/qtlibtorrent/qtorrenthandle.h @@ -78,6 +78,7 @@ public: int num_complete() const; int num_incomplete() const; QString save_path() const; + QString save_path_parsed() const; QStringList url_seeds() const; libtorrent::size_type actual_size() const; int num_files() const; diff --git a/src/qtlibtorrent/torrentmodel.cpp b/src/qtlibtorrent/torrentmodel.cpp index bc8129262..2f34cf2be 100644 --- a/src/qtlibtorrent/torrentmodel.cpp +++ b/src/qtlibtorrent/torrentmodel.cpp @@ -198,6 +198,8 @@ QVariant TorrentModelItem::data(int column, int role) const 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(); + case TR_SAVE_PATH: + return m_torrent.save_path_parsed(); default: return QVariant(); } @@ -267,6 +269,7 @@ QVariant TorrentModel::headerData(int section, Qt::Orientation orientation, 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)"); + case TorrentModelItem::TR_SAVE_PATH: return tr("Save path", "Torrent save path"); default: return QVariant(); } diff --git a/src/qtlibtorrent/torrentmodel.h b/src/qtlibtorrent/torrentmodel.h index 328e604c1..cdecfe4fb 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_UPLOADED, 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, TR_SAVE_PATH, NB_COLUMNS}; public: TorrentModelItem(const QTorrentHandle& h); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 28f1d12c1..a8326097a 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -124,6 +124,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window, setColumnHidden(TorrentModelItem::TR_AMOUNT_UPLOADED, true); setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true); setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true); + setColumnHidden(TorrentModelItem::TR_SAVE_PATH, true); } //When adding/removing columns between versions some may