1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Fix "Set location" action

This commit is contained in:
Christophe Dumez 2010-08-18 08:46:04 +00:00
parent ff16f59be1
commit e7e5a2b4e9
3 changed files with 10 additions and 3 deletions

View File

@ -69,6 +69,7 @@ public:
QWidget* getCurrentTabWidget() const; QWidget* getCurrentTabWidget() const;
TransferListWidget* getTransferList() const { return transferList; } TransferListWidget* getTransferList() const { return transferList; }
QMenu* getTrayIconMenu(); QMenu* getTrayIconMenu();
PropertiesWidget *getProperties() const { return properties; }
public slots: public slots:
void trackerAuthenticationRequired(QTorrentHandle& h); void trackerAuthenticationRequired(QTorrentHandle& h);

View File

@ -99,7 +99,6 @@ protected slots:
void filteredFilesChanged(); void filteredFilesChanged();
void showPiecesDownloaded(bool show); void showPiecesDownloaded(bool show);
void showPiecesAvailability(bool show); void showPiecesAvailability(bool show);
void updateSavePath(QTorrentHandle& h);
void renameSelectedFile(); void renameSelectedFile();
void selectAllFiles(); void selectAllFiles();
void selectNoneFiles(); void selectNoneFiles();
@ -113,6 +112,7 @@ public slots:
void saveSettings(); void saveSettings();
void reloadPreferences(); void reloadPreferences();
void openDoubleClickedFile(QModelIndex); void openDoubleClickedFile(QModelIndex);
void updateSavePath(QTorrentHandle& h);
}; };

View File

@ -38,6 +38,7 @@
#include "GUI.h" #include "GUI.h"
#include "preferences.h" #include "preferences.h"
#include "deletionconfirmationdlg.h" #include "deletionconfirmationdlg.h"
#include "propertieswidget.h"
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -630,7 +631,8 @@ void TransferListWidget::setSelectedTorrentsLocation() {
const QStringList hashes = getSelectedTorrentsHashes(); const QStringList hashes = getSelectedTorrentsHashes();
if(hashes.isEmpty()) return; if(hashes.isEmpty()) return;
QString dir; QString dir;
const QDir saveDir(BTSession->getTorrentHandle(hashes.first()).save_path()); const QDir saveDir(TorrentPersistentData::getSavePath(hashes.first()));
qDebug("Torrent save path is %s", qPrintable(saveDir.absolutePath()));
if(saveDir.exists()){ if(saveDir.exists()){
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.path()); dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.path());
}else{ }else{
@ -648,8 +650,12 @@ void TransferListWidget::setSelectedTorrentsLocation() {
foreach(const QString & hash, hashes) { foreach(const QString & hash, hashes) {
// Actually move storage // Actually move storage
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(!BTSession->useTemporaryFolder() || h.is_seed()) if(!BTSession->useTemporaryFolder() || h.is_seed()) {
h.move_storage(savePath.absolutePath()); h.move_storage(savePath.absolutePath());
} else {
TorrentPersistentData::saveSavePath(h.hash(), savePath.absolutePath());
main_window->getProperties()->updateSavePath(h);
}
} }
} }
} }