diff --git a/doc/rpc-spec.txt b/doc/rpc-spec.txt index 214f564b6..81bdf5edc 100644 --- a/doc/rpc-spec.txt +++ b/doc/rpc-spec.txt @@ -390,9 +390,11 @@ "alt-speed-up" | number max global upload speed (in K/s) "blocklist-enabled" | boolean true means enabled "blocklist-size" | number number of rules in the blocklist + "download-dir" | string default path to download torrents "dht-enabled" | boolean true means allow dht in public torrents "encryption" | string "required", "preferred", "tolerated" - "download-dir" | string default path to download torrents + "incomplete-dir" | string path for incomplete torrents, when enabled + "incomplete-dir-enabled" | boolean true means keep torrents in incomplete-dir until done "peer-limit-global" | number maximum global number of peers "peer-limit-per-torrent" | number maximum global number of peers "pex-enabled" | boolean true means allow pex in public torrents @@ -559,6 +561,8 @@ | | NO | torrent-get | removed arg "scrapeURL" | | NO | torrent-get | removed arg "seeders" | | NO | torrent-get | removed arg "timesCompleted" - | | yes NO | torrent-get | new arg "trackerStats" + | | yes | torrent-get | new arg "trackerStats" + | | yes | session-set | new arg "incomplete-dir" + | | yes | session-set | new arg "incomplete-dir-enabled" diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 55a4201ab..e7092a66d 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -1146,6 +1146,10 @@ sessionSet( tr_session * session, tr_blocklistSetEnabled( session, boolVal ); if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) ) tr_sessionSetDownloadDir( session, str ); + if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_INCOMPLETE_DIR, &str ) ) + tr_sessionSetIncompleteDir( session, str ); + if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, &boolVal ) ) + tr_sessionSetIncompleteDirEnabled( session, boolVal ); if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, &i ) ) tr_sessionSetPeerLimit( session, i ); if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_PEER_LIMIT_TORRENT, &i ) ) @@ -1255,12 +1259,14 @@ sessionGet( tr_session * s, tr_bencDictAddStr ( d, TR_PREFS_KEY_DOWNLOAD_DIR, tr_sessionGetDownloadDir( s ) ); tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, tr_sessionGetPeerLimit( s ) ); tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_LIMIT_TORRENT, tr_sessionGetPeerLimitPerTorrent( s ) ); + tr_bencDictAddStr ( d, TR_PREFS_KEY_INCOMPLETE_DIR, tr_sessionGetIncompleteDir( s ) ); + tr_bencDictAddBool( d, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, tr_sessionGetIncompleteDirEnabled( s ) ); tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) ); tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, tr_sessionIsDHTEnabled( s ) ); tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT, tr_sessionGetPeerPort( s ) ); tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, tr_sessionGetPeerPortRandomOnStart( s ) ); tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) ); - tr_bencDictAddInt ( d, "rpc-version", 6 ); + tr_bencDictAddInt ( d, "rpc-version", 7 ); tr_bencDictAddInt ( d, "rpc-version-minimum", 1 ); tr_bencDictAddReal( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) ); tr_bencDictAddBool( d, "seedRatioLimited", tr_sessionIsRatioLimited( s ) ); diff --git a/qt/prefs-dialog.cc b/qt/prefs-dialog.cc index 2aeee8fc8..6db359c2a 100644 --- a/qt/prefs-dialog.cc +++ b/qt/prefs-dialog.cc @@ -485,14 +485,35 @@ PrefsDialog :: createPrivacyTab( ) **** ***/ +void +PrefsDialog :: onIncompleteClicked( void ) +{ + const QString title = tr( "Select Incomplete Directory" ); + const QString path = myPrefs.getString( Prefs::INCOMPLETE_DIR ); + QFileDialog * d = new QFileDialog( this, title, path ); + d->setFileMode( QFileDialog::Directory ); + connect( d, SIGNAL(filesSelected(const QStringList&)), + this, SLOT(onIncompleteSelected(const QStringList&)) ); + d->show( ); +} + +void +PrefsDialog :: onIncompleteSelected( const QStringList& list ) +{ + if( list.size() == 1 ) + myPrefs.set( Prefs::INCOMPLETE_DIR, list.first( ) ); +} + + void PrefsDialog :: onWatchClicked( void ) { - QFileDialog * d = new QFileDialog( this, - tr( "Select Watch Directory" ), - myPrefs.getString( Prefs::DIR_WATCH ) ); + const QString title = tr( "Select Watch Directory" ); + const QString path = myPrefs.getString( Prefs::DIR_WATCH ); + QFileDialog * d = new QFileDialog( this, title, path ); d->setFileMode( QFileDialog::Directory ); - connect( d, SIGNAL(filesSelected(const QStringList&)), this, SLOT(onWatchSelected(const QStringList&)) ); + connect( d, SIGNAL(filesSelected(const QStringList&)), + this, SLOT(onWatchSelected(const QStringList&)) ); d->show( ); } @@ -506,11 +527,12 @@ PrefsDialog :: onWatchSelected( const QStringList& list ) void PrefsDialog :: onDestinationClicked( void ) { - QFileDialog * d = new QFileDialog( this, - tr( "Select Destination" ), - myPrefs.getString( Prefs::DOWNLOAD_DIR ) ); + const QString title = tr( "Select Destination" ); + const QString path = myPrefs.getString( Prefs::DOWNLOAD_DIR ); + QFileDialog * d = new QFileDialog( this, title, path ); d->setFileMode( QFileDialog::Directory ); - connect( d, SIGNAL(filesSelected(const QStringList&)), this, SLOT(onDestinationSelected(const QStringList&)) ); + connect( d, SIGNAL(filesSelected(const QStringList&)), + this, SLOT(onDestinationSelected(const QStringList&)) ); d->show( ); } diff --git a/qt/prefs-dialog.h b/qt/prefs-dialog.h index 5b398dbf6..8c1d076b9 100644 --- a/qt/prefs-dialog.h +++ b/qt/prefs-dialog.h @@ -52,6 +52,8 @@ class PrefsDialog: public QDialog void sessionUpdated( ); void onWatchClicked( ); void onWatchSelected( const QStringList& ); + void onIncompleteClicked( ); + void onIncompleteSelected( const QStringList& ); void onDestinationClicked( ); void onDestinationSelected( const QStringList& ); void onPortTested( bool ); @@ -94,6 +96,7 @@ class PrefsDialog: public QDialog QLabel * myPortLabel; QPushButton * myPortButton; QPushButton * myWatchButton; + QPushButton * myIncompleteButton; QPushButton * myDestinationButton; QWidgetList myWebWidgets; QWidgetList myWebAuthWidgets; diff --git a/qt/prefs.cc b/qt/prefs.cc index bfdaec179..d4c645015 100644 --- a/qt/prefs.cc +++ b/qt/prefs.cc @@ -77,6 +77,8 @@ Prefs::PrefItem Prefs::myItems[] = { DSPEED_ENABLED, TR_PREFS_KEY_DSPEED_ENABLED, QVariant::Bool }, { DOWNLOAD_DIR, TR_PREFS_KEY_DOWNLOAD_DIR, QVariant::String }, { ENCRYPTION, TR_PREFS_KEY_ENCRYPTION, QVariant::Int }, + { INCOMPLETE_DIR, TR_PREFS_KEY_INCOMPLETE_DIR, QVariant::String }, + { INCOMPLETE_DIR_ENABLED, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, QVariant::Bool }, { LAZY_BITFIELD, TR_PREFS_KEY_LAZY_BITFIELD, QVariant::Bool }, { MSGLEVEL, TR_PREFS_KEY_MSGLEVEL, QVariant::Int }, { OPEN_FILE_LIMIT, TR_PREFS_KEY_OPEN_FILE_LIMIT, QVariant::Int }, diff --git a/qt/prefs.h b/qt/prefs.h index b05abf885..03354bb80 100644 --- a/qt/prefs.h +++ b/qt/prefs.h @@ -81,6 +81,8 @@ class Prefs: public QObject DSPEED_ENABLED, DOWNLOAD_DIR, ENCRYPTION, + INCOMPLETE_DIR, + INCOMPLETE_DIR_ENABLED, LAZY_BITFIELD, MSGLEVEL, OPEN_FILE_LIMIT, diff --git a/qt/session.cc b/qt/session.cc index 4bdd54924..b0f5903a6 100644 --- a/qt/session.cc +++ b/qt/session.cc @@ -122,6 +122,8 @@ Session :: updatePref( int key ) case Prefs :: BLOCKLIST_DATE: case Prefs :: DHT_ENABLED: case Prefs :: DOWNLOAD_DIR: + case Prefs :: INCOMPLETE_DIR: + case Prefs :: INCOMPLETE_DIR_ENABLED: case Prefs :: PEER_LIMIT_GLOBAL: case Prefs :: PEER_LIMIT_TORRENT: case Prefs :: USPEED_ENABLED: