(trunk) #2898 "add pausing and deletion to daemon" -- committed patch from Longinus00 to trunk for 2.00

This commit is contained in:
Charles Kerr 2010-03-17 19:23:03 +00:00
parent fe3d9ed95a
commit e1607c8354
21 changed files with 188 additions and 65 deletions

View File

@ -383,7 +383,7 @@ dnl it should be safe to re-edit 0.40 back down to 0.23
use_nls=no
if test "x$enable_nls" = "xyes" ; then
use_nls=yes
IT_PROG_INTLTOOL([0.40.0],[no-xml])
IT_PROG_INTLTOOL([0.35.0],[no-xml])
AC_CHECK_HEADERS([libintl.h])
GETTEXT_PACKAGE=transmission
AC_SUBST(GETTEXT_PACKAGE)

View File

@ -217,18 +217,34 @@ getConfigDir( int argc, const char ** argv )
static void
onFileAdded( tr_session * session, const char * dir, const char * file )
{
if( strstr( file, ".torrent" ) != NULL )
char * filename = tr_buildPath( dir, file, NULL );
tr_ctor * ctor = tr_ctorNew( session );
int err = tr_ctorSetMetainfoFromFile( ctor, filename );
if( !err )
{
char * filename = tr_buildPath( dir, file, NULL );
tr_ctor * ctor = tr_ctorNew( session );
tr_torrentNew( ctor, &err );
int err = tr_ctorSetMetainfoFromFile( ctor, filename );
if( !err )
tr_torrentNew( ctor, &err );
if( err == TR_PARSE_ERR )
tr_err( "Error parsing .torrent file \"%s\"", file );
else
{
tr_bool trash = FALSE;
int test = tr_ctorGetDeleteSource( ctor, &trash );
tr_ctorFree( ctor );
tr_free( filename );
tr_inf( "Parsing .torrent file successful \"%s\"", file );
if( !test && trash )
{
tr_inf( "Deleting input .torrent file \"%s\"", file );
if( remove( filename ) )
tr_err( "Error deleting .torrent file: %s", tr_strerror( errno ) );
}
}
}
tr_ctorFree( ctor );
tr_free( filename );
}
static void

View File

@ -114,6 +114,10 @@ static tr_option opts[] =
{ 's', "start", "Start the current torrent(s)", "s", 0, NULL },
{ 'S', "stop", "Stop the current torrent(s)", "S", 0, NULL },
{ 't', "torrent", "Set the current torrent(s)", "t", 1, "<torrent>" },
{ 990, "start-paused", "Start added torrents paused", 0, NULL },
{ 991, "no-start-paused", "Start added torrents unpaused", 0, NULL },
{ 992, "trash-torrent", "Delete torrents after adding", 0, NULL },
{ 993, "no-trash-torrent", "Do not delete torrents after adding", 0, NULL },
{ 980, "torrent-downlimit", "Set the maximum download speed for the current torrent(s) in KB/s", "td", 1, "<speed>" },
{ 981, "no-torrent-downlimit", "Don't limit the download speed for the current torrent(s)", "TD", 0, NULL },
{ 982, "torrent-uplimit", "Set the maximum upload speed for the current torrent(s) in KB/s", "tu", 1, "<speed>" },
@ -797,6 +801,26 @@ readargs( int argc, const char ** argv )
tr_bencDictAddBool( args, "honorsSessionLimits", FALSE );
break;
case 990:
tr_bencDictAddStr( &top, "method", "session-set" );
tr_bencDictAddBool( args, TR_PREFS_KEY_START, FALSE );
break;
case 991:
tr_bencDictAddStr( &top, "method", "session-set" );
tr_bencDictAddBool( args, TR_PREFS_KEY_START, TRUE );
break;
case 992:
tr_bencDictAddStr( &top, "method", "session-set" );
tr_bencDictAddBool( args, TR_PREFS_KEY_TRASH_ORIGINAL, TRUE );
break;
case 993:
tr_bencDictAddStr( &top, "method", "session-set" );
tr_bencDictAddBool( args, TR_PREFS_KEY_TRASH_ORIGINAL, FALSE );
break;
case TR_OPT_ERR:
fprintf( stderr, "invalid option\n" );
showUsage( );
@ -1138,6 +1162,13 @@ printSession( tr_benc * top )
}
}
}
printf( "\n" );
printf( "MISC\n" );
if( tr_bencDictFindBool( args, TR_PREFS_KEY_START, &boolVal ) )
printf( " Autostart added torrents: %s\n", ( boolVal ? "Yes" : "No" ) );
if( tr_bencDictFindBool( args, TR_PREFS_KEY_TRASH_ORIGINAL, &boolVal ) )
printf( " Delete automatically added torrents: %s\n", ( boolVal ? "Yes" : "No" ) );
}
}

