mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 23:37:59 +00:00
Adding "Save path" column
because it's useful when moving files It's the same path as in properties because that's consistent
This commit is contained in:
parent
4f667c6e7d
commit
d1c3a07ba6
@ -210,18 +210,7 @@ QTorrentHandle PropertiesWidget::getCurrentTorrent() const {
|
|||||||
|
|
||||||
void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) {
|
void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) {
|
||||||
if (h.is_valid() && h == _h) {
|
if (h.is_valid() && h == _h) {
|
||||||
QString p;
|
save_path->setText(h.save_path_parsed());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +277,21 @@ QString QTorrentHandle::save_path() const {
|
|||||||
#endif
|
#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 QTorrentHandle::url_seeds() const {
|
||||||
QStringList res;
|
QStringList res;
|
||||||
try {
|
try {
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
int num_complete() const;
|
int num_complete() const;
|
||||||
int num_incomplete() const;
|
int num_incomplete() const;
|
||||||
QString save_path() const;
|
QString save_path() const;
|
||||||
|
QString save_path_parsed() const;
|
||||||
QStringList url_seeds() const;
|
QStringList url_seeds() const;
|
||||||
libtorrent::size_type actual_size() const;
|
libtorrent::size_type actual_size() const;
|
||||||
int num_files() const;
|
int num_files() const;
|
||||||
|
@ -197,6 +197,8 @@ QVariant TorrentModelItem::data(int column, int role) const
|
|||||||
return static_cast<qlonglong>(m_torrent.total_wanted() - m_torrent.total_wanted_done());
|
return static_cast<qlonglong>(m_torrent.total_wanted() - m_torrent.total_wanted_done());
|
||||||
case TR_TIME_ELAPSED:
|
case TR_TIME_ELAPSED:
|
||||||
return (role == Qt::DisplayRole) ? m_torrent.active_time() : m_torrent.seeding_time();
|
return (role == Qt::DisplayRole) ? m_torrent.active_time() : m_torrent.seeding_time();
|
||||||
|
case TR_SAVE_PATH:
|
||||||
|
return m_torrent.save_path_parsed();
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -266,6 +268,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_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_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_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:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ Q_OBJECT
|
|||||||
|
|
||||||
public:
|
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 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:
|
public:
|
||||||
TorrentModelItem(const QTorrentHandle& h);
|
TorrentModelItem(const QTorrentHandle& h);
|
||||||
|
@ -123,6 +123,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window,
|
|||||||
setColumnHidden(TorrentModelItem::TR_AMOUNT_UPLOADED, true);
|
setColumnHidden(TorrentModelItem::TR_AMOUNT_UPLOADED, true);
|
||||||
setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true);
|
setColumnHidden(TorrentModelItem::TR_AMOUNT_LEFT, true);
|
||||||
setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true);
|
setColumnHidden(TorrentModelItem::TR_TIME_ELAPSED, true);
|
||||||
|
setColumnHidden(TorrentModelItem::TR_SAVE_PATH, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
Loading…
Reference in New Issue
Block a user