mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
same as last change for ratio option
This commit is contained in:
+1
-3
@@ -9,7 +9,6 @@
|
||||
revealFile = id;
|
||||
revealTorrentFile = id;
|
||||
setLimitCheck = id;
|
||||
setRatioCustom = id;
|
||||
setRatioLimit = id;
|
||||
setRatioSetting = id;
|
||||
setSpeedLimit = id;
|
||||
@@ -40,10 +39,9 @@
|
||||
fPeerTable = NSTableView;
|
||||
fPiecesField = NSTextField;
|
||||
fPiecesView = PiecesView;
|
||||
fRatioCustomCheck = NSButton;
|
||||
fRatioCheck = NSButton;
|
||||
fRatioField = NSTextField;
|
||||
fRatioLimitField = NSTextField;
|
||||
fRatioStopCheck = NSButton;
|
||||
fRevealDataButton = NSButton;
|
||||
fRevealTorrentButton = NSButton;
|
||||
fSecureField = NSTextField;
|
||||
|
||||
Binary file not shown.
@@ -56,7 +56,7 @@
|
||||
IBOutlet NSOutlineView * fFileOutline;
|
||||
IBOutlet NSTextField * fFileTableStatusField;
|
||||
|
||||
IBOutlet NSButton * fRatioCustomCheck, * fRatioStopCheck, * fUploadLimitCheck, * fDownloadLimitCheck;
|
||||
IBOutlet NSButton * fRatioCheck, * fUploadLimitCheck, * fDownloadLimitCheck;
|
||||
IBOutlet NSTextField * fUploadLimitField, * fDownloadLimitField, * fRatioLimitField,
|
||||
* fUploadLimitLabel, * fDownloadLimitLabel;
|
||||
}
|
||||
@@ -74,7 +74,6 @@
|
||||
- (void) setLimitCheck: (id) sender;
|
||||
- (void) setSpeedLimit: (id) sender;
|
||||
|
||||
- (void) setRatioCustom: (id) sender;
|
||||
- (void) setRatioSetting: (id) sender;
|
||||
- (void) setRatioLimit: (id) sender;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#define TAB_ACTIVITY_HEIGHT 170.0
|
||||
#define TAB_PEERS_HEIGHT 268.0
|
||||
#define TAB_FILES_HEIGHT 268.0
|
||||
#define TAB_OPTIONS_HEIGHT 127.0
|
||||
#define TAB_OPTIONS_HEIGHT 112.0
|
||||
|
||||
#define INVALID -99
|
||||
|
||||
@@ -437,32 +437,22 @@
|
||||
enumerator = [fTorrents objectEnumerator];
|
||||
torrent = [enumerator nextObject]; //first torrent
|
||||
|
||||
int ratioCustom = [torrent customRatioSetting] ? 1 : 0,
|
||||
ratioStop = [torrent shouldStopAtRatio];
|
||||
int ratioSetting = [torrent ratioSetting];
|
||||
float ratioLimit = [torrent ratioLimit];
|
||||
|
||||
while ((ratioCustom != INVALID || ratioStop != INVALID || ratioLimit != INVALID)
|
||||
while ((ratioSetting != NSMixedState || ratioLimit != INVALID)
|
||||
&& (torrent = [enumerator nextObject]))
|
||||
{
|
||||
if (ratioCustom != INVALID && ratioCustom != ([torrent customRatioSetting] ? 1 : 0))
|
||||
ratioCustom = INVALID;
|
||||
|
||||
if (ratioStop != INVALID && ratioStop != ([torrent shouldStopAtRatio] ? 1 : 0))
|
||||
ratioStop = INVALID;
|
||||
if (ratioSetting != NSMixedState && ratioSetting != [torrent ratioSetting])
|
||||
ratioSetting = NSMixedState;
|
||||
|
||||
if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit])
|
||||
ratioLimit = INVALID;
|
||||
}
|
||||
|
||||
[fRatioCustomCheck setEnabled: YES];
|
||||
[fRatioCustomCheck setState: ratioCustom == INVALID ? NSMixedState
|
||||
: (ratioCustom == 1 ? NSOnState : NSOffState)];
|
||||
|
||||
[fRatioStopCheck setEnabled: ratioCustom == 1];
|
||||
[fRatioStopCheck setState: ratioStop == INVALID ? NSMixedState
|
||||
: (ratioStop == 1 ? NSOnState : NSOffState)];
|
||||
|
||||
[fRatioLimitField setEnabled: ratioCustom == 1 && ratioStop == 1];
|
||||
[fRatioCheck setEnabled: YES];
|
||||
[fRatioCheck setState: ratioSetting];
|
||||
[fRatioLimitField setEnabled: ratioSetting == NSOnState];
|
||||
if (ratioLimit != INVALID)
|
||||
[fRatioLimitField setFloatValue: ratioLimit];
|
||||
else
|
||||
@@ -482,10 +472,8 @@
|
||||
[fDownloadLimitField setStringValue: @""];
|
||||
[fDownloadLimitLabel setEnabled: NO];
|
||||
|
||||
[fRatioCustomCheck setEnabled: NO];
|
||||
[fRatioCustomCheck setState: NSOffState];
|
||||
[fRatioStopCheck setEnabled: NO];
|
||||
[fRatioStopCheck setState: NSOffState];
|
||||
[fRatioCheck setEnabled: NO];
|
||||
[fRatioCheck setState: NSOffState];
|
||||
[fRatioLimitField setEnabled: NO];
|
||||
[fRatioLimitField setStringValue: @""];
|
||||
}
|
||||
@@ -830,7 +818,6 @@
|
||||
upload ? [torrent setCheckUpload: state] : [torrent setCheckDownload: state];
|
||||
|
||||
NSTextField * field = upload ? fUploadLimitField : fDownloadLimitField;
|
||||
|
||||
[field setEnabled: state == NSOnState];
|
||||
}
|
||||
|
||||
@@ -865,33 +852,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setRatioCustom: (id) sender
|
||||
{
|
||||
BOOL custom = [sender state] != NSOffState;
|
||||
if (custom)
|
||||
[sender setState: NSOnState];
|
||||
|
||||
Torrent * torrent;
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
[torrent setCustomRatioSetting: custom];
|
||||
|
||||
[fRatioStopCheck setEnabled: custom];
|
||||
[fRatioLimitField setEnabled: custom && [fRatioStopCheck state] == NSOnState];
|
||||
}
|
||||
|
||||
- (void) setRatioSetting: (id) sender
|
||||
{
|
||||
BOOL enabled = [sender state] != NSOffState;
|
||||
if (enabled)
|
||||
[sender setState: NSOnState];
|
||||
|
||||
int state = [sender state];
|
||||
|
||||
Torrent * torrent;
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
[torrent setShouldStopAtRatio: enabled];
|
||||
[torrent setRatioSetting: state];
|
||||
|
||||
[fRatioLimitField setEnabled: enabled && [fRatioCustomCheck state] == NSOnState];
|
||||
[fRatioLimitField setEnabled: state == NSOnState];
|
||||
}
|
||||
|
||||
- (void) setRatioLimit: (id) sender
|
||||
|
||||
+4
-7
@@ -50,9 +50,8 @@
|
||||
|
||||
int fUploadLimit, fDownloadLimit;
|
||||
float fRatioLimit;
|
||||
int fCheckUpload, fCheckDownload;
|
||||
BOOL fRatioCustom, fShouldStopAtRatio,
|
||||
fFinishedSeeding, fWaitToStart, fError, fChecking;
|
||||
int fCheckUpload, fCheckDownload, fRatioSetting;
|
||||
BOOL fFinishedSeeding, fWaitToStart, fError, fChecking;
|
||||
|
||||
int fOrderValue;
|
||||
|
||||
@@ -86,10 +85,8 @@
|
||||
- (BOOL) allDownloaded;
|
||||
|
||||
- (float) ratio;
|
||||
- (BOOL) customRatioSetting;
|
||||
- (void) setCustomRatioSetting: (BOOL) setting;
|
||||
- (BOOL) shouldStopAtRatio;
|
||||
- (void) setShouldStopAtRatio: (BOOL) setting;
|
||||
- (int) ratioSetting;
|
||||
- (void) setRatioSetting: (int) setting;
|
||||
- (float) ratioLimit;
|
||||
- (void) setRatioLimit: (float) limit;
|
||||
|
||||
|
||||
+11
-28
@@ -35,9 +35,7 @@
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
|
||||
publicTorrent: (NSNumber *) publicTorrent
|
||||
date: (NSDate *) date
|
||||
stopRatioCustom: (NSNumber *) ratioCustom
|
||||
shouldStopAtRatio: (NSNumber *) shouldStopAtRatio
|
||||
ratioLimit: (NSNumber *) ratioLimit
|
||||
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
limitSpeedCustom: (NSNumber *) limitCustom
|
||||
checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit
|
||||
checkDownload: (NSNumber *) checkDownload downloadLimit: (NSNumber *) downloadLimit
|
||||
@@ -94,8 +92,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
path: [history objectForKey: @"TorrentPath"] lib: lib
|
||||
publicTorrent: [history objectForKey: @"PublicCopy"]
|
||||
date: [history objectForKey: @"Date"]
|
||||
stopRatioCustom: [history objectForKey: @"StopRatioCustom"]
|
||||
shouldStopAtRatio: [history objectForKey: @"ShouldStopAtRatio"]
|
||||
ratioSetting: [history objectForKey: @"RatioSetting"]
|
||||
ratioLimit: [history objectForKey: @"RatioLimit"]
|
||||
limitSpeedCustom: [history objectForKey: @"LimitSpeedCustom"]
|
||||
checkUpload: [history objectForKey: @"CheckUpload"]
|
||||
@@ -149,8 +146,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
[NSNumber numberWithBool: fUseIncompleteFolder], @"UseIncompleteFolder",
|
||||
[self isActive] ? @"NO" : @"YES", @"Paused",
|
||||
[self date], @"Date",
|
||||
[NSNumber numberWithBool: fRatioCustom], @"StopRatioCustom",
|
||||
[NSNumber numberWithBool: fShouldStopAtRatio], @"ShouldStopAtRatio",
|
||||
[NSNumber numberWithBool: fRatioSetting], @"RatioSetting",
|
||||
[NSNumber numberWithFloat: fRatioLimit], @"RatioLimit",
|
||||
[NSNumber numberWithInt: fCheckUpload], @"CheckUpload",
|
||||
[NSNumber numberWithInt: fUploadLimit], @"UploadLimit",
|
||||
@@ -267,8 +263,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
}
|
||||
|
||||
//check to stop for ratio
|
||||
if ([self isSeeding] && ((fRatioCustom && fShouldStopAtRatio && [self ratio] >= fRatioLimit)
|
||||
|| (!fRatioCustom && [fDefaults boolForKey: @"RatioCheck"]
|
||||
if ([self isSeeding] && ((fRatioSetting == NSOnState && [self ratio] >= fRatioLimit)
|
||||
|| (!fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"]
|
||||
&& [self ratio] >= [fDefaults floatForKey: @"RatioLimit"])))
|
||||
{
|
||||
[self stopTransfer];
|
||||
@@ -527,24 +523,14 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
return fStat->ratio;
|
||||
}
|
||||
|
||||
- (BOOL) customRatioSetting
|
||||
- (int) ratioSetting
|
||||
{
|
||||
return fRatioCustom;
|
||||
return fRatioSetting;
|
||||
}
|
||||
|
||||
- (void) setCustomRatioSetting: (BOOL) setting
|
||||
- (void) setRatioSetting: (int) setting
|
||||
{
|
||||
fRatioCustom = setting;
|
||||
}
|
||||
|
||||
- (BOOL) shouldStopAtRatio
|
||||
{
|
||||
return fShouldStopAtRatio;
|
||||
}
|
||||
|
||||
- (void) setShouldStopAtRatio: (BOOL) setting
|
||||
{
|
||||
fShouldStopAtRatio = setting;
|
||||
fRatioSetting = setting;
|
||||
}
|
||||
|
||||
- (float) ratioLimit
|
||||
@@ -1113,9 +1099,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
- (id) initWithHash: (NSString *) hashString path: (NSString *) path lib: (tr_handle_t *) lib
|
||||
publicTorrent: (NSNumber *) publicTorrent
|
||||
date: (NSDate *) date
|
||||
stopRatioCustom: (NSNumber *) ratioCustom
|
||||
shouldStopAtRatio: (NSNumber *) shouldStopAtRatio
|
||||
ratioLimit: (NSNumber *) ratioLimit
|
||||
ratioSetting: (NSNumber *) ratioSetting ratioLimit: (NSNumber *) ratioLimit
|
||||
limitSpeedCustom: (NSNumber *) limitCustom
|
||||
checkUpload: (NSNumber *) checkUpload uploadLimit: (NSNumber *) uploadLimit
|
||||
checkDownload: (NSNumber *) checkDownload downloadLimit: (NSNumber *) downloadLimit
|
||||
@@ -1152,8 +1136,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||
|
||||
fDate = date ? [date retain] : [[NSDate alloc] init];
|
||||
|
||||
fRatioCustom = ratioCustom ? [ratioCustom boolValue] : NO;
|
||||
fShouldStopAtRatio = shouldStopAtRatio ? [shouldStopAtRatio boolValue] : [fDefaults boolForKey: @"RatioCheck"];
|
||||
fRatioSetting = ratioSetting ? [ratioSetting intValue] : NSMixedState;
|
||||
fRatioLimit = ratioLimit ? [ratioLimit floatValue] : [fDefaults floatForKey: @"RatioLimit"];
|
||||
fFinishedSeeding = NO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user