Changeset 2080


Ignore:
Timestamp:
Jun 14, 2007, 9:50:38 PM (15 years ago)
Author:
livings124
Message:

merge in some changes to the mac gui...probably doesn't build

Location:
branches/file_selection/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/macosx/Controller.m

    r2018 r2080  
    28512851    Torrent * torrent;
    28522852    while ((torrent = [enumerator nextObject]))
    2853         if ([torrent isActive])
    2854         {
    2855             if ([torrent allDownloaded])
    2856                 seeding++;
    2857             else
    2858                 downloading++;
    2859         }
     2853    {
     2854        if ([torrent isSeeding])
     2855            seeding++;
     2856        else if ([torrent isActive])
     2857            downloading++;
     2858    }
    28602859   
    28612860    NSMenuItem * seedingItem = [fDockMenu itemWithTag: DOCK_SEEDING_TAG],
  • branches/file_selection/macosx/Torrent.h

    r2041 r2080  
    9898- (void)        resetCache;
    9999
    100 - (BOOL)        allDownloaded;
    101 
    102100- (float)       ratio;
    103101- (int)         ratioSetting;
     
    167165- (BOOL) isWaitingToChecking;
    168166- (BOOL) isChecking;
     167- (BOOL) allDownloaded;
    169168- (BOOL) isError;
    170169- (NSString *) errorMessage;
  • branches/file_selection/macosx/Torrent.m

    r2078 r2080  
    367367                            [NSString stringForFileSize: [self downloadedValid]],
    368368                            [NSString stringForFileSize: [self size]], 100.0 * [self progress]];
     369    else if ([self progress] < 1.0)
     370        [progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)",
     371                "Torrent -> progress string"),
     372                [NSString stringForFileSize: [self downloadedValid]], [NSString stringForFileSize: [self size]],
     373                100.0 * [self progress], [NSString stringForFileSize: [self uploadedTotal]],
     374                [NSString stringForRatio: [self ratio]]];
    369375    else
    370376        [progressString appendFormat: NSLocalizedString(@"%@, uploaded %@ (Ratio: %@)", "Torrent -> progress string"),
    371                 [NSString stringForFileSize: [self downloadedValid]],
    372                             [NSString stringForFileSize: [self uploadedTotal]],
     377                [NSString stringForFileSize: [self size]], [NSString stringForFileSize: [self uploadedTotal]],
    373378                [NSString stringForRatio: [self ratio]]];
    374379
     
    462467
    463468        case TR_STATUS_SEED:
     469        case TR_STATUS_DONE:
    464470            [statusString setString: @""];
    465471            if ([self totalPeers] != 1)
     
    468474            else
    469475                [statusString appendFormat: NSLocalizedString(@"Seeding to %d of 1 peer", "Torrent -> status string"),
    470                                                 [self peersDownloading]];
    471            
    472             break;
    473 
    474         case TR_STATUS_DONE:
    475             [statusString setString: @""];
    476             if ([self totalPeers] != 1)
    477                 [statusString appendFormat:@"Uploading to %d of %d peers",
    478                                                 [self peersDownloading], [self totalPeers]];
    479             else
    480                 [statusString appendFormat: @"Uploading to %d of 1 peer",
    481476                                                [self peersDownloading]];
    482477           
     
    643638{
    644639    tr_torrentRemoveFastResume(fHandle);
    645 }
    646 
    647 - (BOOL) allDownloaded
    648 {
    649     return [self progress] >= 1.0;
    650640}
    651641
     
    10761066
    10771067        case TR_STATUS_SEED:
     1068        case TR_STATUS_DONE:
    10781069            return NSLocalizedString(@"Seeding", "Torrent -> status string");
    10791070            break;
     
    10831074            break;
    10841075       
    1085         case TR_STATUS_DONE:
    1086             return @"Uploading";
    1087             break;
    1088        
    10891076        default:
    10901077            return NSLocalizedString(@"N/A", "Torrent -> status string");
     
    10941081- (float) progress
    10951082{
    1096     return fStat->percentDone;
     1083    return fStat->percentComplete;
    10971084}
    10981085
     
    11091096- (BOOL) isSeeding
    11101097{
    1111     return (fStat->status == TR_STATUS_SEED || fStat->status == TR_STATUS_DONE);
    1112 }
    1113 
    1114 - (BOOL) isDone
    1115 {
    1116     return fStat->status == TR_STATUS_DONE;
     1098    return fStat->status == TR_STATUS_SEED || fStat->status == TR_STATUS_DONE;
    11171099}
    11181100
     
    11301112{
    11311113    return fStat->status == TR_STATUS_CHECK;
     1114}
     1115
     1116- (BOOL) allDownloaded
     1117{
     1118    return fStat->cpStatus != TR_CP_INCOMPLETE;
    11321119}
    11331120
  • branches/file_selection/macosx/TorrentCell.m

    r1972 r2080  
    8282    completeBounds = barBounds;
    8383   
     84    float progress = [[info objectForKey: @"Progress"] floatValue];
     85    completeBounds.size.width = progress * width;
     86   
    8487    if ([[info objectForKey: @"Seeding"] boolValue])
    8588    {
    86         completeBounds.size.width = width * [[info objectForKey: @"ProgressStopRatio"] floatValue];
     89        NSRect ratioBounds = completeBounds;
     90        ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue];
    8791       
    8892        if (completeBounds.size.width < barBounds.size.width)
    89             [fLightGreenGradient fillRect: barBounds angle: -90];
    90         [fGreenGradient fillRect: completeBounds angle: -90];
     93            [fWhiteGradient fillRect: barBounds angle: -90];
     94        if (ratioBounds.size.width < completeBounds.size.width)
     95            [fLightGreenGradient fillRect: completeBounds angle: -90];
     96        [fGreenGradient fillRect: ratioBounds angle: -90];
    9197    }
    9298    else
    9399    {
    94         completeBounds.size.width = [[info objectForKey: @"Progress"] floatValue] * width;
    95100        if (completeBounds.size.width < barBounds.size.width)
    96101            [fWhiteGradient fillRect: barBounds angle: -90];
Note: See TracChangeset for help on using the changeset viewer.