View File

@ -209,6 +209,10 @@ Let the current torrent(s) use the global seedratio settings
Start the current torrent(s)
.It Fl S Fl -stop
Stop the current torrent(s) from downloading or seeding
.It Fl -start-paused
Start added torrents paused
.It fl -no-start-paused
Start added torrents unpaused
.It Fl t Fl -torrent Ar all | id | torrent-hash
Set the current torrent(s) for use by subsequent options.
.Ar all
@ -230,6 +234,10 @@ Limit the current torrent(s) upload speed to
kilobytes per second.
.It Fl TU Fl -no-torrent-uplimit
Don't use the current torrent(s) upload limit.
.It Fl -trash-torrent
Delete torrents after adding
.It Fl -no-trash-torrent
Do not delete torrents after adding
.It Fl hl Fl -honor-session
Make the current torrent(s) honor the session limits.
.It Fl HL Fl -no-honor-session

View File

@ -387,38 +387,40 @@
4.1. Session Arguments
string | value type & description
---------------------------+-------------------------------------------------
"alt-speed-down" | number max global download speed (in K/s)
"alt-speed-enabled" | boolean true means use the alt speeds
"alt-speed-time-begin" | number when to turn on alt speeds (units: minutes after midnight)
"alt-speed-time-enabled" | boolean true means the scheduled on/off times are used
"alt-speed-time-end" | number when to turn off alt speeds (units: same)
"alt-speed-time-day" | number what day(s) to turn on alt speeds (look at tr_sched_day)
"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"
"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
"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
"seedRatioLimited" | boolean true if seedRatioLimit is honored by default
"speed-limit-down" | number max global download speed (in K/s)
"speed-limit-down-enabled" | boolean true means enabled
"speed-limit-up" | number max global upload speed (in K/s)
"speed-limit-up-enabled" | boolean true means enabled
"version" | string long version string "$version ($revision)"
string | value type & description
------------------------------+-------------------------------------------------
"alt-speed-down" | number max global download speed (in K/s)
"alt-speed-enabled" | boolean true means use the alt speeds
"alt-speed-time-begin" | number when to turn on alt speeds (units: minutes after midnight)
"alt-speed-time-enabled" | boolean true means the scheduled on/off times are used
"alt-speed-time-end" | number when to turn off alt speeds (units: same)
"alt-speed-time-day" | number what day(s) to turn on alt speeds (look at tr_sched_day)
"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"
"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
"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
"seedRatioLimited" | boolean true if seedRatioLimit is honored by default
"speed-limit-down" | number max global download speed (in K/s)
"speed-limit-down-enabled" | boolean true means enabled
"speed-limit-up" | number max global upload speed (in K/s)
"speed-limit-up-enabled" | boolean true means enabled
"start-added-torrents" | boolean true means added torrents will be started right away
"trash-original-torrent-files"| boolean true means the .torrent file of added torrents will be deleted
"version" | string long version string "$version ($revision)"
"rpc-version" indicates the RPC interface version supported by the RPC server.
It is incremented when a new version of Transmission changes the RPC interface.
@ -585,3 +587,8 @@
| | yes | torrent-get | new trackerStats arg "lastAnnounceTimedOut"
------+---------+-----------+----------------+-------------------------------
8 | 1.92 | yes | torrent-get | new trackerStats arg "lastScrapeTimedOut"
------+---------+-----------+----------------+-------------------------------
9 | 2.00 | yes | session-set | new arg "start-added-torrents"
| 2.00 | yes | session-set | new arg "trash-original-torrent-files"
| 2.00 | yes | session-get | new arg "start-added-torrents"
| 2.00 | yes | session-get | new arg "trash-original-torrent-files"

View File

