Browse Source

Allow to change the save path of torrents after addition

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
b0a0abd764
  1. 1
      Changelog
  2. 282
      src/properties.ui
  3. 30
      src/properties_imp.cpp
  4. 1
      src/properties_imp.h
  5. 5
      src/qtorrenthandle.cpp
  6. 1
      src/qtorrenthandle.h

1
Changelog

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
- FEATURE: ETA calculation now relies on average speed over all sessions
- FEATURE: Allow to force rechecking torrents
- FEATURE: Added support for 2 new extensions (uTorrent metadata and smart ban plugin)
- FEATURE: Allow to change the save path of torrents after addition
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently

282
src/properties.ui

@ -16,16 +16,7 @@ @@ -16,16 +16,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>9</number>
</property>
<item>
@ -37,7 +28,7 @@ @@ -37,7 +28,7 @@
<attribute name="title" >
<string>Main infos</string>
</attribute>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<widget class="QLabel" name="fileName" >
<property name="maximumSize" >
@ -83,54 +74,15 @@ @@ -83,54 +74,15 @@
<property name="title" >
<string>Torrent infos</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -218,34 +170,42 @@ @@ -218,34 +170,42 @@
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QLabel" name="save_path" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="save_path" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="changeSavePathButton" >
<property name="minimumSize" >
<size>
<width>21</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>21</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="creator" >
@ -299,7 +259,7 @@ @@ -299,7 +259,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -363,16 +323,7 @@ @@ -363,16 +323,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>9</number>
</property>
<item>
@ -380,16 +331,7 @@ @@ -380,16 +331,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -397,16 +339,7 @@ @@ -397,16 +339,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -488,16 +421,7 @@ @@ -488,16 +421,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -535,7 +459,7 @@ @@ -535,7 +459,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>181</width>
<height>20</height>
@ -578,16 +502,7 @@ @@ -578,16 +502,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -613,16 +528,7 @@ @@ -613,16 +528,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -643,16 +549,7 @@ @@ -643,16 +549,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -660,7 +557,7 @@ @@ -660,7 +557,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -711,7 +608,7 @@ @@ -711,7 +608,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -728,16 +625,7 @@ @@ -728,16 +625,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -745,7 +633,7 @@ @@ -745,7 +633,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -796,7 +684,7 @@ @@ -796,7 +684,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -813,16 +701,7 @@ @@ -813,16 +701,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -867,7 +746,7 @@ @@ -867,7 +746,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -885,7 +764,7 @@ @@ -885,7 +764,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -903,16 +782,7 @@ @@ -903,16 +782,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>9</number>
</property>
<item>
@ -936,16 +806,7 @@ @@ -936,16 +806,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -953,7 +814,7 @@ @@ -953,7 +814,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -992,7 +853,7 @@ @@ -992,7 +853,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1007,7 +868,7 @@ @@ -1007,7 +868,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -1066,7 +927,7 @@ @@ -1066,7 +927,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1093,7 +954,7 @@ @@ -1093,7 +954,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1136,16 +997,7 @@ @@ -1136,16 +997,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -1153,7 +1005,7 @@ @@ -1153,7 +1005,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1173,7 +1025,7 @@ @@ -1173,7 +1025,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>

30
src/properties_imp.cpp

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#include <QStandardItemModel>
#include <QSettings>
#include <QDesktopWidget>
#include <QFileDialog>
// Constructor
properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h): QDialog(parent), h(h), BTSession(BTSession), changedFilteredfiles(false), hash(h.hash()) {
@ -677,6 +678,35 @@ void properties::on_incrementalDownload_stateChanged(int){ @@ -677,6 +678,35 @@ void properties::on_incrementalDownload_stateChanged(int){
}
}
void properties::on_changeSavePathButton_clicked() {
QString dir;
QDir saveDir(h.save_path());
if(saveDir.exists()){
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), h.save_path());
}else{
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath());
}
if(!dir.isNull()){
// Check if savePath exists
QDir savePath(dir);
if(!savePath.exists()){
if(!savePath.mkpath(savePath.path())){
QMessageBox::critical(0, tr("Save path creation error"), tr("Could not create the save path"));
return;
}
}
// Save savepath
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath"));
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
savepath_file.write(savePath.path().toUtf8());
savepath_file.close();
// Actually move storage
h.move_storage(savePath.path());
// Update save_path in dialog
save_path->setText(savePath.path());
}
}
void properties::on_okButton_clicked(){
if(savePiecesPriorities())
close();

1
src/properties_imp.h

@ -80,6 +80,7 @@ class properties : public QDialog, private Ui::properties{ @@ -80,6 +80,7 @@ class properties : public QDialog, private Ui::properties{
void addTrackerList(QStringList myTrackers);
void writeSettings();
void loadSettings();
void on_changeSavePathButton_clicked();
signals:
void filteredFilesChanged(QString hash);

5
src/qtorrenthandle.cpp

@ -393,6 +393,11 @@ void QTorrentHandle::force_recheck() const { @@ -393,6 +393,11 @@ void QTorrentHandle::force_recheck() const {
h.force_recheck();
}
void QTorrentHandle::move_storage(QString new_path) const {
Q_ASSERT(h.is_valid());
h.move_storage(new_path.toUtf8().data());
}
//
// Operators
//

1
src/qtorrenthandle.h

@ -119,6 +119,7 @@ class QTorrentHandle { @@ -119,6 +119,7 @@ class QTorrentHandle {
void queue_position_up() const;
void auto_managed(bool) const;
void force_recheck() const;
void move_storage(QString path) const;
//
// Operators

Loading…
Cancel
Save