Changeset 855 for trunk/macosx
- Timestamp:
- Sep 11, 2006, 11:52:03 PM (16 years ago)
- Location:
- trunk/macosx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r853 r855 1587 1587 } 1588 1588 1589 - (void) tableView: (NSTableView *) t willDisplayCell: (id) cell1589 /*- (void) tableView: (NSTableView *) t willDisplayCell: (id) cell 1590 1590 forTableColumn: (NSTableColumn *) tableColumn row: (int) row 1591 1591 { 1592 1592 [cell setTorrent: [fDisplayedTorrents objectAtIndex: row]]; 1593 }*/ 1594 1595 - (id) tableView: (NSTableView *) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row 1596 { 1597 return [[fDisplayedTorrents objectAtIndex: row] infoForCurrentView]; 1593 1598 } 1594 1599 -
trunk/macosx/Torrent.h
r835 r855 64 64 - (void) getAvailability: (int8_t *) tab size: (int) size; 65 65 66 - (void) update; 66 - (void) update; 67 - (NSDictionary *) infoForCurrentView; 68 67 69 - (void) startTransfer; 68 70 - (void) stopTransfer; -
trunk/macosx/Torrent.m
r842 r855 272 272 } 273 273 274 - (NSDictionary *) infoForCurrentView 275 { 276 NSMutableDictionary * info = [NSMutableDictionary dictionaryWithObjectsAndKeys: 277 [self name], @"Name", 278 [NSNumber numberWithBool: [self isSeeding]], @"Seeding", 279 [NSNumber numberWithFloat: [self progress]], @"Progress", 280 [NSNumber numberWithBool: [self isActive]], @"Active", 281 [NSNumber numberWithBool: [self isError]], @"Error", nil]; 282 283 if (![fDefaults boolForKey: @"SmallView"]) 284 { 285 [info setObject: fIconFlipped forKey: @"Icon"]; 286 [info setObject: [self progressString] forKey: @"ProgressString"]; 287 [info setObject: [self statusString] forKey: @"StatusString"]; 288 } 289 else 290 { 291 [info setObject: fIconSmall forKey: @"Icon"]; 292 [info setObject: [self remainingTimeString] forKey: @"RemainingTimeString"]; 293 [info setObject: [self shortStatusString] forKey: @"ShortStatusString"]; 294 } 295 296 return info; 297 } 298 274 299 - (void) startTransfer 275 300 { -
trunk/macosx/TorrentCell.h
r835 r855 31 31 @interface TorrentCell : NSCell 32 32 { 33 Torrent * fTorrent;34 33 BOOL fStatusRegular; 35 34 … … 42 41 } 43 42 44 - (void) setTorrent: (Torrent *) torrent;45 46 43 - (void) toggleMinimalStatus; 47 44 -
trunk/macosx/TorrentCell.m
r844 r855 33 33 - (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point; 34 34 - (void) buildSimpleBar: (float) width point: (NSPoint) point; 35 - (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point;35 //- (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point; 36 36 37 37 @end … … 102 102 } 103 103 104 - (void) setTorrent: (Torrent *) torrent105 {106 fTorrent = torrent;107 }108 109 104 - (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point 110 105 { … … 117 112 - (void) buildSimpleBar: (float) width point: (NSPoint) point 118 113 { 114 NSDictionary * info = [self objectValue]; 115 119 116 width -= 2.0; 120 if ([ fTorrent isSeeding])117 if ([[info objectForKey: @"Seeding"] boolValue]) 121 118 { 122 119 [fProgressEndGreen compositeToPoint: point operation: NSCompositeSourceOver]; … … 130 127 else 131 128 { 132 float completedWidth = [ fTorrent progress] * width,129 float completedWidth = [[info objectForKey: @"Progress"] floatValue] * width, 133 130 remainingWidth = width - completedWidth; 134 BOOL isActive = [ fTorrent isActive];131 BOOL isActive = [[info objectForKey: @"Active"] boolValue]; 135 132 136 133 //left end … … 167 164 } 168 165 169 - (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point166 /*- (void) buildAdvancedBar: (float) widthFloat point: (NSPoint) point 170 167 { 171 168 //if seeding, there's no need for the advanced bar … … 271 268 point.x += widthFloat; 272 269 [fProgressEndAdvanced compositeToPoint: point operation: NSCompositeSourceOver]; 273 } 270 }*/ 274 271 275 272 - (void) toggleMinimalStatus … … 292 289 NSPoint pen = cellFrame.origin; 293 290 const float PADDING = 3.0, LINE_PADDING = 2.0, EXTRA_NAME_SHIFT = 1.0; 294 291 292 NSDictionary * info = [self objectValue]; 293 295 294 if (![fDefaults boolForKey: @"SmallView"]) //regular size 296 295 { 297 296 //icon 298 NSImage * icon = [ fTorrent iconFlipped];297 NSImage * icon = [info objectForKey: @"Icon"]; 299 298 NSSize iconSize = [icon size]; 300 299 … … 306 305 307 306 //error badge 308 if ([ fTorrent isError])307 if ([[info objectForKey: @"Error"] boolValue]) 309 308 { 310 309 NSSize errorIconSize = [fErrorImage size]; … … 320 319 pen.x += iconSize.width + PADDING + EXTRA_NAME_SHIFT; 321 320 pen.y = cellFrame.origin.y + PADDING; 322 NSAttributedString * nameString = [[ fTorrent name] attributedStringFittingInWidth: mainWidth321 NSAttributedString * nameString = [[info objectForKey: @"Name"] attributedStringFittingInWidth: mainWidth 323 322 attributes: nameAttributes]; 324 323 [nameString drawAtPoint: pen]; … … 327 326 pen.y += [nameString size].height + LINE_PADDING - 1.0; 328 327 329 NSAttributedString * progressString = [[ fTorrent progressString]328 NSAttributedString * progressString = [[info objectForKey: @"ProgressString"] 330 329 attributedStringFittingInWidth: mainWidth attributes: statusAttributes]; 331 330 [progressString drawAtPoint: pen]; … … 337 336 float barWidth = mainWidth + EXTRA_NAME_SHIFT - BUTTONS_TOTAL_WIDTH + PADDING; 338 337 339 if ([fDefaults boolForKey: @"UseAdvancedBar"])338 /*if ([fDefaults boolForKey: @"UseAdvancedBar"]) 340 339 [self buildAdvancedBar: barWidth point: pen]; 341 else 340 else*/ 342 341 [self buildSimpleBar: barWidth point: pen]; 343 342 … … 345 344 pen.x += EXTRA_NAME_SHIFT; 346 345 pen.y += LINE_PADDING; 347 NSAttributedString * statusString = [[ fTorrent statusString]346 NSAttributedString * statusString = [[info objectForKey: @"StatusString"] 348 347 attributedStringFittingInWidth: mainWidth attributes: statusAttributes]; 349 348 [statusString drawAtPoint: pen]; … … 352 351 { 353 352 //icon 354 NSImage * icon = ![ fTorrent isError] ? [fTorrent iconSmall] : fErrorImage;353 NSImage * icon = ![[info objectForKey: @"Error"] boolValue] ? [info objectForKey: @"Icon"] : fErrorImage; 355 354 NSSize iconSize = [icon size]; 356 355 … … 364 363 float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT; 365 364 366 NSString * realStatusString = !fStatusRegular && [fTorrent isActive] ? [fTorrent remainingTimeString] 367 : [fTorrent shortStatusString]; 365 NSString * realStatusString = !fStatusRegular && [[info objectForKey: @"Active"] boolValue] 366 ? [info objectForKey: @"RemainingTimeString"] 367 : [info objectForKey: @"ShortStatusString"]; 368 368 369 369 NSAttributedString * statusString = [[[NSAttributedString alloc] initWithString: realStatusString 370 370 attributes: statusAttributes] autorelease]; 371 NSAttributedString * nameString = [[ fTorrent name] attributedStringFittingInWidth:371 NSAttributedString * nameString = [[info objectForKey: @"Name"] attributedStringFittingInWidth: 372 372 mainWidth - [statusString size].width - LINE_PADDING attributes: nameAttributes]; 373 373 … … 390 390 float barWidth = mainWidth + EXTRA_NAME_SHIFT - BUTTONS_TOTAL_WIDTH + PADDING; 391 391 392 if ([fDefaults boolForKey: @"UseAdvancedBar"])392 /*if ([fDefaults boolForKey: @"UseAdvancedBar"]) 393 393 [self buildAdvancedBar: barWidth point: pen]; 394 else 394 else*/ 395 395 [self buildSimpleBar: barWidth point: pen]; 396 396 }
Note: See TracChangeset
for help on using the changeset viewer.