Small efficiency change.
This commit is contained in:
parent
d5943321f4
commit
e6a7986231
|
@ -43,6 +43,8 @@
|
||||||
* fRevealOnIcon, * fRevealOffIcon;
|
* fRevealOnIcon, * fRevealOffIcon;
|
||||||
|
|
||||||
NSMutableArray * fKeyStrokes;
|
NSMutableArray * fKeyStrokes;
|
||||||
|
|
||||||
|
NSDictionary * fSmallStatusAttributes;
|
||||||
}
|
}
|
||||||
- (void) setTorrents: (NSArray *) torrents;
|
- (void) setTorrents: (NSArray *) torrents;
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,9 @@
|
||||||
|
|
||||||
fKeyStrokes = [[NSMutableArray alloc] init];
|
fKeyStrokes = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
fSmallStatusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
|
||||||
|
|
||||||
fDefaults = [NSUserDefaults standardUserDefaults];
|
fDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +81,7 @@
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[fKeyStrokes release];
|
[fKeyStrokes release];
|
||||||
|
[fSmallStatusAttributes release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,13 +291,11 @@
|
||||||
if (row < 0 || ![fDefaults boolForKey: @"SmallView"])
|
if (row < 0 || ![fDefaults boolForKey: @"SmallView"])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
NSDictionary * statusAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
|
|
||||||
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
|
|
||||||
Torrent * torrent = [fTorrents objectAtIndex: row];
|
Torrent * torrent = [fTorrents objectAtIndex: row];
|
||||||
NSString * statusString = ![fDefaults boolForKey: @"SmallStatusRegular"] && [torrent isActive]
|
NSString * statusString = ![fDefaults boolForKey: @"SmallStatusRegular"] && [torrent isActive]
|
||||||
&& [torrent progress] < 1.0 ? [torrent remainingTimeString] : [torrent shortStatusString];
|
&& [torrent progress] < 1.0 ? [torrent remainingTimeString] : [torrent shortStatusString];
|
||||||
|
|
||||||
float statusWidth = [statusString sizeWithAttributes: statusAttributes].width + 3.0;
|
float statusWidth = [statusString sizeWithAttributes: fSmallStatusAttributes].width + 3.0;
|
||||||
|
|
||||||
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
||||||
NSRect statusRect = NSMakeRect(NSMaxX(cellRect) - statusWidth, cellRect.origin.y,
|
NSRect statusRect = NSMakeRect(NSMaxX(cellRect) - statusWidth, cellRect.origin.y,
|
||||||
|
|
Loading…
Reference in New Issue