Changeset 7250


Ignore:
Timestamp:
Dec 3, 2008, 2:55:38 AM (12 years ago)
Author:
livings124
Message:

#1536 Speed Limit Rollover information

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r7185 r7250  
    187187- (void) setBottomCountText: (BOOL) filtering;
    188188
     189- (void) updateSpeedFieldsToolTips;
     190
    189191- (void) updateTorrentsInQueue;
    190192- (NSInteger) numToStartFromQueue: (BOOL) downloadQueue;
  • trunk/macosx/Controller.m

    r7188 r7250  
    349349    [fStatusBar setHidden: YES];
    350350   
    351     [fTotalDLField setToolTip: NSLocalizedString(@"Total download speed", "Status Bar -> speed tooltip")];
    352     [fTotalULField setToolTip: NSLocalizedString(@"Total upload speed", "Status Bar -> speed tooltip")];
     351    [self updateSpeedFieldsToolTips];
    353352   
    354353    NSRect statusBarFrame = [fStatusBar frame];
     
    490489    [nc addObserver: self selector: @selector(updateGroupsFilters:)
    491490                    name: @"UpdateGroups" object: nil];
     491   
     492    //update when speed limits are changed
     493    [nc addObserver: self selector: @selector(updateSpeedFieldsToolTips)
     494                    name: @"SpeedLimitUpdate" object: nil];
    492495
    493496    //timer to update the interface every second
     
    15941597}
    15951598
     1599- (void) updateSpeedFieldsToolTips
     1600{
     1601    NSString * uploadText, * downloadText;
     1602   
     1603    if ([fDefaults boolForKey: @"SpeedLimit"])
     1604    {
     1605        NSString * speedString = [NSString stringWithFormat: @"%@ (%@)", NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
     1606                                    NSLocalizedString(@"Speed Limit", "Status Bar -> speed tooltip")];
     1607       
     1608        uploadText = [NSString stringWithFormat: speedString, [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
     1609        downloadText = [NSString stringWithFormat: speedString, [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]];
     1610    }
     1611    else
     1612    {
     1613        if ([fDefaults boolForKey: @"CheckUpload"])
     1614            uploadText = [NSString stringWithFormat: NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
     1615                            [fDefaults integerForKey: @"UploadLimit"]];
     1616        else
     1617            uploadText = NSLocalizedString(@"unlimited", "Status Bar -> speed tooltip");
     1618       
     1619        if ([fDefaults boolForKey: @"CheckDownload"])
     1620            downloadText = [NSString stringWithFormat: NSLocalizedString(@"%d KB/s", "Status Bar -> speed tooltip"),
     1621                            [fDefaults integerForKey: @"DownloadLimit"]];
     1622        else
     1623            downloadText = NSLocalizedString(@"unlimited", "Status Bar -> speed tooltip");
     1624    }
     1625   
     1626    uploadText = [NSLocalizedString(@"Total upload rate", "Status Bar -> speed tooltip")
     1627                    stringByAppendingFormat: @": %@", uploadText];
     1628    downloadText = [NSLocalizedString(@"Total download rate", "Status Bar -> speed tooltip")
     1629                    stringByAppendingFormat: @": %@", downloadText];
     1630   
     1631    [fTotalULField setToolTip: uploadText];
     1632    [fTotalDLField setToolTip: downloadText];
     1633}
     1634
    15961635- (void) updateTorrentsInQueue
    15971636{
  • trunk/macosx/PrefsController.m

    r7194 r7250  
    537537        tr_sessionSetSpeedLimit(fHandle, TR_DOWN, [fDefaults integerForKey: @"DownloadLimit"]);
    538538    }
     539   
     540    [[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
    539541}
    540542
     
    10451047    [fDefaults setInteger: upLimit forKey: @"UploadLimit"];
    10461048   
     1049    [[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
     1050   
    10471051    //update gui if loaded
    10481052    if (fHasLoaded)
Note: See TracChangeset for help on using the changeset viewer.