mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 03:50:20 -07:00
Remove button to change save path from lower panel
This commit is contained in:
parent
dfe5fbe34c
commit
cfb4ded943
3 changed files with 3 additions and 87 deletions
|
@ -245,7 +245,6 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle &_h) {
|
|||
try {
|
||||
// Save path
|
||||
updateSavePath(h);
|
||||
changeSavePathButton->setEnabled(h.has_metadata());
|
||||
// Hash
|
||||
hash_lbl->setText(h.hash());
|
||||
PropListModel->model()->clear();
|
||||
|
@ -662,56 +661,6 @@ bool PropertiesWidget::applyPriorities() {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PropertiesWidget::on_changeSavePathButton_clicked() {
|
||||
if (!h.is_valid()) return;
|
||||
QString new_path;
|
||||
if (h.has_metadata() && h.num_files() == 1) {
|
||||
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), h.firstFileSavePath());
|
||||
} else {
|
||||
const QDir saveDir(TorrentPersistentData::getSavePath(h.hash()));
|
||||
new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(),
|
||||
QFileDialog::DontConfirmOverwrite|QFileDialog::ShowDirsOnly|QFileDialog::HideNameFilterDetails);
|
||||
}
|
||||
if (!new_path.isEmpty()) {
|
||||
// Check if savePath exists
|
||||
QString save_path_dir = new_path.replace("\\", "/");
|
||||
QString new_file_name;
|
||||
if (h.has_metadata() && h.num_files() == 1) {
|
||||
save_path_dir = fsutils::branchPath(save_path_dir, &new_file_name); // Skip file name
|
||||
}
|
||||
QDir savePath(fsutils::expandPath(save_path_dir));
|
||||
// Actually move storage
|
||||
if (!QBtSession::instance()->useTemporaryFolder() || h.is_seed()) {
|
||||
if (!savePath.exists()) savePath.mkpath(savePath.absolutePath());
|
||||
h.move_storage(savePath.absolutePath());
|
||||
}
|
||||
// Update save_path in dialog
|
||||
QString display_path;
|
||||
if (h.has_metadata() && h.num_files() == 1) {
|
||||
// Rename the file
|
||||
Q_ASSERT(!new_file_name.isEmpty());
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
if (h.filename_at(0).compare(new_file_name, Qt::CaseInsensitive) != 0) {
|
||||
#else
|
||||
if (h.filename_at(0).compare(new_file_name, Qt::CaseSensitive) != 0) {
|
||||
#endif
|
||||
qDebug("Renaming single file to %s", qPrintable(new_file_name));
|
||||
h.rename_file(0, new_file_name);
|
||||
// Also rename it in the files list model
|
||||
PropListModel->setData(PropListModel->index(0, 0), new_file_name);
|
||||
}
|
||||
display_path = h.firstFileSavePath();
|
||||
} else {
|
||||
display_path = savePath.absolutePath();
|
||||
}
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
display_path.replace("/", "\\");
|
||||
#endif
|
||||
save_path->setText(display_path);
|
||||
}
|
||||
}
|
||||
|
||||
void PropertiesWidget::filteredFilesChanged() {
|
||||
if (h.is_valid()) {
|
||||
applyPriorities();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue