diff --git a/macosx/English.lproj/PrefsWindow.nib/info.nib b/macosx/English.lproj/PrefsWindow.nib/info.nib index 371c58d1a..42a45cbbd 100644 --- a/macosx/English.lproj/PrefsWindow.nib/info.nib +++ b/macosx/English.lproj/PrefsWindow.nib/info.nib @@ -9,11 +9,9 @@ IBOldestOS 5 IBOpenObjects - - 66 - + IBSystem Version - 9A581 + 9B18 targetFramework IBCocoaFramework diff --git a/macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib b/macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib index 56dea092e..dac13c3ee 100644 Binary files a/macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib and b/macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib differ diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index 564d19568..f55546e8e 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -36,6 +36,8 @@ IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fAdvancedView; + NSString * fInitialString; + IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp, * fDownloadSoundPopUp, * fSeedingSoundPopUp; IBOutlet NSTextField * fRatioStopField, * fQueueDownloadField, * fQueueSeedField, * fStalledField; @@ -49,7 +51,7 @@ IBOutlet NSButton * fNatCheck; IBOutlet NSImageView * fPortStatusImage; IBOutlet NSProgressIndicator * fPortStatusProgress; - NSTimer * fNatStatusTimer; + NSTimer * fPortStatusTimer; int fPublicPort, fNatStatus; } diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index 7a831ebb5..3587f9a69 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -90,8 +90,8 @@ - (void) dealloc { - if (fNatStatusTimer) - [fNatStatusTimer invalidate]; + if (fPortStatusTimer) + [fPortStatusTimer invalidate]; [super dealloc]; } @@ -131,19 +131,16 @@ [fSpeedLimitDownloadField setIntValue: [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]]; //set port - #warning why no binding? [fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]]; fNatStatus = -1; [self updatePortStatus]; - fNatStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self + fPortStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self selector: @selector(updatePortStatus) userInfo: nil repeats: YES]; //set queue values [fQueueDownloadField setIntValue: [fDefaults integerForKey: @"QueueDownloadNumber"]]; [fQueueSeedField setIntValue: [fDefaults integerForKey: @"QueueSeedNumber"]]; - - //set stalled value [fStalledField setIntValue: [fDefaults integerForKey: @"StalledMinutes"]]; } @@ -210,22 +207,13 @@ - (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar { - return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, - TOOLBAR_BANDWIDTH, TOOLBAR_ADVANCED, nil]; + return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_BANDWIDTH, TOOLBAR_ADVANCED, nil]; } - (void) setPort: (id) sender { int port = [sender intValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", port]]) - { - NSBeep(); - [sender setIntValue: [fDefaults integerForKey: @"BindPort"]]; - return; - } - [fDefaults setInteger: port forKey: @"BindPort"]; - tr_setBindPort(fHandle, port); fPublicPort = -1; @@ -361,16 +349,7 @@ - (void) setRatioStop: (id) sender { - float ratio = [sender floatValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratio]] || ratio < 0) - { - NSBeep(); - [sender setFloatValue: [fDefaults floatForKey: @"RatioLimit"]]; - return; - } - - [fDefaults setFloat: ratio forKey: @"RatioLimit"]; - + [fDefaults setFloat: [sender floatValue] forKey: @"RatioLimit"]; [self applyRatioSetting: nil]; } @@ -385,35 +364,14 @@ - (void) setGlobalLimit: (id) sender { - BOOL upload = sender == fUploadField; - - int limit = [sender intValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0) - { - NSBeep(); - [sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]]; - return; - } - - [fDefaults setInteger: limit forKey: upload ? @"UploadLimit" : @"DownloadLimit"]; - + [fDefaults setInteger: [sender intValue] forKey: sender == fUploadField ? @"UploadLimit" : @"DownloadLimit"]; [self applySpeedSettings: self]; } - (void) setSpeedLimit: (id) sender { - BOOL upload = sender == fSpeedLimitUploadField; - - int limit = [sender intValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]]) - { - NSBeep(); - [sender setIntValue: [fDefaults integerForKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]]; - return; - } - - [fDefaults setInteger: limit forKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]; - + [fDefaults setInteger: [sender intValue] forKey: sender == fSpeedLimitUploadField + ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]; [self applySpeedSettings: self]; } @@ -422,6 +380,20 @@ [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self]; } +- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor +{ + #warning release! + fInitialString = [[control stringValue] retain]; +} + +- (BOOL) control: (NSControl *) control didFailToFormatString: (NSString *) string errorDescription: (NSString *) error +{ + NSBeep(); + if (fInitialString) + [control setStringValue: fInitialString]; + return NO; +} + - (void) setBadge: (id) sender { [[NSNotificationCenter defaultCenter] postNotificationName: @"DockBadgeChange" object: self]; @@ -429,7 +401,6 @@ - (void) resetWarnings: (id) sender { - [fDefaults setBool: YES forKey: @"WarningDebug"]; [fDefaults setBool: YES forKey: @"WarningDuplicate"]; [fDefaults setBool: YES forKey: @"WarningRemainingSpace"]; } @@ -449,17 +420,7 @@ - (void) setQueueNumber: (id) sender { - BOOL download = sender == fQueueDownloadField; - - int limit = [sender intValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 1) - { - NSBeep(); - [sender setIntValue: [fDefaults integerForKey: download ? @"QueueDownloadNumber" : @"QueueSeedNumber"]]; - return; - } - - [fDefaults setInteger: limit forKey: download ? @"QueueDownloadNumber" : @"QueueSeedNumber"]; + [fDefaults setInteger: [sender intValue] forKey: sender == fQueueDownloadField ? @"QueueDownloadNumber" : @"QueueSeedNumber"]; [self setQueue: nil]; } @@ -470,15 +431,7 @@ - (void) setStalledMinutes: (id) sender { - int minutes = [sender intValue]; - if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", minutes]] || minutes < 1) - { - NSBeep(); - [sender setIntValue: [fDefaults integerForKey: @"StalledMinutes"]]; - return; - } - - [fDefaults setInteger: minutes forKey: @"StalledMinutes"]; + [fDefaults setInteger: [sender intValue] forKey: @"StalledMinutes"]; [self setStalled: nil]; }