mirror of
https://github.com/transmission/transmission
synced 2025-03-09 13:50:00 +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>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>549</key>
|
<key>549</key>
|
||||||
<string>69 306 75 68 0 0 1152 842 </string>
|
<string>364 417 144 49 0 0 1152 842 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>446.1</string>
|
<string>446.1</string>
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
</array>
|
</array>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>549</integer>
|
|
||||||
<integer>5</integer>
|
<integer>5</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<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]];
|
[fStateField setStringValue: [torrent state]];
|
||||||
[fPercentField setStringValue: [NSString stringWithFormat:
|
[fPercentField setStringValue: [NSString stringWithFormat:
|
||||||
@"%.2f%%", 100 * [torrent progress]]];
|
@"%.2f%%", 100.0 * [torrent progress]]];
|
||||||
|
|
||||||
int seeders = [torrent seeders], leechers = [torrent leechers];
|
int seeders = [torrent seeders], leechers = [torrent leechers];
|
||||||
[fSeedersField setStringValue: seeders < 0 ?
|
[fSeedersField setStringValue: seeders < 0 ?
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
[fProgressString setString: @""];
|
[fProgressString setString: @""];
|
||||||
if ([self progress] < 1.0)
|
if ([self progress] < 1.0)
|
||||||
[fProgressString appendFormat: @"%@ of %@ (%.2f%%)", [NSString stringForFileSize:
|
[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
|
else
|
||||||
[fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize:
|
[fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize:
|
||||||
[self size]], [NSString stringForFileSize: [self uploadedTotal]],
|
[self size]], [NSString stringForFileSize: [self uploadedTotal]],
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
@interface TorrentCell (Private)
|
@interface TorrentCell (Private)
|
||||||
|
|
||||||
- (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point;
|
- (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point;
|
||||||
- (void) buildSimpleBar: (int) width point: (NSPoint) point;
|
- (void) buildSimpleBar: (float) width point: (NSPoint) point;
|
||||||
- (void) buildAdvancedBar: (int) width point: (NSPoint) point;
|
- (void) buildAdvancedBar: (float) width point: (NSPoint) point;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
||||||
operation: NSCompositeSourceOver];
|
operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) buildSimpleBar: (int) width point: (NSPoint) point
|
- (void) buildSimpleBar: (float) width point: (NSPoint) point
|
||||||
{
|
{
|
||||||
width -= 2.0;
|
width -= 2.0;
|
||||||
if ([fTorrent isSeeding])
|
if ([fTorrent isSeeding])
|
||||||
|
@ -134,7 +134,7 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int completedWidth = [fTorrent progress] * width,
|
float completedWidth = [fTorrent progress] * width,
|
||||||
remainingWidth = width - completedWidth;
|
remainingWidth = width - completedWidth;
|
||||||
BOOL isActive = [fTorrent isActive];
|
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 seeding, there's no need for the advanced bar
|
||||||
if ([fTorrent isSeeding])
|
if ([fTorrent isSeeding])
|
||||||
{
|
{
|
||||||
[self buildSimpleBar: width point: point];
|
[self buildSimpleBar: widthFloat point: point];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int width = widthFloat; //integers for bars
|
||||||
|
|
||||||
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
|
NSBitmapImageRep * bitmap = [[NSBitmapImageRep alloc]
|
||||||
initWithBitmapDataPlanes: nil pixelsWide: width
|
initWithBitmapDataPlanes: nil pixelsWide: width
|
||||||
pixelsHigh: BAR_HEIGHT bitsPerSample: 8 samplesPerPixel: 4
|
pixelsHigh: BAR_HEIGHT bitsPerSample: 8 samplesPerPixel: 4
|
||||||
|
@ -246,19 +248,23 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
||||||
//actually draw image
|
//actually draw image
|
||||||
NSImage * img = [[NSImage alloc] initWithSize: [bitmap size]];
|
NSImage * img = [[NSImage alloc] initWithSize: [bitmap size]];
|
||||||
[img addRepresentation: bitmap];
|
[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 compositeToPoint: point operation: NSCompositeSourceOver];
|
||||||
[img release];
|
[img release];
|
||||||
[bitmap release];
|
[bitmap release];
|
||||||
|
|
||||||
//draw overlay over advanced bar
|
//draw overlay over advanced bar
|
||||||
width -= 2.0;
|
|
||||||
|
|
||||||
[fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
|
[fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
|
||||||
|
|
||||||
|
widthFloat -= 2.0;
|
||||||
point.x += 1.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];
|
[fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue