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