Changeset 4372


Ignore:
Timestamp:
Dec 28, 2007, 9:37:06 PM (14 years ago)
Author:
livings124
Message:

flash orange in pieces in the advanced progress bar that just completed

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.h

    r4307 r4372  
    6262    NSMenu * fFileMenu;
    6363   
     64    float * fPreviousFinishedPieces;
     65    NSDate * fFinishedPiecesDate;
     66   
    6467    float fRatioLimit;
    6568    int fRatioSetting;
     
    8790- (void) getAvailability: (int8_t *) tab size: (int) size;
    8891- (void) getAmountFinished: (float *) tab size: (int) size;
     92- (float *) getPreviousAmountFinished;
     93-(void) setPreviousAmountFinished: (float *) tab;
    8994
    9095- (void) update;
  • trunk/macosx/Torrent.m

    r4357 r4372  
    155155        tr_torrentFilesFree(fileStat, [self fileCount]);
    156156   
     157    if (fPreviousFinishedPieces != NULL)
     158        free(fPreviousFinishedPieces);
     159   
    157160    [fDownloadFolder release];
    158161    [fIncompleteFolder release];
     
    211214{
    212215    tr_torrentAmountFinished(fHandle, tab, size);
     216}
     217
     218- (float *) getPreviousAmountFinished
     219{
     220    if (fFinishedPiecesDate && [fFinishedPiecesDate timeIntervalSinceNow] < -1.0)
     221        return fPreviousFinishedPieces;
     222    else
     223        return NULL;
     224}
     225
     226-(void) setPreviousAmountFinished: (float *) tab
     227{
     228    if (fPreviousFinishedPieces != NULL)
     229        free(fPreviousFinishedPieces);
     230    fPreviousFinishedPieces = tab;
     231   
     232    [fFinishedPiecesDate release];
     233    fFinishedPiecesDate = fPreviousFinishedPieces != NULL ? [[NSDate alloc] init] : nil;
    213234}
    214235
  • trunk/macosx/TorrentCell.h

    r4370 r4372  
    3737                * fTransparentGradient;
    3838   
    39     NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color;
     39    NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color, * fOrangeColor;
    4040   
    4141    NSBitmapImageRep * fBitmap;
  • trunk/macosx/TorrentCell.m

    r4371 r4372  
    101101        fBlue4Color = [[NSColor colorWithCalibratedRed: 0.4 green: 0.6 blue: 1.0 alpha: 1.0] retain];
    102102        fBlueColor = [[NSColor colorWithCalibratedRed: 0.0 green: 0.4 blue: 0.8 alpha: 1.0] retain];
     103        fOrangeColor = [[NSColor orangeColor] retain];
    103104       
    104105        fBarOverlayColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];
     
    308309        [fBitmap release];
    309310        fBitmap = nil;
     311        [[self representedObject] setPreviousAmountFinished: NULL];
    310312       
    311313        [self drawRegularBar: barRect];
     
    454456            isPlanar: NO colorSpaceName: NSCalibratedRGBColorSpace bytesPerRow: 0 bitsPerPixel: 0];
    455457   
    456     #warning add flashing orange
    457    
    458458    Torrent * torrent = [self representedObject];
    459459   
    460460    int pieceCount = MIN([torrent pieceCount], MAX_PIECES);
    461     float * piecePercent = malloc(pieceCount * sizeof(float));
     461    float * piecePercent = malloc(pieceCount * sizeof(float)),
     462        * previousPiecePercent = [torrent getPreviousAmountFinished];
    462463    [torrent getAmountFinished: piecePercent size: pieceCount];
    463464   
     
    469470        index = i * increment;
    470471        if (piecePercent[index] >= 1.0)
    471             pieceColor = fBlueColor;
     472        {
     473            if (previousPiecePercent != NULL && previousPiecePercent[index] < 1.0)
     474                pieceColor = fOrangeColor;
     475            else
     476                pieceColor = fBlueColor;
     477        }
    472478        else if (piecePercent[index] <= 0.0)
    473479            pieceColor = fGrayColor;
     
    486492    }
    487493   
    488     free(piecePercent);
     494    [torrent setPreviousAmountFinished: piecePercent];
    489495   
    490496    //actually draw image
Note: See TracChangeset for help on using the changeset viewer.