Changeset 1575
- Timestamp:
- Mar 22, 2007, 4:30:08 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Transmission.xcodeproj/project.pbxproj
r1500 r1575 143 143 A289EB0C0A33C56D00B082A3 /* ButtonBorder.png in Resources */ = {isa = PBXBuildFile; fileRef = A289EB0B0A33C56D00B082A3 /* ButtonBorder.png */; }; 144 144 A28DBADC0A33C1D800F4B4A7 /* ActionButton.png in Resources */ = {isa = PBXBuildFile; fileRef = A28DBADB0A33C1D800F4B4A7 /* ActionButton.png */; }; 145 A28FF34E0BB23A4E001F5010 /* ProgressBarLightGreen.png in Resources */ = {isa = PBXBuildFile; fileRef = A28FF34D0BB23A4E001F5010 /* ProgressBarLightGreen.png */; }; 145 146 A2912C540A2956E80097A0CA /* PrefsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2912C520A2956E80097A0CA /* PrefsWindow.nib */; }; 146 147 A291DAAF0AC8BEB6003385E9 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = A291DAAD0AC8BEB6003385E9 /* PiecesView.m */; }; … … 354 355 A289EB0B0A33C56D00B082A3 /* ButtonBorder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ButtonBorder.png; path = macosx/Images/ButtonBorder.png; sourceTree = "<group>"; }; 355 356 A28DBADB0A33C1D800F4B4A7 /* ActionButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ActionButton.png; path = macosx/Images/ActionButton.png; sourceTree = "<group>"; }; 357 A28FF34D0BB23A4E001F5010 /* ProgressBarLightGreen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ProgressBarLightGreen.png; path = macosx/Images/ProgressBarLightGreen.png; sourceTree = "<group>"; }; 356 358 A2912C530A2956E80097A0CA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/PrefsWindow.nib; sourceTree = "<group>"; }; 357 359 A291DAAC0AC8BEB6003385E9 /* PiecesView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PiecesView.h; path = macosx/PiecesView.h; sourceTree = "<group>"; }; … … 518 520 A2305A7E0A3DC9E400AB2D77 /* ProgressBarGray.png */, 519 521 A2305A7F0A3DC9E400AB2D77 /* ProgressBarGreen.png */, 522 A28FF34D0BB23A4E001F5010 /* ProgressBarLightGreen.png */, 520 523 A260C9AB0AA3B8D700FDC1B7 /* Error.tiff */, 521 524 A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */, … … 858 861 A22A8D560AEEAFA5007E9CB9 /* Localizable.strings in Resources */, 859 862 A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */, 863 A28FF34E0BB23A4E001F5010 /* ProgressBarLightGreen.png in Resources */, 860 864 ); 861 865 runOnlyForDeploymentPostprocessing = 0; -
trunk/macosx/Torrent.h
r1519 r1575 25 25 #import <Cocoa/Cocoa.h> 26 26 #import <transmission.h> 27 28 #define INVALID -99 27 29 28 30 @interface Torrent : NSObject … … 90 92 - (float) ratioLimit; 91 93 - (void) setRatioLimit: (float) limit; 94 - (float) actualStopRatio; //returns INVALID if will not stop 92 95 93 96 - (int) checkUpload; -
trunk/macosx/Torrent.m
r1561 r1575 31 31 #define BLANK_PIECE -99 32 32 33 #define INVALID -9934 35 33 @interface Torrent (Private) 36 34 … … 267 265 268 266 //check to stop for ratio 269 if ([self isSeeding] && ((fRatioSetting == NSOnState && [self ratio] >= fRatioLimit) 270 || (fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"] 271 && [self ratio] >= [fDefaults floatForKey: @"RatioLimit"]))) 267 float stopRatio; 268 if ([self isSeeding] && (stopRatio = [self actualStopRatio]) != INVALID && [self ratio] >= stopRatio) 272 269 { 273 270 [self stopTransfer]; … … 437 434 [NSNumber numberWithBool: [self isError]], @"Error", nil]; 438 435 436 if ([self isSeeding]) 437 { 438 [info setObject: [NSNumber numberWithFloat: [self ratio]] forKey: @"Ratio"]; 439 [info setObject: [NSNumber numberWithFloat: [self actualStopRatio]] forKey: @"StopRatio"]; 440 } 441 439 442 if (![fDefaults boolForKey: @"SmallView"]) 440 443 { … … 546 549 if (limit >= 0) 547 550 fRatioLimit = limit; 551 } 552 553 - (float) actualStopRatio 554 { 555 if (fRatioSetting == NSOnState) 556 return fRatioLimit; 557 else if (fRatioSetting == NSMixedState && [fDefaults boolForKey: @"RatioCheck"]) 558 return [fDefaults floatForKey: @"RatioLimit"]; 559 else 560 return INVALID; 548 561 } 549 562 -
trunk/macosx/TorrentCell.h
r855 r1575 35 35 NSImage * fProgressWhite, * fProgressBlue, * fProgressGray, * fProgressGreen, 36 36 * fProgressAdvanced, * fProgressEndWhite, * fProgressEndBlue, 37 * fProgressEndGray, * fProgressEndGreen, * fProgress EndAdvanced,38 * f ErrorImage;37 * fProgressEndGray, * fProgressEndGreen, * fProgressLightGreen, 38 * fProgressEndAdvanced, * fErrorImage; 39 39 40 40 NSUserDefaults * fDefaults; -
trunk/macosx/TorrentCell.m
r1402 r1575 64 64 [fProgressGreen setScalesWhenResized: YES]; 65 65 66 fProgressLightGreen = [NSImage imageNamed: @"ProgressBarLightGreen.png"]; 67 [fProgressLightGreen setScalesWhenResized: YES]; 68 66 69 fProgressAdvanced = [NSImage imageNamed: @"ProgressBarAdvanced.png"]; 67 70 [fProgressAdvanced setScalesWhenResized: YES]; … … 92 95 93 96 width -= 2.0; 94 if ([[info objectForKey: @"Seeding"] boolValue]) 95 { 96 [fProgressEndGreen compositeToPoint: point operation: NSCompositeSourceOver]; 97 98 point.x += 1.0; 99 [self placeBar: fProgressGreen width: width point: point]; 100 101 point.x += width; 102 [fProgressEndGreen compositeToPoint: point operation: NSCompositeSourceOver]; 97 98 BOOL seeding = [[info objectForKey: @"Seeding"] boolValue], 99 isActive = [[info objectForKey: @"Active"] boolValue]; 100 float completedWidth, remainingWidth; 101 102 //bar images 103 NSImage * barLeftEnd, * barRightEnd, * barComplete, * barRemaining; 104 if (seeding) 105 { 106 float stopRatio, ratio; 107 if ((stopRatio = [[info objectForKey: @"StopRatio"] floatValue]) != INVALID 108 && (ratio = [[info objectForKey: @"Ratio"] floatValue]) < stopRatio) 109 completedWidth = width * ratio / stopRatio; 110 else 111 completedWidth = width; 112 remainingWidth = width - completedWidth; 113 114 barLeftEnd = fProgressEndGreen; 115 barRightEnd = fProgressEndGreen; 116 barComplete = fProgressGreen; 117 barRemaining = fProgressLightGreen; 103 118 } 104 119 else 105 120 { 106 float completedWidth = [[info objectForKey: @"Progress"] floatValue] * width, 107 remainingWidth = width - completedWidth; 108 BOOL isActive = [[info objectForKey: @"Active"] boolValue]; 109 110 //left end 111 NSImage * barLeftEnd; 121 completedWidth = [[info objectForKey: @"Progress"] floatValue] * width; 122 remainingWidth = width - completedWidth; 123 112 124 if (remainingWidth == width) 113 125 barLeftEnd = fProgressEndWhite; … … 117 129 barLeftEnd = fProgressEndGray; 118 130 119 [barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];120 121 //active bar122 point.x += 1.0;123 [self placeBar: isActive ? fProgressBlue : fProgressGray width: completedWidth point: point];124 125 //remaining bar126 point.x += completedWidth;127 [self placeBar: fProgressWhite width: remainingWidth point: point];128 129 //right end130 NSImage * barRightEnd;131 131 if (completedWidth < width) 132 132 barRightEnd = fProgressEndWhite; … … 136 136 barRightEnd = fProgressEndGray; 137 137 138 point.x += remainingWidth; 139 [barRightEnd compositeToPoint: point operation: NSCompositeSourceOver]; 140 } 138 barComplete = isActive ? fProgressBlue : fProgressGray; 139 barRemaining = fProgressWhite; 140 } 141 142 [barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver]; 143 144 //active bar 145 point.x += 1.0; 146 [self placeBar: barComplete width: completedWidth point: point]; 147 148 //remaining bar 149 point.x += completedWidth; 150 [self placeBar: barRemaining width: remainingWidth point: point]; 151 152 point.x += remainingWidth; 153 [barRightEnd compositeToPoint: point operation: NSCompositeSourceOver]; 141 154 } 142 155
Note: See TracChangeset
for help on using the changeset viewer.