Remove a variable.

This commit is contained in:
Mitchell Livingston 2006-07-01 00:44:22 +00:00
parent 20c791b99d
commit 3581efe3da
2 changed files with 7 additions and 15 deletions

View File

@ -55,7 +55,6 @@
IBOutlet SUUpdater * fUpdater; IBOutlet SUUpdater * fUpdater;
NSString * fDownloadFolder; NSString * fDownloadFolder;
BOOL fSpeedLimit;
NSUserDefaults * fDefaults; NSUserDefaults * fDefaults;
} }

View File

@ -131,8 +131,6 @@
[fDownloadField setEnabled: checkDownload]; [fDownloadField setEnabled: checkDownload];
//set speed limit //set speed limit
fSpeedLimit = [fDefaults boolForKey: @"SpeedLimit"];
int speedLimitUploadLimit = [fDefaults integerForKey: @"SpeedLimitUploadLimit"]; int speedLimitUploadLimit = [fDefaults integerForKey: @"SpeedLimitUploadLimit"];
[fSpeedLimitUploadField setIntValue: speedLimitUploadLimit]; [fSpeedLimitUploadField setIntValue: speedLimitUploadLimit];
@ -140,7 +138,7 @@
[fSpeedLimitDownloadField setIntValue: speedLimitDownloadLimit]; [fSpeedLimitDownloadField setIntValue: speedLimitDownloadLimit];
//actually set bandwidth limits //actually set bandwidth limits
if (fSpeedLimit) if ([fDefaults boolForKey: @"SpeedLimit"])
{ {
tr_setUploadLimit(fHandle, speedLimitUploadLimit); tr_setUploadLimit(fHandle, speedLimitUploadLimit);
tr_setDownloadLimit(fHandle, speedLimitDownloadLimit); tr_setDownloadLimit(fHandle, speedLimitDownloadLimit);
@ -309,7 +307,7 @@
} }
else else
{ {
if (!fSpeedLimit) if (![fDefaults boolForKey: @"SpeedLimit"])
{ {
if (sender == fUploadField) if (sender == fUploadField)
tr_setUploadLimit(fHandle, [fUploadCheck state] ? limit : -1); tr_setUploadLimit(fHandle, [fUploadCheck state] ? limit : -1);
@ -375,12 +373,11 @@
- (void) enableSpeedLimit: (BOOL) enable - (void) enableSpeedLimit: (BOOL) enable
{ {
if (fSpeedLimit != enable) if ([fDefaults boolForKey: @"SpeedLimit"] != enable)
{ {
fSpeedLimit = enable; [fDefaults setBool: enable forKey: @"SpeedLimit"];
[fDefaults setBool: fSpeedLimit forKey: @"SpeedLimit"];
if (fSpeedLimit) if (enable)
{ {
tr_setUploadLimit(fHandle, [fDefaults integerForKey: @"SpeedLimitUploadLimit"]); tr_setUploadLimit(fHandle, [fDefaults integerForKey: @"SpeedLimitUploadLimit"]);
tr_setDownloadLimit(fHandle, [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]); tr_setDownloadLimit(fHandle, [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]);
@ -395,11 +392,7 @@
- (void) setSpeedLimit: (id) sender - (void) setSpeedLimit: (id) sender
{ {
NSString * key; NSString * key = sender == fSpeedLimitUploadField ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit";
if (sender == fSpeedLimitUploadField)
key = @"SpeedLimitUploadLimit";
else
key = @"SpeedLimitDownloadLimit";
int limit = [sender intValue]; int limit = [sender intValue];
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]]
@ -411,7 +404,7 @@
} }
else else
{ {
if (fSpeedLimit) if ([fDefaults boolForKey: @"SpeedLimit"])
{ {
if (sender == fSpeedLimitUploadField) if (sender == fSpeedLimitUploadField)
tr_setUploadLimit(fHandle, limit); tr_setUploadLimit(fHandle, limit);