mirror of
https://github.com/transmission/transmission
synced 2025-03-08 21:04:25 +00:00
Might as well make size more precise.
This commit is contained in:
parent
efb73e8b5b
commit
84ae6d401d
5 changed files with 19 additions and 14 deletions
3
macosx/English.lproj/InfoWindow.nib/info.nib
generated
3
macosx/English.lproj/InfoWindow.nib/info.nib
generated
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>549</key>
|
||||
<string>69 306 75 68 0 0 1152 842 </string>
|
||||
<string>364 417 144 49 0 0 1152 842 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
|
@ -21,7 +21,6 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>549</integer>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
|
|
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -265,7 +265,7 @@
|
|||
|
||||
[fStateField setStringValue: [torrent state]];
|
||||
[fPercentField setStringValue: [NSString stringWithFormat:
|
||||
@"%.2f%%", 100 * [torrent progress]]];
|
||||
@"%.2f%%", 100.0 * [torrent progress]]];
|
||||
|
||||
int seeders = [torrent seeders], leechers = [torrent leechers];
|
||||
[fSeedersField setStringValue: seeders < 0 ?
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
[fProgressString setString: @""];
|
||||
if ([self progress] < 1.0)
|
||||
[fProgressString appendFormat: @"%@ of %@ (%.2f%%)", [NSString stringForFileSize:
|
||||
[self downloadedValid]], [NSString stringForFileSize: [self size]], 100 * [self progress]];
|
||||
[self downloadedValid]], [NSString stringForFileSize: [self size]], 100.0 * [self progress]];
|
||||
else
|
||||
[fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize:
|
||||
[self size]], [NSString stringForFileSize: [self uploadedTotal]],
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
@interface TorrentCell (Private)
|
||||
|
||||
- (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point;
|
||||
- (void) buildSimpleBar: (int) width point: (NSPoint) point;
|
||||
- (void) buildAdvancedBar: (int) width point: (NSPoint) point;
|
||||
- (void) buildSimpleBar: (float) width point: (NSPoint) point;
|
||||
- (void) buildAdvancedBar: (float) width point: (NSPoint) point;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -119,7 +119,7 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
|||
operation: NSCompositeSourceOver];
|
||||
}
|
||||
|
||||
- (void) buildSimpleBar: (int) width point: (NSPoint) point
|
||||
- (void) buildSimpleBar: (float) width point: (NSPoint) point
|
||||
{
|
||||
width -= 2.0;
|
||||
if ([fTorrent isSeeding])
|
||||
|
@ -134,7 +134,7 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
|||
}
|
||||
else
|
||||
{
|
||||
int completedWidth = [fTorrent progress] * width,
|
||||
float completedWidth = [fTorrent progress] * width,
|
||||
remainingWidth = width - completedWidth;
|
||||
BOOL isActive = [fTorrent isActive];
|
||||
|
||||
|
@ -171,15 +171,17 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
|||
}
|
||||
}
|
||||
|
||||
- (void) buildAdvancedBar: (int) width point: (NSPoint) point
|
||||
- (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point
|
||||
{
|
||||
//if seeding, there's no need for the advanced bar
|
||||
if ([fTorrent isSeeding])
|
||||
{
|
||||
[self buildSimpleBar: width point: point];
|
||||
[self buildSimpleBar: widthFloat point: point];
|
||||
return;
|
||||
}
|
||||
|
||||
int width = widthFloat; //integers for bars
|
||||
|
||||
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes: nil pixelsWide: width
|
||||
pixelsHigh: BAR_HEIGHT bitsPerSample: 8 samplesPerPixel: 4
|
||||
|
@ -246,19 +248,23 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
|||
//actually draw image
|
||||
NSImage * img = [[NSImage alloc] initWithSize: [bitmap size]];
|
||||
[img addRepresentation: bitmap];
|
||||
|
||||
//bar size with float, not double, to match standard bar
|
||||
[img setScalesWhenResized: YES];
|
||||
[img setSize: NSMakeSize(widthFloat, BAR_HEIGHT)];
|
||||
|
||||
[img compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
[img release];
|
||||
[bitmap release];
|
||||
|
||||
//draw overlay over advanced bar
|
||||
width -= 2.0;
|
||||
|
||||
[fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
|
||||
widthFloat -= 2.0;
|
||||
point.x += 1.0;
|
||||
[self placeBar: fProgressAdvanced width: width point: point];
|
||||
[self placeBar: fProgressAdvanced width: widthFloat point: point];
|
||||
|
||||
point.x += width;
|
||||
point.x += widthFloat;
|
||||
[fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue