Changeset 6141
- Timestamp:
- Jun 11, 2008, 4:28:33 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS
r6136 r6141 14 14 + Option to only show the add window when manually adding transfers 15 15 + Status strings are toggled from the action button (they are no longer clickable) 16 + Colors in pieces bar and pieces viewmore accurately reflect their corresponding values16 + Colors in pieces bar and pieces box more accurately reflect their corresponding values 17 17 - GTK+ 18 18 + Add preferences options to inhibit hibernation and to toggle the tray icon -
trunk/macosx/Controller.m
r6137 r6141 2004 2004 enumerator = [previousTorrents objectEnumerator]; 2005 2005 while ((torrent = [enumerator nextObject])) 2006 [torrent setPrevious AmountFinished: NULL];2006 [torrent setPreviousFinishedPieces: nil]; 2007 2007 2008 2008 //place torrents into groups -
trunk/macosx/Torrent.h
r6088 r6141 58 58 NSArray * fFileList; 59 59 60 float * fPreviousFinishedPieces;61 NSDate * f FinishedPiecesDate;60 NSIndexSet * fPreviousFinishedIndexes; 61 NSDate * fPreviousFinishedIndexesDate; 62 62 63 63 float fRatioLimit; … … 88 88 - (void) getAvailability: (int8_t *) tab size: (int) size; 89 89 - (void) getAmountFinished: (float *) tab size: (int) size; 90 - ( float *) getPreviousAmountFinished;91 -(void) setPrevious AmountFinished: (float *) tab;90 - (NSIndexSet *) previousFinishedPieces; 91 -(void) setPreviousFinishedPieces: (NSIndexSet *) indexes; 92 92 93 93 - (void) update; -
trunk/macosx/Torrent.m
r6125 r6141 169 169 tr_torrentFilesFree(fFileStat, [self fileCount]); 170 170 171 tr_free(fPreviousFinishedPieces);172 [f FinishedPiecesDate release];171 [fPreviousFinishedIndexes release]; 172 [fPreviousFinishedIndexesDate release]; 173 173 174 174 [fNameString release]; … … 240 240 } 241 241 242 - ( float *) getPreviousAmountFinished243 { 244 //if the torrent hasn't been seen in a bit, and therefore hasn't been refreshed, return NULL245 if (f FinishedPiecesDate && [fFinishedPiecesDate timeIntervalSinceNow] > -2.0)246 return fPreviousFinished Pieces;242 - (NSIndexSet *) previousFinishedPieces 243 { 244 //if the torrent hasn't been seen in a bit, and therefore hasn't been refreshed, return nil 245 if (fPreviousFinishedIndexesDate && [fPreviousFinishedIndexesDate timeIntervalSinceNow] > -2.0) 246 return fPreviousFinishedIndexes; 247 247 else 248 return NULL;249 } 250 251 -(void) setPrevious AmountFinished: (float *) tab252 { 253 tr_free(fPreviousFinishedPieces);254 fPreviousFinished Pieces = tab;255 256 [f FinishedPiecesDate release];257 f FinishedPiecesDate = tab != NULL? [[NSDate alloc] init] : nil;248 return nil; 249 } 250 251 -(void) setPreviousFinishedPieces: (NSIndexSet *) indexes 252 { 253 [fPreviousFinishedIndexes release]; 254 fPreviousFinishedIndexes = [indexes retain]; 255 256 [fPreviousFinishedIndexesDate release]; 257 fPreviousFinishedIndexesDate = indexes != nil ? [[NSDate alloc] init] : nil; 258 258 } 259 259 -
trunk/macosx/TorrentCell.m
r6127 r6141 590 590 else 591 591 { 592 [[self representedObject] setPrevious AmountFinished: NULL];592 [[self representedObject] setPreviousFinishedPieces: nil]; 593 593 594 594 [self drawRegularBar: barRect]; … … 736 736 737 737 int pieceCount = MIN([torrent pieceCount], MAX_PIECES); 738 float * piecesPercent = malloc(pieceCount * sizeof(float)), 739 * previousPiecePercent = [torrent getPreviousAmountFinished]; 738 float * piecesPercent = malloc(pieceCount * sizeof(float)); 740 739 [torrent getAmountFinished: piecesPercent size: pieceCount]; 741 740 … … 744 743 isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0]; 745 744 745 NSIndexSet * previousFinishedIndexes = [torrent previousFinishedPieces]; 746 NSMutableIndexSet * finishedIndexes = [NSMutableIndexSet indexSet]; 747 746 748 int i; 747 749 for (i = 0; i < pieceCount; i++) 748 750 { 749 751 NSColor * pieceColor; 750 if (piecesPercent[i] == 1.0 && previousPiecePercent != NULL && previousPiecePercent[i] < 1.0) 751 pieceColor = [NSColor orangeColor]; 752 if (piecesPercent[i] == 1.0) 753 { 754 if (previousFinishedIndexes && ![previousFinishedIndexes containsIndex: i]) 755 pieceColor = [NSColor orangeColor]; 756 else 757 pieceColor = fBluePieceColor; 758 [finishedIndexes addIndex: i]; 759 } 752 760 else 753 761 pieceColor = [[NSColor whiteColor] blendedColorWithFraction: piecesPercent[i] ofColor: fBluePieceColor]; … … 757 765 } 758 766 759 [torrent setPreviousAmountFinished: piecesPercent]; //holds onto piecePercent, so no need to release it here 767 free(piecesPercent); 768 769 [torrent setPreviousFinishedPieces: [finishedIndexes count] > 0 ? finishedIndexes : nil]; //don't bother saving if none are complete 760 770 761 771 //actually draw image 762 772 [bitmap drawInRect: barRect]; 763 764 773 [bitmap release]; 765 774 }
Note: See TracChangeset
for help on using the changeset viewer.