create the display icon of torrents when needed (so if you only use minimal or regular view, it won't create the other icon)

This commit is contained in:
Mitchell Livingston 2007-07-03 01:49:21 +00:00
parent 9fc1829ac5
commit 1067a001d9
1 changed files with 14 additions and 9 deletions

View File

@ -531,13 +531,13 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (![fDefaults boolForKey: @"SmallView"]) if (![fDefaults boolForKey: @"SmallView"])
{ {
[info setObject: fIconFlipped forKey: @"Icon"]; [info setObject: [self iconFlipped] forKey: @"Icon"];
[info setObject: [self progressString] forKey: @"ProgressString"]; [info setObject: [self progressString] forKey: @"ProgressString"];
[info setObject: [self statusString] forKey: @"StatusString"]; [info setObject: [self statusString] forKey: @"StatusString"];
} }
else else
{ {
[info setObject: fIconSmall forKey: @"Icon"]; [info setObject: [self iconSmall] forKey: @"Icon"];
[info setObject: [self remainingTimeString] forKey: @"RemainingTimeString"]; [info setObject: [self remainingTimeString] forKey: @"RemainingTimeString"];
[info setObject: [self shortStatusString] forKey: @"ShortStatusString"]; [info setObject: [self shortStatusString] forKey: @"ShortStatusString"];
} }
@ -935,11 +935,23 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (NSImage *) iconFlipped - (NSImage *) iconFlipped
{ {
if (!fIconFlipped)
{
fIconFlipped = [fIcon copy];
[fIconFlipped setFlipped: YES];
}
return fIconFlipped; return fIconFlipped;
} }
- (NSImage *) iconSmall - (NSImage *) iconSmall
{ {
if (!fIconSmall)
{
fIconSmall = [fIcon copy];
[fIconSmall setFlipped: YES];
[fIconSmall setScalesWhenResized: YES];
[fIconSmall setSize: NSMakeSize(16.0, 16.0)];
}
return fIconSmall; return fIconSmall;
} }
@ -1561,13 +1573,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: fInfo->multifile ? NSFileTypeForHFSTypeCode('fldr') fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: fInfo->multifile ? NSFileTypeForHFSTypeCode('fldr')
: [[self name] pathExtension]] retain]; : [[self name] pathExtension]] retain];
fIconFlipped = [fIcon copy];
[fIconFlipped setFlipped: YES];
fIconSmall = [fIconFlipped copy];
[fIconSmall setScalesWhenResized: YES];
[fIconSmall setSize: NSMakeSize(16.0, 16.0)];
fProgressString = [[NSMutableString alloc] initWithCapacity: 50]; fProgressString = [[NSMutableString alloc] initWithCapacity: 50];
fStatusString = [[NSMutableString alloc] initWithCapacity: 75]; fStatusString = [[NSMutableString alloc] initWithCapacity: 75];