Changeset 5149


Ignore:
Timestamp:
Feb 27, 2008, 7:34:55 PM (14 years ago)
Author:
livings124
Message:

show amount selected in open window

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/AddWindowController.h

    r4583 r5149  
    6161- (void) verifyLocalData: (id) sender;
    6262
     63- (void) updateStatusField: (NSNotification *) notification;
     64
    6365- (void) updateGroupMenu: (NSNotification *) notification;
    6466- (void) showGroupsWindow: (id) sender;
  • trunk/macosx/AddWindowController.m

    r5030 r5149  
    7070- (void) awakeFromNib
    7171{
     72    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateStatusField:)
     73        name: @"TorrentFileCheckChange" object: fTorrent];
     74   
    7275    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateGroupMenu:)
    7376        name: @"UpdateGroups" object: nil];
     
    8487    [icon release];
    8588   
    86     NSString * statusString = [NSString stringForFileSize: [fTorrent size]];
    87     if ([fTorrent folder])
    88     {
    89         NSString * fileString;
    90         int count = [fTorrent fileCount];
    91         if (count != 1)
    92             fileString = [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Add torrent -> info"), count];
    93         else
    94             fileString = NSLocalizedString(@"1 File, ", "Add torrent -> info");
    95         statusString = [fileString stringByAppendingString: statusString];
    96     }
    97     [fStatusField setStringValue: statusString];
     89    [self updateStatusField: nil];
    9890   
    9991    [self setGroupsMenu];
     
    213205}
    214206
     207- (void) updateStatusField: (NSNotification *) notification
     208{
     209    NSString * statusString = [NSString stringForFileSize: [fTorrent size]];
     210    if ([fTorrent folder])
     211        statusString = [statusString stringByAppendingFormat: NSLocalizedString(@" (%@ selected)", "Add torrent -> info"),
     212                        [NSString stringForFileSize: [fTorrent totalSizeSelected]]];
     213   
     214    if ([fTorrent folder])
     215    {
     216        NSString * fileString;
     217        int count = [fTorrent fileCount];
     218        if (count != 1)
     219            fileString = [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Add torrent -> info"), count];
     220        else
     221            fileString = NSLocalizedString(@"1 File, ", "Add torrent -> info");
     222        statusString = [fileString stringByAppendingString: statusString];
     223    }
     224   
     225    [fStatusField setStringValue: statusString];
     226}
     227
    215228- (void) updateGroupMenu: (NSNotification *) notification
    216229{
  • trunk/macosx/Torrent.h

    r5139 r5149  
    217217- (uint64_t) haveVerified;
    218218- (uint64_t) haveTotal;
     219- (uint64_t) totalSizeSelected;
    219220- (uint64_t) downloadedTotal;
    220221- (uint64_t) uploadedTotal;
  • trunk/macosx/Torrent.m

    r5143 r5149  
    810810{
    811811    return fStat->percentComplete;
    812     //return (float)[self haveTotal] / [self size];
    813812}
    814813
     
    940939        if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
    941940        {
    942             uint64_t have = [self haveTotal];
    943941            string = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
    944                             [NSString stringForFileSize: have], [NSString stringForFileSize: have + [self sizeLeft]],
     942                            [NSString stringForFileSize: [self haveTotal]], [NSString stringForFileSize: [self totalSizeSelected]],
    945943                            100.0 * [self progressDone]];
    946944        }
     
    12211219}
    12221220
     1221- (uint64_t) totalSizeSelected
     1222{
     1223    return [self haveTotal] + [self sizeLeft];
     1224}
     1225
    12231226- (uint64_t) downloadedTotal
    12241227{
     
    13531356   
    13541357    [self update];
     1358    [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFileCheckChange" object: self];
    13551359}
    13561360
Note: See TracChangeset for help on using the changeset viewer.