@ -202,9 +202,6 @@ tr_prefs_init_defaults( tr_benc * d )
tr_bencDictAddStr( d, PREF_KEY_SORT_MODE, "sort-by-name" );
tr_bencDictAddBool( d, PREF_KEY_SORT_REVERSED, FALSE );
tr_bencDictAddBool( d, PREF_KEY_COMPACT_VIEW, FALSE );
tr_bencDictAddBool( d, PREF_KEY_START, TRUE );
tr_bencDictAddBool( d, PREF_KEY_TRASH_ORIGINAL, FALSE );
}
static char*

View File

@ -1300,6 +1300,14 @@ prefschanged( TrCore * core UNUSED,
{
tr_sessionSetIncompleteDirEnabled( tr, pref_flag_get( key ) );
}
else if( !strcmp( key, TR_PREFS_KEY_START) )
{
tr_sessionSetPaused( tr, !pref_flag_get( key ) );
}
else if( !strcmp( key, TR_PREFS_KEY_TRASH_ORIGINAL ) )
{
tr_sessionSetDeleteSource( tr, pref_flag_get( key ) );
}
}
static gboolean

View File

@ -455,11 +455,11 @@ static void
tr_core_apply_defaults( tr_ctor * ctor )
{
if( tr_ctorGetPaused( ctor, TR_FORCE, NULL ) )
tr_ctorSetPaused( ctor, TR_FORCE, !pref_flag_get( PREF_KEY_START ) );
tr_ctorSetPaused( ctor, TR_FORCE, !pref_flag_get( TR_PREFS_KEY_START ) );
if( tr_ctorGetDeleteSource( ctor, NULL ) )
tr_ctorSetDeleteSource( ctor,
pref_flag_get( PREF_KEY_TRASH_ORIGINAL ) );
pref_flag_get( TR_PREFS_KEY_TRASH_ORIGINAL ) );
if( tr_ctorGetPeerLimit( ctor, TR_FORCE, NULL ) )
tr_ctorSetPeerLimit( ctor, TR_FORCE,
@ -948,7 +948,7 @@ add_ctor( TrCore * core, tr_ctor * ctor, gboolean doPrompt, gboolean doNotify )
void
tr_core_add_ctor( TrCore * core, tr_ctor * ctor )
{
const gboolean doStart = pref_flag_get( PREF_KEY_START );
const gboolean doStart = pref_flag_get( TR_PREFS_KEY_START );
const gboolean doPrompt = pref_flag_get( PREF_KEY_OPTIONS_PROMPT );
tr_core_apply_defaults( ctor );
add_ctor( core, ctor, doStart, doPrompt );
@ -1136,7 +1136,7 @@ tr_core_add_list( TrCore * core,
pref_flag_t prompt,
gboolean doNotify )
{
const gboolean doStart = pref_flag_eval( start, PREF_KEY_START );
const gboolean doStart = pref_flag_eval( start, TR_PREFS_KEY_START );
const gboolean doPrompt = pref_flag_eval( prompt, PREF_KEY_OPTIONS_PROMPT );
GSList * l;

View File

@ -290,11 +290,11 @@ torrentPage( GObject * core )
hig_workarea_add_wide_control( t, &row, w );
s = _( "_Start when added" );
w = new_check_button( s, PREF_KEY_START, core );
w = new_check_button( s, TR_PREFS_KEY_START, core );
hig_workarea_add_wide_control( t, &row, w );
s = _( "Mo_ve .torrent file to the trash" );
w = new_check_button( s, PREF_KEY_TRASH_ORIGINAL, core );
w = new_check_button( s, TR_PREFS_KEY_TRASH_ORIGINAL, core );
hig_workarea_add_wide_control( t, &row, w );
s = _( "Append \"._part\" to incomplete files' names" );

View File

@ -33,8 +33,6 @@ GtkWidget * tr_prefs_dialog_new( GObject * core,
#define PREF_KEY_SHOW_MORE_TRACKER_INFO "show-tracker-scrapes"
#define PREF_KEY_SHOW_MORE_PEER_INFO "show-extra-peer-details"
#define PREF_KEY_SHOW_BACKUP_TRACKERS "show-backup-trackers"
#define PREF_KEY_START "start-added-torrents"
#define PREF_KEY_TRASH_ORIGINAL "trash-original-torrent-files"
#define PREF_KEY_ASKQUIT "prompt-before-exit"
#define PREF_KEY_SORT_MODE "sort-mode"
#define PREF_KEY_SORT_REVERSED "sort-reversed"

View File

@ -1202,6 +1202,10 @@ sessionSet( tr_session * session,
tr_sessionSetRatioLimit( session, d );
if( tr_bencDictFindBool( args_in, "seedRatioLimited", &boolVal ) )
tr_sessionSetRatioLimited( session, boolVal );
if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_START, &boolVal ) )
tr_sessionSetPaused( session, !boolVal );
if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_TRASH_ORIGINAL, &boolVal ) )
tr_sessionSetDeleteSource( session, boolVal );
if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_DSPEED, &i ) )
tr_sessionSetSpeedLimit( session, TR_DOWN, i );
if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_DSPEED_ENABLED, &boolVal ) )
@ -1306,6 +1310,8 @@ sessionGet( tr_session * s,
tr_bencDictAddInt ( d, "rpc-version-minimum", 1 );
tr_bencDictAddReal( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) );
tr_bencDictAddBool( d, "seedRatioLimited", tr_sessionIsRatioLimited( s ) );
tr_bencDictAddBool( d, TR_PREFS_KEY_START, !tr_sessionGetPaused( s ) );
tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL, tr_sessionGetDeleteSource( s ) );
tr_bencDictAddInt ( d, TR_PREFS_KEY_USPEED, tr_sessionGetSpeedLimit( s, TR_UP ) );
tr_bencDictAddBool( d, TR_PREFS_KEY_USPEED_ENABLED, tr_sessionIsSpeedLimited( s, TR_UP ) );
tr_bencDictAddInt ( d, TR_PREFS_KEY_DSPEED, tr_sessionGetSpeedLimit( s, TR_DOWN ) );

