have the mac ui use libT's ratio settings (attempt 1); when seed ratio is reached in libT, set the seed ratio setting to "seed forever"
This commit is contained in:
parent
fa3b9a12c5
commit
39b0108366
|
@ -997,6 +997,10 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt )
|
|||
double ratio = tr_getRatio( up, down );
|
||||
if( ratio >= seedRatio ) {
|
||||
tr_torrentStop( tor );
|
||||
|
||||
/* set to no ratio limit to allow easy restarting */
|
||||
tr_torrentSetRatioMode( tor, TR_RATIOLIMIT_UNLIMITED );
|
||||
|
||||
fireRatioLimitHit( tor );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,19 +217,20 @@ tr_torrentIsPieceTransferAllowed( const tr_torrent * tor,
|
|||
tr_bool
|
||||
tr_torrentGetSeedRatio( const tr_torrent * tor, double * ratio )
|
||||
{
|
||||
double r = 0;
|
||||
tr_bool isLimited;
|
||||
|
||||
switch( tr_torrentGetRatioMode( tor ) )
|
||||
{
|
||||
case TR_RATIOLIMIT_SINGLE:
|
||||
isLimited = TRUE;
|
||||
r = tr_torrentGetRatioLimit( tor );
|
||||
if( ratio )
|
||||
*ratio = tr_torrentGetRatioLimit( tor );
|
||||
break;
|
||||
|
||||
case TR_RATIOLIMIT_GLOBAL:
|
||||
if(( isLimited = tr_sessionIsRatioLimited( tor->session )))
|
||||
r = tr_sessionGetRatioLimit( tor->session );
|
||||
if( ratio )
|
||||
*ratio = tr_sessionGetRatioLimit( tor->session );
|
||||
break;
|
||||
|
||||
case TR_RATIOLIMIT_UNLIMITED:
|
||||
|
@ -237,7 +238,6 @@ tr_torrentGetSeedRatio( const tr_torrent * tor, double * ratio )
|
|||
break;
|
||||
}
|
||||
|
||||
*ratio = r;
|
||||
return isLimited;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,6 @@ tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session * session,
|
|||
tr_bool tr_torrentIsPieceTransferAllowed( const tr_torrent * torrent,
|
||||
tr_direction direction );
|
||||
|
||||
tr_bool tr_torrentGetSeedRatio( const tr_torrent * tor, double * ratio );
|
||||
|
||||
|
||||
|
||||
#define tr_block( a, b ) _tr_block( tor, a, b )
|
||||
|
|
|
@ -572,6 +572,8 @@ void tr_sessionSetRatioLimit ( tr_session * session,
|
|||
|
||||
double tr_sessionGetRatioLimit ( const tr_session * session);
|
||||
|
||||
tr_bool tr_torrentGetSeedRatio ( const tr_torrent * tor, double * ratio );
|
||||
|
||||
double tr_sessionGetRawSpeed ( const tr_session * session,
|
||||
tr_direction direction );
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
tr_benc settings;
|
||||
tr_bencInitDict(&settings, 20);
|
||||
tr_bencInitDict(&settings, 22);
|
||||
tr_sessionGetDefaultSettings(&settings);
|
||||
|
||||
tr_bencDictAddInt(&settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, [fDefaults boolForKey: @"Blocklist"]);
|
||||
|
@ -231,6 +231,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
tr_bencDictAddStr(&settings, TR_PREFS_KEY_PROXY, [[fDefaults stringForKey: @"ProxyAddress"] UTF8String]);
|
||||
tr_bencDictAddStr(&settings, TR_PREFS_KEY_PROXY_USERNAME, [[fDefaults stringForKey: @"ProxyUsername"] UTF8String]);
|
||||
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_AUTH_REQUIRED, [fDefaults boolForKey: @"RPCAuthorize"]);
|
||||
tr_bencDictAddDouble(&settings, TR_PREFS_KEY_RATIO, [fDefaults floatForKey: @"RatioLimit"]);
|
||||
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RATIO_ENABLED, [fDefaults boolForKey: @"RatioCheck"]);
|
||||
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_ENABLED, [fDefaults boolForKey: @"RPC"]);
|
||||
tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_PORT, [fDefaults integerForKey: @"RPCPort"]);
|
||||
tr_bencDictAddStr(&settings, TR_PREFS_KEY_RPC_USERNAME, [[fDefaults stringForKey: @"RPCUsername"] UTF8String]);
|
||||
|
@ -2396,6 +2398,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
- (void) setRatioGlobalEnabled: (id) sender
|
||||
{
|
||||
[fDefaults setBool: sender == fCheckRatioItem forKey: @"RatioCheck"];
|
||||
|
||||
[fPrefsController applyRatioSetting: nil];
|
||||
}
|
||||
|
||||
- (void) setQuickRatioGlobal: (id) sender
|
||||
|
|
|
@ -605,18 +605,18 @@ typedef enum
|
|||
}
|
||||
|
||||
//set ratio view
|
||||
if (checkRatio == NSOnState)
|
||||
if (checkRatio == TR_RATIOLIMIT_SINGLE)
|
||||
index = OPTION_POPUP_LIMIT;
|
||||
else if (checkRatio == NSOffState)
|
||||
else if (checkRatio == TR_RATIOLIMIT_UNLIMITED)
|
||||
index = OPTION_POPUP_NO_LIMIT;
|
||||
else if (checkRatio == NSMixedState)
|
||||
else if (checkRatio == TR_RATIOLIMIT_GLOBAL)
|
||||
index = OPTION_POPUP_GLOBAL;
|
||||
else
|
||||
index = -1;
|
||||
[fRatioPopUp selectItemAtIndex: index];
|
||||
[fRatioPopUp setEnabled: YES];
|
||||
|
||||
[fRatioLimitField setHidden: checkRatio != NSOnState];
|
||||
[fRatioLimitField setHidden: checkRatio != TR_RATIOLIMIT_SINGLE];
|
||||
if (ratioLimit != INVALID)
|
||||
[fRatioLimitField setFloatValue: ratioLimit];
|
||||
else
|
||||
|
@ -1229,16 +1229,18 @@ typedef enum
|
|||
- (void) setRatioSetting: (id) sender
|
||||
{
|
||||
NSInteger setting;
|
||||
bool single = NO;
|
||||
switch ([sender indexOfSelectedItem])
|
||||
{
|
||||
case OPTION_POPUP_LIMIT:
|
||||
setting = NSOnState;
|
||||
setting = TR_RATIOLIMIT_SINGLE;
|
||||
single = YES;
|
||||
break;
|
||||
case OPTION_POPUP_NO_LIMIT:
|
||||
setting = NSOffState;
|
||||
setting = TR_RATIOLIMIT_UNLIMITED;
|
||||
break;
|
||||
case OPTION_POPUP_GLOBAL:
|
||||
setting = NSMixedState;
|
||||
setting = TR_RATIOLIMIT_GLOBAL;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -1247,12 +1249,11 @@ typedef enum
|
|||
for (Torrent * torrent in fTorrents)
|
||||
[torrent setRatioSetting: setting];
|
||||
|
||||
BOOL single = setting == NSOnState;
|
||||
[fRatioLimitField setHidden: !single];
|
||||
if (single)
|
||||
{
|
||||
[fRatioLimitField selectText: self];
|
||||
[[self window] makeKeyAndOrderFront:self];
|
||||
[[self window] makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
|
||||
|
|
|
@ -191,7 +191,7 @@ tr_session * fHandle;
|
|||
[fFolderPopUp selectItemAtIndex: [fDefaults boolForKey: @"DownloadLocationConstant"] ? DOWNLOAD_FOLDER : DOWNLOAD_TORRENT];
|
||||
|
||||
//set stop ratio
|
||||
[self updateRatioStopField];
|
||||
[fRatioStopField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
|
||||
//set limits
|
||||
[self updateLimitFields];
|
||||
|
@ -568,15 +568,15 @@ tr_session * fHandle;
|
|||
|
||||
- (void) applyRatioSetting: (id) sender
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
|
||||
//[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateUI" object: nil];
|
||||
tr_sessionSetRatioLimited(fHandle, [fDefaults boolForKey: @"RatioCheck"]);
|
||||
tr_sessionSetRatioLimit(fHandle, [fDefaults floatForKey: @"RatioLimit"]);
|
||||
}
|
||||
|
||||
- (void) updateRatioStopField
|
||||
{
|
||||
if (!fHasLoaded)
|
||||
return;
|
||||
|
||||
[fRatioStopField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
if (fHasLoaded)
|
||||
[fRatioStopField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
|
||||
[self applyRatioSetting: nil];
|
||||
}
|
||||
|
@ -584,6 +584,7 @@ tr_session * fHandle;
|
|||
- (void) setRatioStop: (id) sender
|
||||
{
|
||||
[fDefaults setFloat: [sender floatValue] forKey: @"RatioLimit"];
|
||||
|
||||
[self applyRatioSetting: nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
@class FileListNode;
|
||||
|
||||
#define INVALID -99
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TORRENT_FILE_DELETE,
|
||||
|
@ -65,8 +63,6 @@ typedef enum
|
|||
NSIndexSet * fPreviousFinishedIndexes;
|
||||
NSDate * fPreviousFinishedIndexesDate;
|
||||
|
||||
CGFloat fRatioLimit;
|
||||
NSInteger fRatioSetting;
|
||||
BOOL fFinishedSeeding, fWaitToStart, fStalled;
|
||||
|
||||
NSInteger fGroupValue;
|
||||
|
@ -107,11 +103,11 @@ typedef enum
|
|||
- (void) resetCache;
|
||||
|
||||
- (CGFloat) ratio;
|
||||
- (NSInteger) ratioSetting;
|
||||
- (void) setRatioSetting: (NSInteger) setting;
|
||||
- (tr_ratiolimit) ratioSetting;
|
||||
- (void) setRatioSetting: (tr_ratiolimit) setting;
|
||||
- (CGFloat) ratioLimit;
|
||||
- (void) setRatioLimit: (CGFloat) limit;
|
||||
- (CGFloat) actualStopRatio; //returns INVALID if will not stop
|
||||
- (BOOL) seedRatioSet;
|
||||
- (CGFloat) progressStopRatio;
|
||||
|
||||
- (tr_speedlimit) speedMode: (BOOL) upload;
|
||||
|
@ -180,7 +176,6 @@ typedef enum
|
|||
- (CGFloat) checkingProgress;
|
||||
|
||||
- (NSInteger) eta;
|
||||
- (NSInteger) etaRatio;
|
||||
|
||||
- (CGFloat) notAvailableDesired;
|
||||
|
||||
|
|
125
macosx/Torrent.m
125
macosx/Torrent.m
|
@ -34,7 +34,6 @@
|
|||
publicTorrent: (NSNumber *) publicTorrent
|
||||
downloadFolder: (NSString *) downloadFolder
|
||||
useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
|
||||
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
waitToStart: (NSNumber *) waitToStart
|
||||
groupValue: (NSNumber *) groupValue addedTrackers: (NSNumber *) addedTrackers;
|
||||
|
||||
|
@ -47,10 +46,12 @@
|
|||
|
||||
- (void) completenessChange: (NSNumber *) status;
|
||||
|
||||
- (void) ratioLimitHit;
|
||||
|
||||
- (void) quickPause;
|
||||
- (void) endQuickPause;
|
||||
|
||||
- (NSString *) etaString: (NSInteger) eta;
|
||||
- (NSString *) etaString;
|
||||
|
||||
- (void) updateAllTrackers: (NSMutableArray *) trackers;
|
||||
|
||||
|
@ -63,7 +64,12 @@
|
|||
void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, void * torrentData)
|
||||
{
|
||||
[(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:)
|
||||
withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
|
||||
withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
|
||||
}
|
||||
|
||||
void ratioLimitHitCallback(tr_torrent * torrent, void * torrentData)
|
||||
{
|
||||
[(Torrent *)torrentData performSelectorOnMainThread: @selector(ratioLimitHit) withObject: nil waitUntilDone: NO];
|
||||
}
|
||||
|
||||
int trashDataFile(const char * filename)
|
||||
|
@ -81,7 +87,6 @@ int trashDataFile(const char * filename)
|
|||
publicTorrent: torrentDelete != TORRENT_FILE_DEFAULT ? [NSNumber numberWithBool: torrentDelete == TORRENT_FILE_SAVE] : nil
|
||||
downloadFolder: location
|
||||
useIncompleteFolder: nil incompleteFolder: nil
|
||||
ratioSetting: nil ratioLimit: nil
|
||||
waitToStart: nil groupValue: nil addedTrackers: nil];
|
||||
|
||||
if (self)
|
||||
|
@ -106,7 +111,6 @@ int trashDataFile(const char * filename)
|
|||
publicTorrent: [NSNumber numberWithBool: NO]
|
||||
downloadFolder: location
|
||||
useIncompleteFolder: nil incompleteFolder: nil
|
||||
ratioSetting: nil ratioLimit: nil
|
||||
waitToStart: nil groupValue: nil addedTrackers: nil];
|
||||
|
||||
return self;
|
||||
|
@ -120,8 +124,6 @@ int trashDataFile(const char * filename)
|
|||
downloadFolder: [history objectForKey: @"DownloadFolder"]
|
||||
useIncompleteFolder: [history objectForKey: @"UseIncompleteFolder"]
|
||||
incompleteFolder: [history objectForKey: @"IncompleteFolder"]
|
||||
ratioSetting: [history objectForKey: @"RatioSetting"]
|
||||
ratioLimit: [history objectForKey: @"RatioLimit"]
|
||||
waitToStart: [history objectForKey: @"WaitToStart"]
|
||||
groupValue: [history objectForKey: @"GroupValue"]
|
||||
addedTrackers: [history objectForKey: @"AddedTrackers"]];
|
||||
|
@ -144,6 +146,21 @@ int trashDataFile(const char * filename)
|
|||
tr_torrentSetActivityDate(fHandle, [date timeIntervalSince1970]);
|
||||
if ((date = [history objectForKey: @"DateCompleted"]))
|
||||
tr_torrentSetDoneDate(fHandle, [date timeIntervalSince1970]);
|
||||
|
||||
//upgrading from versions < 1.60: get old stop ratio settings
|
||||
NSNumber * ratioSetting;
|
||||
if ((ratioSetting = [history objectForKey: @"RatioSetting"]))
|
||||
{
|
||||
switch ([ratioSetting intValue])
|
||||
{
|
||||
case NSOnState: [self setRatioSetting: TR_RATIOLIMIT_SINGLE]; break;
|
||||
case NSOffState: [self setRatioSetting: TR_RATIOLIMIT_UNLIMITED]; break;
|
||||
case NSMixedState: [self setRatioSetting: TR_RATIOLIMIT_GLOBAL]; break;
|
||||
}
|
||||
}
|
||||
NSNumber * ratioLimit;
|
||||
if ((ratioLimit = [history objectForKey: @"RatioLimit"]))
|
||||
[self setRatioLimit: [ratioLimit floatValue]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -156,8 +173,6 @@ int trashDataFile(const char * filename)
|
|||
fDownloadFolder, @"DownloadFolder",
|
||||
[NSNumber numberWithBool: fUseIncompleteFolder], @"UseIncompleteFolder",
|
||||
[NSNumber numberWithBool: [self isActive]], @"Active",
|
||||
[NSNumber numberWithInt: fRatioSetting], @"RatioSetting",
|
||||
[NSNumber numberWithFloat: fRatioLimit], @"RatioLimit",
|
||||
[NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
|
||||
[NSNumber numberWithInt: fGroupValue], @"GroupValue",
|
||||
[NSNumber numberWithBool: fAddedTrackers], @"AddedTrackers", nil];
|
||||
|
@ -279,19 +294,6 @@ int trashDataFile(const char * filename)
|
|||
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
||||
//check to stop for ratio
|
||||
CGFloat stopRatio;
|
||||
if ([self isSeeding] && (stopRatio = [self actualStopRatio]) != INVALID && [self ratio] >= stopRatio)
|
||||
{
|
||||
[self setRatioSetting: NSOffState];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
|
||||
|
||||
[self stopTransfer];
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
||||
fFinishedSeeding = YES;
|
||||
}
|
||||
|
||||
//check if stalled (stored because based on time and needs to check if it was previously stalled)
|
||||
fStalled = [self isActive] && [fDefaults boolForKey: @"CheckStalled"]
|
||||
&& [self stalledMinutes] > [fDefaults integerForKey: @"StalledMinutes"];
|
||||
|
@ -359,41 +361,37 @@ int trashDataFile(const char * filename)
|
|||
return fStat->ratio;
|
||||
}
|
||||
|
||||
- (NSInteger) ratioSetting
|
||||
- (tr_ratiolimit) ratioSetting
|
||||
{
|
||||
return fRatioSetting;
|
||||
return tr_torrentGetRatioMode(fHandle);
|
||||
}
|
||||
|
||||
- (void) setRatioSetting: (NSInteger) setting
|
||||
- (void) setRatioSetting: (tr_ratiolimit) setting
|
||||
{
|
||||
fRatioSetting = setting;
|
||||
tr_torrentSetRatioMode(fHandle, setting);
|
||||
}
|
||||
|
||||
- (CGFloat) ratioLimit
|
||||
{
|
||||
return fRatioLimit;
|
||||
return tr_torrentGetRatioLimit(fHandle);
|
||||
}
|
||||
|
||||
- (void) setRatioLimit: (CGFloat) limit
|
||||
{
|
||||
if (limit >= 0)
|
||||
fRatioLimit = limit;
|
||||
NSAssert(limit >= 0, @"Ratio cannot be negative");
|
||||
tr_torrentSetRatioLimit(fHandle, limit);
|
||||
}
|
||||
|
||||
- (CGFloat) actualStopRatio
|
||||
- (BOOL) seedRatioSet
|
||||
{
|
||||
if (fRatioSetting == NSOnState)
|
||||
return fRatioLimit;
|
||||
else if (fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"])
|
||||
return [fDefaults floatForKey: @"RatioLimit"];
|
||||
else
|
||||
return INVALID;
|
||||
return tr_torrentGetSeedRatio(fHandle, NULL);
|
||||
}
|
||||
|
||||
#warning move to libtransmission
|
||||
- (CGFloat) progressStopRatio
|
||||
{
|
||||
CGFloat stopRatio, ratio;
|
||||
if ((stopRatio = [self actualStopRatio]) == INVALID || (ratio = [self ratio]) >= stopRatio)
|
||||
double stopRatio, ratio;
|
||||
if (!tr_torrentGetSeedRatio(fHandle, &stopRatio) || (ratio = [self ratio]) >= stopRatio)
|
||||
return 1.0;
|
||||
else if (stopRatio > 0.0)
|
||||
return ratio / stopRatio;
|
||||
|
@ -903,24 +901,6 @@ int trashDataFile(const char * filename)
|
|||
return fStat->eta;
|
||||
}
|
||||
|
||||
- (NSInteger) etaRatio
|
||||
{
|
||||
if (![self isSeeding])
|
||||
return TR_ETA_UNKNOWN;
|
||||
|
||||
CGFloat uploadRate = [self uploadRate];
|
||||
if (uploadRate < 0.1)
|
||||
return TR_ETA_UNKNOWN;
|
||||
|
||||
CGFloat stopRatio = [self actualStopRatio], ratio = [self ratio];
|
||||
if (stopRatio == INVALID || ratio >= stopRatio)
|
||||
return TR_ETA_UNKNOWN;
|
||||
|
||||
CGFloat haveDownloaded = (CGFloat)([self downloadedTotal] > 0 ? [self downloadedTotal] : [self haveVerified]);
|
||||
CGFloat needUploaded = haveDownloaded * (stopRatio - ratio);
|
||||
return needUploaded / uploadRate / 1024.0;
|
||||
}
|
||||
|
||||
- (CGFloat) notAvailableDesired
|
||||
{
|
||||
return 1.0 - (CGFloat)fStat->desiredAvailable / [self sizeLeft];
|
||||
|
@ -1086,12 +1066,8 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
|
||||
//add time when downloading
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding]
|
||||
&& (fRatioSetting == NSOnState || (fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"]))))
|
||||
{
|
||||
NSInteger eta = fStat->activity == TR_STATUS_DOWNLOAD ? [self eta] : [self etaRatio];
|
||||
string = [string stringByAppendingFormat: @" - %@", [self etaString: eta]];
|
||||
}
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedRatioSet]))
|
||||
string = [string stringByAppendingFormat: @" - %@", [self etaString]];
|
||||
|
||||
return string;
|
||||
}
|
||||
|
@ -1229,11 +1205,10 @@ int trashDataFile(const char * filename)
|
|||
|
||||
- (NSString *) remainingTimeString
|
||||
{
|
||||
if (![self isActive] || ([self isSeeding]
|
||||
&& !(fRatioSetting == NSOnState || (fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"]))))
|
||||
if (fStat->activity == TR_STATUS_DOWNLOAD || ([self isSeeding] && [self seedRatioSet]))
|
||||
return [self etaString];
|
||||
else
|
||||
return [self shortStatusString];
|
||||
|
||||
return [self etaString: [self isSeeding] ? [self etaRatio] : [self eta]];
|
||||
}
|
||||
|
||||
- (NSString *) stateString
|
||||
|
@ -1602,7 +1577,6 @@ int trashDataFile(const char * filename)
|
|||
publicTorrent: (NSNumber *) publicTorrent
|
||||
downloadFolder: (NSString *) downloadFolder
|
||||
useIncompleteFolder: (NSNumber *) useIncompleteFolder incompleteFolder: (NSString *) incompleteFolder
|
||||
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
waitToStart: (NSNumber *) waitToStart
|
||||
groupValue: (NSNumber *) groupValue addedTrackers: (NSNumber *) addedTrackers
|
||||
{
|
||||
|
@ -1682,12 +1656,11 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
|
||||
tr_torrentSetCompletenessCallback(fHandle, completenessChangeCallback, self);
|
||||
tr_torrentSetRatioLimitHitCallback(fHandle, ratioLimitHitCallback, self);
|
||||
|
||||
fNameString = [[NSString alloc] initWithUTF8String: fInfo->name];
|
||||
fHashString = [[NSString alloc] initWithUTF8String: fInfo->hashString];
|
||||
|
||||
fRatioSetting = ratioSetting ? [ratioSetting intValue] : NSMixedState;
|
||||
fRatioLimit = ratioLimit ? [ratioLimit floatValue] : [fDefaults floatForKey: @"RatioLimit"];
|
||||
fFinishedSeeding = NO;
|
||||
|
||||
fWaitToStart = waitToStart && [waitToStart boolValue];
|
||||
|
@ -1878,7 +1851,16 @@ int trashDataFile(const char * filename)
|
|||
[status release];
|
||||
|
||||
[self update];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) ratioLimitHit
|
||||
{
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
|
||||
|
||||
fFinishedSeeding = YES;
|
||||
}
|
||||
|
||||
- (void) quickPause
|
||||
{
|
||||
|
@ -1911,8 +1893,9 @@ int trashDataFile(const char * filename)
|
|||
fQuickPauseDict = nil;
|
||||
}
|
||||
|
||||
- (NSString *) etaString: (NSInteger) eta
|
||||
- (NSString *) etaString
|
||||
{
|
||||
const NSInteger eta = [self eta];
|
||||
switch (eta)
|
||||
{
|
||||
case TR_ETA_NOT_AVAIL:
|
||||
|
|
Loading…
Reference in New Issue