From 92f67263eefaf025aae001de047859e7c8b04e28 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 1 Feb 2010 04:43:10 +0000 Subject: [PATCH] (trunk, libT) #2844 "add able to disable '.part' suffix for incomplete files" -- added to GTK+ and Qt clients and to RPC spec for 1.90 --- doc/rpc-spec.txt | 5 ++++- gtk/main.c | 4 ++++ gtk/tr-prefs.c | 4 ++++ libtransmission/rpcimpl.c | 5 ++++- qt/prefs-dialog.cc | 1 + qt/prefs.cc | 1 + qt/prefs.h | 1 + 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/rpc-spec.txt b/doc/rpc-spec.txt index 0c8b5d795..4d29dccd9 100644 --- a/doc/rpc-spec.txt +++ b/doc/rpc-spec.txt @@ -406,6 +406,7 @@ "peer-port" | number port number "peer-port-random-on-start"| boolean true means pick a random peer port on launch "port-forwarding-enabled" | boolean true means enabled + "rename-partial-files" | boolean true means append ".part" to incomplete files "rpc-version" | number the current RPC API version "rpc-version-minimum" | number the minimum RPC API version supported "seedRatioLimit" | double the default seed ratio for torrents to use @@ -572,5 +573,7 @@ | | yes | torrent-get | new arg "trackerStats" | | yes | session-set | new arg "incomplete-dir" | | yes | session-set | new arg "incomplete-dir-enabled" - + ------+---------+-----------+----------------+------------------------------- + 8 | 1.90 | yes | session-set | new arg "rename-partial-files" + | | yes | session-get | new arg "rename-partial-files" diff --git a/gtk/main.c b/gtk/main.c index 4f71bbd0c..4c2fa80ce 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1193,6 +1193,10 @@ prefschanged( TrCore * core UNUSED, { tr_sessionSetPexEnabled( tr, pref_flag_get( key ) ); } + else if( !strcmp( key, TR_PREFS_KEY_RENAME_PARTIAL_FILES ) ) + { + tr_sessionSetIncompleteFileNamingEnabled( tr, pref_flag_get( key ) ); + } else if( !strcmp( key, TR_PREFS_KEY_DHT_ENABLED ) ) { tr_sessionSetDHTEnabled( tr, pref_flag_get( key ) ); diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index 4067cd21d..178cfe7bb 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -297,6 +297,10 @@ torrentPage( GObject * core ) w = new_check_button( s, PREF_KEY_TRASH_ORIGINAL, core ); hig_workarea_add_wide_control( t, &row, w ); + s = _( "Append \"._part\" to incomplete files' names" ); + w = new_check_button( s, TR_PREFS_KEY_RENAME_PARTIAL_FILES, core ); + hig_workarea_add_wide_control( t, &row, w ); + s = _( "Keep _incomplete torrents in:" ); l = new_check_button( s, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, core ); w = new_path_chooser_button( TR_PREFS_KEY_INCOMPLETE_DIR, core ); diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 07c0cef81..7ea9febb9 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -1185,6 +1185,8 @@ sessionSet( tr_session * session, tr_sessionSetPeerPort( session, i ); if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_PORT_FORWARDING, &boolVal ) ) tr_sessionSetPortForwardingEnabled( session, boolVal ); + if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_RENAME_PARTIAL_FILES, &boolVal ) ) + tr_sessionSetIncompleteFileNamingEnabled( session, boolVal ); if( tr_bencDictFindReal( args_in, "seedRatioLimit", &d ) ) tr_sessionSetRatioLimit( session, d ); if( tr_bencDictFindBool( args_in, "seedRatioLimited", &boolVal ) ) @@ -1287,7 +1289,8 @@ sessionGet( tr_session * 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", 7 ); + tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, tr_sessionIsIncompleteFileNamingEnabled( s ) ); + tr_bencDictAddInt ( d, "rpc-version", 8 ); 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 295498b71..af4f15bcf 100644 --- a/qt/prefs-dialog.cc +++ b/qt/prefs-dialog.cc @@ -566,6 +566,7 @@ PrefsDialog :: createTorrentsTab( ) hig->addWideControl( checkBoxNew( tr( "Show &options dialog" ), Prefs::OPTIONS_PROMPT ) ); hig->addWideControl( checkBoxNew( tr( "&Start when added" ), Prefs::START ) ); hig->addWideControl( checkBoxNew( tr( "Mo&ve .torrent file to the trash" ), Prefs::TRASH_ORIGINAL ) ); + hig->addWideControl( checkBoxNew( tr( "Append \".&part\" to incomplete files' names" ), Prefs::RENAME_PARTIAL_FILES ) ); b = myIncompleteButton = new QPushButton; b->setIcon( folderPixmap ); diff --git a/qt/prefs.cc b/qt/prefs.cc index 90179d344..c98829f75 100644 --- a/qt/prefs.cc +++ b/qt/prefs.cc @@ -102,6 +102,7 @@ Prefs::PrefItem Prefs::myItems[] = { PROXY_USERNAME, TR_PREFS_KEY_PROXY_USERNAME, QVariant::String }, { RATIO, TR_PREFS_KEY_RATIO, QVariant::Double }, { RATIO_ENABLED, TR_PREFS_KEY_RATIO_ENABLED, QVariant::Bool }, + { RENAME_PARTIAL_FILES, TR_PREFS_KEY_RENAME_PARTIAL_FILES, QVariant::Bool }, { RPC_AUTH_REQUIRED, TR_PREFS_KEY_RPC_AUTH_REQUIRED, QVariant::Bool }, { RPC_ENABLED, TR_PREFS_KEY_RPC_ENABLED, QVariant::Bool }, { RPC_PASSWORD, TR_PREFS_KEY_RPC_PASSWORD, QVariant::String }, diff --git a/qt/prefs.h b/qt/prefs.h index 7abda3550..34ec3f881 100644 --- a/qt/prefs.h +++ b/qt/prefs.h @@ -106,6 +106,7 @@ class Prefs: public QObject PROXY_USERNAME, RATIO, RATIO_ENABLED, + RENAME_PARTIAL_FILES, RPC_AUTH_REQUIRED, RPC_ENABLED, RPC_PASSWORD,