Changeset 11875


Ignore:
Timestamp:
Feb 12, 2011, 3:28:36 AM (11 years ago)
Author:
livings124
Message:

inspector: update the displayed global seeding settings only when necessary; update only the displayed global seeding settings instead of all the options

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoOptionsViewController.m

    r11874 r11875  
    4040
    4141- (void) setupInfo;
     42- (void) setGlobalLabels;
    4243
    4344@end
     
    5556}
    5657
     58- (void) awakeFromNib
     59{
     60    [self setGlobalLabels];
     61   
     62    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(setGlobalLabels) name: @"UpdateGlobalOptions"
     63        object: nil];
     64}
     65
    5766- (void) dealloc
    5867{
     68    [[NSNotificationCenter defaultCenter] removeObserver: self];
     69   
    5970    [fTorrents release];
    6071   
     
    185196   
    186197    [fRatioLimitGlobalLabel setHidden: checkRatio != TR_RATIOLIMIT_GLOBAL];
    187     if (checkRatio == TR_RATIOLIMIT_GLOBAL)
    188     {
    189         NSString * global = [[NSUserDefaults standardUserDefaults] boolForKey: @"RatioCheck"]
    190             ? [NSString stringForRatio: [[NSUserDefaults standardUserDefaults] floatForKey: @"RatioLimit"]]
    191             : NSLocalizedString(@"disabled", "Info options -> global setting");
    192         [fRatioLimitGlobalLabel setStringValue: global];
    193     }
    194198   
    195199    //set idle view
     
    213217   
    214218    [fIdleLimitGlobalLabel setHidden: checkIdle != TR_IDLELIMIT_GLOBAL];
    215     if (checkIdle == TR_IDLELIMIT_GLOBAL)
    216     {
    217         NSString * global;
    218         if ([[NSUserDefaults standardUserDefaults] boolForKey: @"IdleLimitCheck"])
    219         {
    220             const NSInteger globalMin = [[NSUserDefaults standardUserDefaults] integerForKey: @"IdleLimitMinutes"];
    221             global = globalMin == 1 ? NSLocalizedString(@"1 minute", "Info options -> global setting")
    222                 : [NSString stringWithFormat: NSLocalizedString(@"%d minutes", "Info options -> global setting"), globalMin];
    223         }
    224         else
    225             global = NSLocalizedString(@"disabled", "Info options -> global setting");
    226         [fIdleLimitGlobalLabel setStringValue: global];
    227     }
    228219   
    229220    //get priority info
     
    348339    }
    349340   
    350     [self updateOptions]; //heavy-handed reload of global settings
     341    [fRatioLimitGlobalLabel setHidden: setting != TR_RATIOLIMIT_GLOBAL];
    351342}
    352343
     
    391382    }
    392383   
    393     [self updateOptions]; //heavy-handed reload of global settings
     384    [fIdleLimitGlobalLabel setHidden: setting != TR_IDLELIMIT_GLOBAL];
    394385}
    395386
     
    502493}
    503494
     495- (void) setGlobalLabels
     496{
     497    NSString * global = [[NSUserDefaults standardUserDefaults] boolForKey: @"RatioCheck"]
     498        ? [NSString stringForRatio: [[NSUserDefaults standardUserDefaults] floatForKey: @"RatioLimit"]]
     499        : NSLocalizedString(@"disabled", "Info options -> global setting");
     500    [fRatioLimitGlobalLabel setStringValue: global];
     501   
     502    //idle field
     503    NSString * globalIdle;
     504    if ([[NSUserDefaults standardUserDefaults] boolForKey: @"IdleLimitCheck"])
     505    {
     506        const NSInteger globalMin = [[NSUserDefaults standardUserDefaults] integerForKey: @"IdleLimitMinutes"];
     507        globalIdle = globalMin == 1 ? NSLocalizedString(@"1 minute", "Info options -> global setting")
     508            : [NSString stringWithFormat: NSLocalizedString(@"%d minutes", "Info options -> global setting"), globalMin];
     509    }
     510    else
     511        globalIdle = NSLocalizedString(@"disabled", "Info options -> global setting");
     512    [fIdleLimitGlobalLabel setStringValue: globalIdle];
     513}
     514
    504515@end
  • trunk/macosx/PrefsController.m

    r11874 r11875  
    600600   
    601601    //reload global settings in inspector
    602     [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptions" object: nil];
     602    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGlobalOptions" object: nil];
    603603}
    604604
     
    624624   
    625625    //reload global settings in inspector
    626     [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptions" object: nil];
     626    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGlobalOptions" object: nil];
    627627}
    628628
     
    12471247   
    12481248    //reload global settings in inspector
    1249     [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptions" object: nil];
     1249    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGlobalOptions" object: nil];
    12501250}
    12511251
Note: See TracChangeset for help on using the changeset viewer.