Changeset 354


Ignore:
Timestamp:
Jun 14, 2006, 3:00:27 AM (16 years ago)
Author:
livings124
Message:

Differentiate between valid amount downloaded and total amount downloaded, showing the valid amount in the main window.

Location:
trunk/macosx
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/InfoWindow.nib/classes.nib

    r334 r354  
    1313                fDateStartedField = NSTextField;
    1414                fDownloadRateField = NSTextField;
    15                 fDownloadedField = NSTextField;
     15                fDownloadedTotalField = NSTextField;
     16                fDownloadedValidField = NSTextField;
    1617                fDownloadingFromField = NSTextField;
    1718                fFileTable = NSTableView;
     
    3334                fTrackerField = NSTextField;
    3435                fUploadRateField = NSTextField;
    35                 fUploadedField = NSTextField;
     36                fUploadedTotalField = NSTextField;
    3637                fUploadingToField = NSTextField;
    3738            };
  • trunk/macosx/InfoWindowController.h

    r272 r354  
    4141                        * fStateField, * fPercentField,
    4242                        * fDownloadRateField, * fUploadRateField,
    43                         * fDownloadedField, * fUploadedField, * fRatioField,
    44                         * fSeedersField, * fLeechersField,
     43                        * fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField,
     44                        * fRatioField, * fSeedersField, * fLeechersField,
    4545                        * fConnectedPeersField, * fDownloadingFromField, * fUploadingToField;
    4646
  • trunk/macosx/InfoWindowController.m

    r322 r354  
    3535#define TAB_FILES_IDENT @"Files"
    3636
    37 #define TAB_INFO_HEIGHT 191.0
    38 #define TAB_STATUS_HEIGHT 241.0
     37//15 spacing at the bottom of each tab
     38#define TAB_INFO_HEIGHT 196.0
     39#define TAB_STATUS_HEIGHT 262.0
    3940#define TAB_OPTIONS_HEIGHT 82.0
    4041#define TAB_FILES_HEIGHT 250.0
     
    106107            [fUploadRateField setStringValue: @""];
    107108           
    108             [fDownloadedField setStringValue: @""];
    109             [fUploadedField setStringValue: @""];
     109            [fDownloadedValidField setStringValue: @""];
     110            [fDownloadedTotalField setStringValue: @""];
     111            [fUploadedTotalField setStringValue: @""];
    110112        }
    111113       
     
    237239    if (numberSelected > 0)
    238240    {
    239         float downloadRate = 0, uploadRate = 0;
    240         uint64_t downloaded = 0, uploaded = 0;
     241        float downloadRate = 0, uploadRate = 0, downloadedValid;
     242        uint64_t downloadedTotal = 0, uploadedTotal = 0;
    241243        Torrent * torrent;
    242244        NSEnumerator * enumerator = [fTorrents objectEnumerator];
     
    246248            uploadRate += [torrent uploadRate];
    247249           
    248             downloaded += [torrent downloaded];
    249             uploaded += [torrent uploaded];
     250            downloadedValid += [torrent downloadedValid];
     251            downloadedTotal += [torrent downloadedTotal];
     252            uploadedTotal += [torrent uploadedTotal];
    250253        }
    251254       
     
    253256        [fUploadRateField setStringValue: [NSString stringForSpeed: uploadRate]];
    254257       
    255         [fDownloadedField setStringValue: [NSString stringForFileSize: downloaded]];
    256         [fUploadedField setStringValue: [NSString stringForFileSize: uploaded]];
     258        [fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
     259        [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
     260        [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
    257261   
    258262        if (numberSelected == 1)
     
    280284           
    281285            [fRatioField setStringValue: [NSString stringForRatioWithDownload:
    282                                                         downloaded upload: uploaded]];
     286                                        downloadedTotal upload: uploadedTotal]];
    283287        }
    284288    }
  • trunk/macosx/Torrent.h

    r344 r354  
    108108- (float)       downloadRate;
    109109- (float)       uploadRate;
    110 - (uint64_t)    downloaded;
    111 - (uint64_t)    uploaded;
     110- (float)       downloadedValid;
     111- (uint64_t)    downloadedTotal;
     112- (uint64_t)    uploadedTotal;
    112113
    113114- (NSArray *) fileList;
  • trunk/macosx/Torrent.m

    r344 r354  
    3636            stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
    3737
    38 - (void) trashPath: (NSString *) path;
     38- (void) trashFile: (NSString *) path;
    3939
    4040@end
     
    4848                    stopRatioSetting: nil ratioLimit: nil];
    4949                   
    50     if (!torrent)
    51         return nil;
    52 
    53     if (fPrivateTorrent && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
    54         [self trashPath: path];
     50    if (torrent && fPrivateTorrent && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
     51        [self trashFile: path];
    5552   
    5653    return torrent;
     
    6057{
    6158    //load from saved torrent file if set to, otherwise try to load from where torrent file should be
     59    id torrent;
    6260    NSNumber * privateCopy;
    6361    if ((privateCopy = [history objectForKey: @"PrivateCopy"]) && [privateCopy boolValue])
    64         self = [self initWithHash: [history objectForKey: @"TorrentHash"]
     62        torrent = [self initWithHash: [history objectForKey: @"TorrentHash"]
    6563            lib: lib date: [history objectForKey: @"Date"]
    6664            stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
    6765            ratioLimit: [history objectForKey: @"RatioLimit"]];
    6866    else
    69         self = [self initWithPath: [history objectForKey: @"TorrentPath"]
     67        torrent = [self initWithPath: [history objectForKey: @"TorrentPath"]
    7068            lib: lib date: [history objectForKey: @"Date"]
    7169            stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
    7270            ratioLimit: [history objectForKey: @"RatioLimit"]];
    7371           
    74     if (self)
     72    if (torrent)
    7573    {
    7674        NSString * downloadFolder;
     
    8482            [self start];
    8583    }
    86     return self;
     84    return torrent;
    8785}
    8886
     
    157155    if ([self progress] < 1.0)
    158156        [fProgressString appendFormat: @"%@ of %@ (%.2f%%)", [NSString stringForFileSize:
    159                 [self downloaded]], [NSString stringForFileSize: [self size]], 100 * [self progress]];
     157                [self downloadedValid]], [NSString stringForFileSize: [self size]], 100 * [self progress]];
    160158    else
    161159        [fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize:
    162                 [self size]], [NSString stringForFileSize: [self uploaded]],
    163                 [NSString stringForRatioWithDownload: [self downloaded] upload: [self uploaded]]];
     160                [self size]], [NSString stringForFileSize: [self uploadedTotal]],
     161                [NSString stringForRatioWithDownload: [self downloadedTotal] upload: [self uploadedTotal]]];
    164162
    165163    switch( fStat->status )
     
    266264- (float) ratio
    267265{
    268     float downloaded = [self downloaded];
    269     return downloaded > 0 ? (float)[self uploaded] / downloaded : -1;
     266    float downloaded = [self downloadedTotal];
     267    return downloaded > 0 ? (float)[self uploadedTotal] / downloaded : -1;
    270268}
    271269
     
    299297- (void) trashData
    300298{
    301     [self trashPath: [self dataLocation]];
     299    [self trashFile: [self dataLocation]];
    302300}
    303301
     
    459457}
    460458
    461 - (uint64_t) downloaded
     459- (float) downloadedValid
     460{
     461    return [self progress] * [self size];
     462}
     463
     464- (uint64_t) downloadedTotal
    462465{
    463466    return fStat->downloaded;
    464467}
    465468
    466 - (uint64_t) uploaded
     469- (uint64_t) uploadedTotal
    467470{
    468471    return fStat->uploaded;
     
    574577
    575578
    576 - (void) trashPath: (NSString *) path
     579- (void) trashFile: (NSString *) path
    577580{
    578581    if( ![[NSWorkspace sharedWorkspace] performFileOperation:
  • trunk/macosx/TorrentCell.m

    r353 r354  
    137137        float completedWidth = [fTorrent progress] * width,
    138138                remainingWidth = width - completedWidth;
    139        
    140         NSImage * barLeftEnd, * barRightEnd;
    141139        BOOL isActive = [fTorrent isActive];
    142140       
    143141        //left end
     142        NSImage * barLeftEnd;
    144143        if (remainingWidth == width)
    145144            barLeftEnd = fProgressEndWhite;
     
    160159       
    161160        //right end
     161        NSImage * barRightEnd;
    162162        if (completedWidth < width)
    163163            barRightEnd = fProgressEndWhite;
Note: See TracChangeset for help on using the changeset viewer.