Changeset 9215
- Timestamp:
- Sep 28, 2009, 3:59:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/TrackerCell.m
r9214 r9215 51 51 - (NSAttributedString *) attributedNameWithColor: (NSColor *) color; 52 52 - (NSAttributedString *) attributedStatusWithString: (NSString *) statusString color: (NSColor *) color; 53 - (NSAttributedString *) attributedCount: (NSInteger) count color: (NSColor *) color; 53 54 54 55 @end … … 136 137 137 138 //count strings 138 NSString * seederBaseString = [node totalSeeders] != -1 ? [NSString stringWithFormat: @"%d", [node totalSeeders]] 139 : NSLocalizedString(@"N/A", "tracker peer stat"); 140 NSAttributedString * seederString = [self attributedStatusWithString: seederBaseString color: statusColor]; 139 NSAttributedString * seederString = [self attributedCount: [node totalSeeders] color: statusColor]; 141 140 const NSRect seederRect = [self rectForCountWithString: seederString withAboveRect: nameRect inBounds: cellFrame]; 142 141 [seederString drawInRect: seederRect]; 143 142 144 NSString * leecherBaseString = [node totalLeechers] != -1 ? [NSString stringWithFormat: @"%d", [node totalLeechers]] 145 : NSLocalizedString(@"N/A", "tracker peer stat"); 146 NSAttributedString * leecherString = [self attributedStatusWithString: leecherBaseString color: statusColor]; 143 NSAttributedString * leecherString = [self attributedCount: [node totalLeechers] color: statusColor]; 147 144 const NSRect leecherRect = [self rectForCountWithString: leecherString withAboveRect: seederRect inBounds: cellFrame]; 148 145 [leecherString drawInRect: leecherRect]; 149 146 150 NSString * downloadedBaseString = [node totalDownloaded] != -1 ? [NSString stringWithFormat: @"%d", [node totalDownloaded]] 151 : NSLocalizedString(@"N/A", "tracker peer stat"); 152 NSAttributedString * downloadedString = [self attributedStatusWithString: downloadedBaseString color: statusColor]; 147 NSAttributedString * downloadedString = [self attributedCount: [node totalDownloaded] color: statusColor]; 153 148 const NSRect downloadedRect = [self rectForCountWithString: downloadedString withAboveRect: leecherRect inBounds: cellFrame]; 154 149 [downloadedString drawInRect: downloadedRect]; … … 298 293 - (NSAttributedString *) attributedNameWithColor: (NSColor *) color 299 294 { 300 if (color) 301 [fNameAttributes setObject: color forKey: NSForegroundColorAttributeName]; 302 295 [fNameAttributes setObject: color forKey: NSForegroundColorAttributeName]; 296 303 297 NSString * name = [(TrackerNode *)[self objectValue] host]; 304 298 return [[[NSAttributedString alloc] initWithString: name attributes: fNameAttributes] autorelease]; … … 307 301 - (NSAttributedString *) attributedStatusWithString: (NSString *) statusString color: (NSColor *) color 308 302 { 309 if (color) 310 [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName]; 303 [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName]; 311 304 312 305 return [[[NSAttributedString alloc] initWithString: statusString attributes: fStatusAttributes] autorelease]; 313 306 } 314 307 308 - (NSAttributedString *) attributedCount: (NSInteger) count color: (NSColor *) color 309 { 310 [fStatusAttributes setObject: color forKey: NSForegroundColorAttributeName]; 311 312 NSString * countString = count != -1 ? [NSString stringWithFormat: @"%d", count] : NSLocalizedString(@"N/A", "tracker peer stat"); 313 return [[[NSAttributedString alloc] initWithString: countString attributes: fStatusAttributes] autorelease]; 314 } 315 315 316 @end
Note: See TracChangeset
for help on using the changeset viewer.