View File

@ -296,6 +296,8 @@ tr_sessionGetDefaultSettings( const char * configDir, tr_benc * d )
tr_bencDictAddInt ( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, 14 );
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4, TR_DEFAULT_BIND_ADDRESS_IPV4 );
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6, TR_DEFAULT_BIND_ADDRESS_IPV6 );
tr_bencDictAddBool( d, TR_PREFS_KEY_START, TRUE );
tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL, FALSE );
tr_free( incompleteDir );
}
@ -358,6 +360,8 @@ tr_sessionGetSettings( tr_session * s, struct tr_benc * d )
tr_bencDictAddInt ( d, TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT, s->uploadSlotsPerTorrent );
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4, tr_ntop_non_ts( &s->public_ipv4->addr ) );
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6, tr_ntop_non_ts( &s->public_ipv6->addr ) );
tr_bencDictAddBool( d, TR_PREFS_KEY_START, !tr_sessionGetPaused( s ) );
tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL, tr_sessionGetDeleteSource( s ) );
}
tr_bool
@ -670,6 +674,10 @@ sessionSetImpl( void * vdata )
session->peerSocketTOS = i;
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, &boolVal ) )
tr_blocklistSetEnabled( session, boolVal );
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_START, &boolVal ) )
tr_sessionSetPaused( session, !boolVal );
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_TRASH_ORIGINAL, &boolVal) )
tr_sessionSetDeleteSource( session, boolVal );
/* files and directories */
if( tr_bencDictFindInt( settings, TR_PREFS_KEY_PREALLOCATION, &i ) )
@ -1466,6 +1474,42 @@ tr_sessionGetPeerLimitPerTorrent( const tr_session * session )
****
***/
void
tr_sessionSetPaused( tr_session * session, tr_bool isPaused )
{
assert( tr_isSession( session ) );
session->pauseAddedTorrent = isPaused;
}
tr_bool
tr_sessionGetPaused( const tr_session * session )
{
assert( tr_isSession( session ) );
return session->pauseAddedTorrent;
}
void
tr_sessionSetDeleteSource( tr_session * session, tr_bool deleteSource )
{
assert( tr_isSession( session ) );
session->deleteSourceTorrent = deleteSource;
}
tr_bool
tr_sessionGetDeleteSource( const tr_session * session )
{
assert( tr_isSession( session ) );
return session->deleteSourceTorrent;
}
/***
****
***/
double
tr_sessionGetPieceSpeed( const tr_session * session, tr_direction dir )
{

View File

@ -92,6 +92,8 @@ struct tr_session
tr_bool isIncompleteFileNamingEnabled;
tr_bool isRatioLimited;
tr_bool isIncompleteDirEnabled;
tr_bool pauseAddedTorrent;
tr_bool deleteSourceTorrent;
tr_benc removedTorrents;

View File

@ -452,7 +452,8 @@ tr_ctorNew( const tr_session * session )
ctor->session = session;
ctor->bandwidthPriority = TR_PRI_NORMAL;
tr_ctorSetPaused( ctor, TR_FALLBACK, FALSE );
tr_ctorSetPaused( ctor, TR_FALLBACK, tr_sessionGetPaused( session ) );
tr_ctorSetDeleteSource( ctor, tr_sessionGetDeleteSource( session ) );
if( session != NULL ) {
tr_ctorSetPeerLimit( ctor, TR_FALLBACK, session->peerLimitPerTorrent );
tr_ctorSetDownloadDir( ctor, TR_FALLBACK, session->downloadDir );

View File

@ -205,6 +205,8 @@ const char* tr_getDefaultDownloadDir( void );
#define TR_PREFS_KEY_USPEED "speed-limit-up"
#define TR_PREFS_KEY_UMASK "umask"
#define TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT "upload-slots-per-torrent"
#define TR_PREFS_KEY_START "start-added-torrents"
#define TR_PREFS_KEY_TRASH_ORIGINAL "trash-original-torrent-files"
/**
@ -726,6 +728,11 @@ uint16_t tr_sessionGetPeerLimitPerTorrent( const tr_session * );
tr_priority_t tr_torrentGetPriority( const tr_torrent * );
void tr_torrentSetPriority( tr_torrent *, tr_priority_t );
void tr_sessionSetPaused ( tr_session *, tr_bool isPaused );
tr_bool tr_sessionGetPaused ( const tr_session * );
void tr_sessionSetDeleteSource ( tr_session *, tr_bool deleteSource );
tr_bool tr_sessionGetDeleteSource ( const tr_session * );
/**
* Load all the torrents in tr_getTorrentDir().

View File

@ -38,8 +38,6 @@ Prefs::PrefItem Prefs::myItems[] =
{ DIR_WATCH_ENABLED, "watch-dir-enabled", QVariant::Bool },
{ SHOW_TRAY_ICON, "show-notification-area-icon", QVariant::Bool },
{ SHOW_DESKTOP_NOTIFICATION, "show-desktop-notification", QVariant::Bool },
{ START, "start-added-torrents", QVariant::Bool },
{ TRASH_ORIGINAL, "trash-original-torrent-files", QVariant::Bool },
{ ASKQUIT, "prompt-before-exit", QVariant::Bool },
{ SORT_MODE, "sort-mode", TrTypes::SortModeType },
{ SORT_REVERSED, "sort-reversed", QVariant::Bool },
@ -89,6 +87,8 @@ Prefs::PrefItem Prefs::myItems[] =
{ PEER_PORT_RANDOM_LOW, TR_PREFS_KEY_PEER_PORT_RANDOM_LOW, QVariant::Int },
{ PEER_PORT_RANDOM_HIGH, TR_PREFS_KEY_PEER_PORT_RANDOM_HIGH, QVariant::Int },
{ SOCKET_TOS, TR_PREFS_KEY_PEER_SOCKET_TOS, QVariant::Int },
{ START, TR_PREFS_KEY_START, QVariant::Bool },
{ TRASH_ORIGINAL, TR_PREFS_KEY_TRASH_ORIGINAL, QVariant::Bool },
{ PEX_ENABLED, TR_PREFS_KEY_PEX_ENABLED, QVariant::Bool },
{ DHT_ENABLED, TR_PREFS_KEY_DHT_ENABLED, QVariant::Bool },
{ PORT_FORWARDING, TR_PREFS_KEY_PORT_FORWARDING, QVariant::Bool },
@ -257,8 +257,6 @@ Prefs :: initDefaults( tr_benc * d )
tr_bencDictAddStr( d, keyStr(SORT_MODE), "sort-by-name" );
tr_bencDictAddInt( d, keyStr(SORT_REVERSED), false );
tr_bencDictAddInt( d, keyStr(COMPACT_VIEW), false );
tr_bencDictAddInt( d, keyStr(START), true );
tr_bencDictAddInt( d, keyStr(TRASH_ORIGINAL), false );
tr_bencDictAddStr( d, keyStr(SESSION_REMOTE_HOST), "localhost" );
tr_bencDictAddInt( d, keyStr(SESSION_REMOTE_PORT), atoi(TR_DEFAULT_RPC_PORT_STR) );
tr_bencDictAddBool( d, keyStr(SESSION_IS_REMOTE), false );

View File

@ -41,8 +41,6 @@ class Prefs: public QObject
DIR_WATCH_ENABLED,
SHOW_TRAY_ICON,
SHOW_DESKTOP_NOTIFICATION,
START,
TRASH_ORIGINAL,
ASKQUIT,
SORT_MODE,
SORT_REVERSED,
@ -93,6 +91,8 @@ class Prefs: public QObject
PEER_PORT_RANDOM_LOW,
PEER_PORT_RANDOM_HIGH,
SOCKET_TOS,
START,
TRASH_ORIGINAL,
PEX_ENABLED,
DHT_ENABLED,
PORT_FORWARDING,

View File

@ -147,6 +147,8 @@ Session :: updatePref( int key )
case Prefs :: USPEED:
case Prefs :: DSPEED_ENABLED:
case Prefs :: DSPEED:
case Prefs :: START:
case Prefs :: TRASH_ORIGINAL:
case Prefs :: PEX_ENABLED:
case Prefs :: PORT_FORWARDING:
case Prefs :: PEER_PORT:

View File

@ -330,8 +330,6 @@ function changeTab(tab, id) {
function Prefs() { }
Prefs.prototype = { };
Prefs._AutoStart = 'auto-start-torrents';
Prefs._RefreshRate = 'refresh_rate';
Prefs._SessionRefreshRate = 'session_refresh_rate';
@ -362,7 +360,6 @@ Prefs._TurtleState = 'turtle-state';
Prefs._Defaults =
{
'auto-start-torrents': true,
'filter': 'all',
'refresh_rate' : 5,
'show_filter': true,

View File

@ -630,7 +630,6 @@ Transmission.prototype =
{
// handle the clutch prefs locally
var tr = this;
tr.setPref( Prefs._AutoStart, $('#prefs_form #auto_start')[0].checked );
var rate = parseInt( $('#prefs_form #refresh_rate')[0].value );
if( rate != tr[Prefs._RefreshRate] ) {
tr.setPref( Prefs._RefreshRate, rate );
@ -640,6 +639,7 @@ Transmission.prototype =
// pass the new prefs upstream to the RPC server
var o = { };
o[RPC._StartAddedTorrent] = $('#prefs_form #auto_start')[0].checked;
o[RPC._PeerPort] = parseInt( $('#prefs_form #port')[0].value );
o[RPC._UpSpeedLimit] = parseInt( $('#prefs_form #upload_rate')[0].value );
o[RPC._DownSpeedLimit] = parseInt( $('#prefs_form #download_rate')[0].value );
@ -925,7 +925,7 @@ Transmission.prototype =
$('div.download_location input')[0].value = prefs[RPC._DownloadDir];
$('div.port input')[0].value = prefs[RPC._PeerPort];
$('div.auto_start input')[0].checked = prefs[Prefs._AutoStart];
$('div.auto_start input')[0].checked = prefs[RPC._StartAddedTorrent];
$('input#limit_download')[0].checked = down_limited;
$('input#download_rate')[0].value = down_limit;
$('input#limit_upload')[0].checked = up_limited;
@ -1631,7 +1631,7 @@ Transmission.prototype =
if (! confirmed) {
$('input#torrent_upload_file').attr('value', '');
$('input#torrent_upload_url').attr('value', '');
$('input#torrent_auto_start').attr('checked', this[Prefs._AutoStart]);
$('input#torrent_auto_start').attr('checked', $('#prefs_form #auto_start')[0].checked);
$('#upload_container').show();
if (!iPhone && Safari3) {
setTimeout("$('div#upload_container div.dialog_window').css('top', '0px');",10);

View File

@ -28,6 +28,7 @@ RPC._TurtleTimeEnabled = 'alt-speed-time-enabled';
RPC._TurtleTimeBegin = 'alt-speed-time-begin';
RPC._TurtleTimeEnd = 'alt-speed-time-end';
RPC._TurtleTimeDay = 'alt-speed-time-day';
RPC._StartAddedTorrent = 'start-added-torrents';
function TransmissionRemote( controller )
{