mirror of
https://github.com/transmission/transmission
synced 2024-12-26 17:47:37 +00:00
get rid of a variable
This commit is contained in:
parent
614b904d31
commit
e6e00af061
2 changed files with 13 additions and 12 deletions
|
@ -60,7 +60,6 @@
|
|||
IBOutlet NSMenuItem * fAdvancedBarItem, * fSmallViewItem,
|
||||
* fSpeedLimitItem, * fSpeedLimitDockItem;
|
||||
IBOutlet NSButton * fActionButton, * fSpeedLimitButton;
|
||||
BOOL fSpeedLimitEnabled;
|
||||
NSImage * fSpeedLimitNormalImage, * fSpeedLimitBlueImage, * fSpeedLimitGraphiteImage;
|
||||
NSTimer * fSpeedLimitTimer;
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
[self updateControlTint: nil];
|
||||
|
||||
if ((fSpeedLimitEnabled = [fDefaults boolForKey: @"SpeedLimit"]))
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
{
|
||||
#warning get rid of
|
||||
[fSpeedLimitItem setState: NSOnState];
|
||||
|
@ -947,7 +947,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
- (void) updateControlTint: (NSNotification *) notification
|
||||
{
|
||||
if (fSpeedLimitEnabled)
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
[fSpeedLimitButton setImage: [NSColor currentControlTint] == NSBlueControlTint
|
||||
? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage];
|
||||
}
|
||||
|
@ -1301,16 +1301,16 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
- (void) toggleSpeedLimit: (id) sender
|
||||
{
|
||||
fSpeedLimitEnabled = !fSpeedLimitEnabled;
|
||||
int state = fSpeedLimitEnabled ? NSOnState : NSOffState;
|
||||
BOOL setEnabled = ![fDefaults boolForKey: @"SpeedLimit"];
|
||||
int state = setEnabled ? NSOnState : NSOffState;
|
||||
|
||||
[fDefaults setBool: fSpeedLimitEnabled forKey: @"SpeedLimit"];
|
||||
[fDefaults setBool: setEnabled forKey: @"SpeedLimit"];
|
||||
|
||||
#warning get rid of
|
||||
[fSpeedLimitItem setState: state];
|
||||
[fSpeedLimitDockItem setState: state];
|
||||
|
||||
[fSpeedLimitButton setImage: !fSpeedLimitEnabled ? fSpeedLimitNormalImage
|
||||
[fSpeedLimitButton setImage: !setEnabled ? fSpeedLimitNormalImage
|
||||
: ([NSColor currentControlTint] == NSBlueControlTint ? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage)];
|
||||
|
||||
[fPrefsController applySpeedSettings: nil];
|
||||
|
@ -1335,7 +1335,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
else
|
||||
shouldBeOn = hour < offHour || hour >= onHour;
|
||||
|
||||
if (fSpeedLimitEnabled != shouldBeOn)
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"] != shouldBeOn)
|
||||
[self toggleSpeedLimit: nil];
|
||||
}
|
||||
|
||||
|
@ -1344,17 +1344,19 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
if (![fDefaults boolForKey: @"SpeedLimitAuto"])
|
||||
return;
|
||||
|
||||
BOOL limited = [fDefaults boolForKey: @"SpeedLimit"];
|
||||
|
||||
//toggle if within first few seconds of hour
|
||||
NSCalendarDate * currentDate = [NSCalendarDate calendarDate];
|
||||
if ([currentDate minuteOfHour] == 0 && [currentDate secondOfMinute] < AUTO_SPEED_LIMIT_SECONDS
|
||||
&& [currentDate hourOfDay] == [fDefaults integerForKey: fSpeedLimitEnabled
|
||||
&& [currentDate hourOfDay] == [fDefaults integerForKey: limited
|
||||
? @"SpeedLimitAutoOffHour" : @"SpeedLimitAutoOnHour"]
|
||||
&& (fSpeedLimitEnabled || [fDefaults integerForKey: @"SpeedLimitAutoOnHour"]
|
||||
&& (limited || [fDefaults integerForKey: @"SpeedLimitAutoOnHour"]
|
||||
!= [fDefaults integerForKey: @"SpeedLimitAutoOffHour"]))
|
||||
{
|
||||
[self toggleSpeedLimit: nil];
|
||||
|
||||
[GrowlApplicationBridge notifyWithTitle: fSpeedLimitEnabled
|
||||
[GrowlApplicationBridge notifyWithTitle: limited
|
||||
? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
|
||||
: NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
|
||||
description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
|
||||
|
|
Loading…
Reference in a new issue