|
|
@ -331,19 +331,35 @@ QVector<BitTorrent::Torrent *> TransferListWidget::getVisibleTorrents() const |
|
|
|
void TransferListWidget::setSelectedTorrentsLocation() |
|
|
|
void TransferListWidget::setSelectedTorrentsLocation() |
|
|
|
{ |
|
|
|
{ |
|
|
|
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents(); |
|
|
|
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents(); |
|
|
|
if (torrents.isEmpty()) return; |
|
|
|
if (torrents.isEmpty()) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
const QString oldLocation = torrents[0]->savePath(); |
|
|
|
const QString oldLocation = torrents[0]->savePath(); |
|
|
|
const QString newLocation = QFileDialog::getExistingDirectory(this, tr("Choose save path"), oldLocation, |
|
|
|
|
|
|
|
(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails)); |
|
|
|
|
|
|
|
if (newLocation.isEmpty() || !QDir(newLocation).exists()) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Actually move storage
|
|
|
|
auto fileDialog = new QFileDialog(this, tr("Choose save path"), oldLocation); |
|
|
|
for (BitTorrent::Torrent *const torrent : torrents) |
|
|
|
fileDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
|
|
|
|
|
|
fileDialog->setFileMode(QFileDialog::Directory); |
|
|
|
|
|
|
|
fileDialog->setModal(true); |
|
|
|
|
|
|
|
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails); |
|
|
|
|
|
|
|
connect(fileDialog, &QDialog::accepted, this, [this, fileDialog]() |
|
|
|
{ |
|
|
|
{ |
|
|
|
torrent->setAutoTMMEnabled(false); |
|
|
|
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents(); |
|
|
|
torrent->setSavePath(Utils::Fs::expandPathAbs(newLocation)); |
|
|
|
if (torrents.isEmpty()) |
|
|
|
} |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QString newLocation = fileDialog->selectedFiles().constFirst(); |
|
|
|
|
|
|
|
if (newLocation.isEmpty() || !QDir(newLocation).exists()) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Actually move storage
|
|
|
|
|
|
|
|
for (BitTorrent::Torrent *const torrent : torrents) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
torrent->setAutoTMMEnabled(false); |
|
|
|
|
|
|
|
torrent->setSavePath(newLocation); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileDialog->show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TransferListWidget::pauseAllTorrents() |
|
|
|
void TransferListWidget::pauseAllTorrents() |
|
|
|