Changeset 5904 for trunk/macosx/FileNameCell.m
- Timestamp:
- May 22, 2008, 6:39:49 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/FileNameCell.m
r5581 r5904 26 26 #import "FileOutlineView.h" 27 27 #import "Torrent.h" 28 #import "FileListNode.h" 28 29 #import "NSApplicationAdditions.h" 29 30 #import "NSStringAdditions.h" … … 92 93 - (NSImage *) image 93 94 { 94 NSImage * image = [[self objectValue] objectForKey: @"Icon"]; 95 if (!image) 95 FileListNode * node = (FileListNode *)[self objectValue]; 96 NSImage * image; 97 if ([node isFolder]) 96 98 { 97 99 if (!fFolderImage) … … 102 104 image = fFolderImage; 103 105 } 106 else 107 image = [node icon]; 108 104 109 return image; 105 110 } … … 111 116 result.origin.x += PADDING_HORIZONAL; 112 117 113 const float IMAGE_SIZE = [ [[self objectValue] objectForKey: @"IsFolder"] boolValue] ? IMAGE_FOLDER_SIZE : IMAGE_ICON_SIZE;118 const float IMAGE_SIZE = [(FileListNode *)[self objectValue] isFolder] ? IMAGE_FOLDER_SIZE : IMAGE_ICON_SIZE; 114 119 result.origin.y += (result.size.height - IMAGE_SIZE) * 0.5; 115 120 result.size = NSMakeSize(IMAGE_SIZE, IMAGE_SIZE); … … 139 144 specialColor = [NSColor whiteColor]; 140 145 else if ([[(FileOutlineView *)[self controlView] torrent] checkForFiles: 141 [ [self objectValue] objectForKey: @"Indexes"]] == NSOffState)146 [(FileListNode *)[self objectValue] indexes]] == NSOffState) 142 147 specialColor = [NSColor disabledControlTextColor]; 143 148 else; … … 148 153 149 154 //status 150 if (![ [[self objectValue] objectForKey: @"IsFolder"] boolValue])155 if (![(FileListNode *)[self objectValue] isFolder]) 151 156 { 152 157 NSAttributedString * statusString = [self attributedStatusWithColor: specialColor ? specialColor : [NSColor darkGrayColor]]; … … 166 171 NSRect result = bounds; 167 172 168 if (![ [[self objectValue] objectForKey: @"IsFolder"] boolValue])173 if (![(FileListNode *)[self objectValue] isFolder]) 169 174 { 170 175 result.origin.x += PADDING_HORIZONAL + IMAGE_ICON_SIZE + PADDING_BETWEEN_IMAGE_AND_TITLE; … … 184 189 - (NSRect) rectForStatusWithString: (NSAttributedString *) string inBounds: (NSRect) bounds 185 190 { 186 if ([ [[self objectValue] objectForKey: @"IsFolder"] boolValue])191 if ([(FileListNode *)[self objectValue] isFolder]) 187 192 return NSZeroRect; 188 193 … … 205 210 [fTitleAttributes setObject: color forKey: NSForegroundColorAttributeName]; 206 211 207 NSString * title = [ [self objectValue] objectForKey: @"Name"];212 NSString * title = [(FileListNode *)[self objectValue] name]; 208 213 return [[[NSAttributedString alloc] initWithString: title attributes: fTitleAttributes] autorelease]; 209 214 } … … 215 220 216 221 Torrent * torrent = [(FileOutlineView *)[self controlView] torrent]; 217 float percent = [torrent fileProgress: [[[self objectValue] objectForKey: @"Indexes"] firstIndex]] * 100.0; 222 FileListNode * node = (FileListNode *)[self objectValue]; 223 float percent = [torrent fileProgress: [[node indexes] firstIndex]] * 100.0; 218 224 219 225 NSString * status = [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% of %@", 220 "Inspector -> Files tab -> file status string"), percent, 221 [NSString stringForFileSize: [[[self objectValue] objectForKey: @"Size"] unsignedLongLongValue]]]; 226 "Inspector -> Files tab -> file status string"), percent, [NSString stringForFileSize: [node size]]]; 222 227 223 228 return [[[NSAttributedString alloc] initWithString: status attributes: fStatusAttributes] autorelease];
Note: See TracChangeset
for help on using the changeset viewer.