mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Refactor
This commit is contained in:
parent
132cc7f788
commit
fa45ba102c
@ -1280,7 +1280,7 @@ void TorrentHandle::moveStorage(const QString &newPath)
|
||||
m_queuedPath = newPath;
|
||||
}
|
||||
else {
|
||||
QString oldPath = nativeActualSavePath();
|
||||
const QString oldPath = nativeActualSavePath();
|
||||
if (QDir(oldPath) == QDir(newPath)) return;
|
||||
|
||||
qDebug("move storage: %s to %s", qPrintable(oldPath), qPrintable(newPath));
|
||||
@ -1347,7 +1347,7 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p)
|
||||
return;
|
||||
}
|
||||
|
||||
QString newPath = Utils::String::fromStdString(p->path);
|
||||
const QString newPath = Utils::String::fromStdString(p->path);
|
||||
if (newPath != m_newPath) {
|
||||
qWarning() << Q_FUNC_INFO << ": New path doesn't match a path in a queue.";
|
||||
return;
|
||||
|
@ -249,18 +249,17 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
||||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty()) return;
|
||||
|
||||
QString dir;
|
||||
const QDir saveDir(torrents[0]->savePath());
|
||||
qDebug("Old save path is %s", qPrintable(saveDir.absolutePath()));
|
||||
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(),
|
||||
const QString oldLocation = torrents[0]->savePath();
|
||||
qDebug("Old location is %s", qPrintable(oldLocation));
|
||||
|
||||
const QString newLocation = QFileDialog::getExistingDirectory(this, tr("Choose save path"), oldLocation,
|
||||
QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
||||
if (!dir.isNull()) {
|
||||
qDebug("New path is %s", qPrintable(dir));
|
||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents) {
|
||||
// Actually move storage
|
||||
torrent->move(Utils::Fs::expandPathAbs(dir));
|
||||
}
|
||||
}
|
||||
if (!QDir(newLocation).exists()) return;
|
||||
qDebug("New location is %s", qPrintable(newLocation));
|
||||
|
||||
// Actually move storage
|
||||
foreach (BitTorrent::TorrentHandle *const torrent, torrents)
|
||||
torrent->move(Utils::Fs::expandPathAbs(newLocation));
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseAllTorrents()
|
||||
|
Loading…
Reference in New Issue
Block a user