Changeset 4076


Ignore:
Timestamp:
Dec 6, 2007, 12:27:39 AM (14 years ago)
Author:
livings124
Message:

hopefully fix bug with entering values with commas in prefs, switch pref formatters to 10.4

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r3791 r4076  
    1010        <integer>5</integer>
    1111        <key>IBOpenObjects</key>
    12         <array>
    13                 <integer>66</integer>
    14         </array>
     12        <array/>
    1513        <key>IBSystem Version</key>
    16         <string>9A581</string>
     14        <string>9B18</string>
    1715        <key>targetFramework</key>
    1816        <string>IBCocoaFramework</string>
  • trunk/macosx/PrefsController.h

    r3791 r4076  
    3737    IBOutlet NSView         * fGeneralView, * fTransfersView, * fBandwidthView, * fAdvancedView;
    3838   
     39    NSString * fInitialString;
     40   
    3941    IBOutlet NSPopUpButton  * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp,
    4042                            * fDownloadSoundPopUp, * fSeedingSoundPopUp;
     
    5052    IBOutlet NSImageView            * fPortStatusImage;
    5153    IBOutlet NSProgressIndicator    * fPortStatusProgress;
    52     NSTimer                         * fNatStatusTimer;
     54    NSTimer                         * fPortStatusTimer;
    5355    int                             fPublicPort, fNatStatus;
    5456}
  • trunk/macosx/PrefsController.m

    r3793 r4076  
    9191- (void) dealloc
    9292{
    93     if (fNatStatusTimer)
    94         [fNatStatusTimer invalidate];
     93    if (fPortStatusTimer)
     94        [fPortStatusTimer invalidate];
    9595   
    9696    [super dealloc];
     
    132132   
    133133    //set port
    134     #warning why no binding?
    135134    [fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]];
    136135    fNatStatus = -1;
    137136   
    138137    [self updatePortStatus];
    139     fNatStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self
     138    fPortStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self
    140139                        selector: @selector(updatePortStatus) userInfo: nil repeats: YES];
    141140   
     
    143142    [fQueueDownloadField setIntValue: [fDefaults integerForKey: @"QueueDownloadNumber"]];
    144143    [fQueueSeedField setIntValue: [fDefaults integerForKey: @"QueueSeedNumber"]];
    145    
    146     //set stalled value
    147144    [fStalledField setIntValue: [fDefaults integerForKey: @"StalledMinutes"]];
    148145}
     
    211208- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
    212209{
    213     return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS,
    214                                         TOOLBAR_BANDWIDTH, TOOLBAR_ADVANCED, nil];
     210    return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_BANDWIDTH, TOOLBAR_ADVANCED, nil];
    215211}
    216212
     
    218214{
    219215    int port = [sender intValue];
    220     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", port]])
    221     {
    222         NSBeep();
    223         [sender setIntValue: [fDefaults integerForKey: @"BindPort"]];
    224         return;
    225     }
    226    
    227216    [fDefaults setInteger: port forKey: @"BindPort"];
    228    
    229217    tr_setBindPort(fHandle, port);
    230218   
     
    362350- (void) setRatioStop: (id) sender
    363351{
    364     float ratio = [sender floatValue];
    365     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratio]] || ratio < 0)
    366     {
    367         NSBeep();
    368         [sender setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
    369         return;
    370     }
    371    
    372     [fDefaults setFloat: ratio forKey: @"RatioLimit"];
    373    
     352    [fDefaults setFloat: [sender floatValue] forKey: @"RatioLimit"];
    374353    [self applyRatioSetting: nil];
    375354}
     
    386365- (void) setGlobalLimit: (id) sender
    387366{
    388     BOOL upload = sender == fUploadField;
    389    
    390     int limit = [sender intValue];
    391     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0)
    392     {
    393         NSBeep();
    394         [sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]];
    395         return;
    396     }
    397    
    398     [fDefaults setInteger: limit forKey: upload ? @"UploadLimit" : @"DownloadLimit"];
    399    
     367    [fDefaults setInteger: [sender intValue] forKey: sender == fUploadField ? @"UploadLimit" : @"DownloadLimit"];
    400368    [self applySpeedSettings: self];
    401369}
     
    403371- (void) setSpeedLimit: (id) sender
    404372{
    405     BOOL upload = sender == fSpeedLimitUploadField;
    406    
    407     int limit = [sender intValue];
    408     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
    409     {
    410         NSBeep();
    411         [sender setIntValue: [fDefaults integerForKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]];
    412         return;
    413     }
    414    
    415     [fDefaults setInteger: limit forKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"];
    416    
     373    [fDefaults setInteger: [sender intValue] forKey: sender == fSpeedLimitUploadField
     374                                                        ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"];
    417375    [self applySpeedSettings: self];
    418376}
     
    421379{
    422380    [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
     381}
     382
     383- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor
     384{
     385    #warning release!
     386    fInitialString = [[control stringValue] retain];
     387}
     388
     389- (BOOL) control: (NSControl *) control didFailToFormatString: (NSString *) string errorDescription: (NSString *) error
     390{
     391    NSBeep();
     392    if (fInitialString)
     393        [control setStringValue: fInitialString];
     394    return NO;
    423395}
    424396
     
    430402- (void) resetWarnings: (id) sender
    431403{
    432     [fDefaults setBool: YES forKey: @"WarningDebug"];
    433404    [fDefaults setBool: YES forKey: @"WarningDuplicate"];
    434405    [fDefaults setBool: YES forKey: @"WarningRemainingSpace"];
     
    450421- (void) setQueueNumber: (id) sender
    451422{
    452     BOOL download = sender == fQueueDownloadField;
    453    
    454     int limit = [sender intValue];
    455     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 1)
    456     {
    457         NSBeep();
    458         [sender setIntValue: [fDefaults integerForKey: download ? @"QueueDownloadNumber" : @"QueueSeedNumber"]];
    459         return;
    460     }
    461    
    462     [fDefaults setInteger: limit forKey: download ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
     423    [fDefaults setInteger: [sender intValue] forKey: sender == fQueueDownloadField ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
    463424    [self setQueue: nil];
    464425}
     
    471432- (void) setStalledMinutes: (id) sender
    472433{
    473     int minutes = [sender intValue];
    474     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", minutes]] || minutes < 1)
    475     {
    476         NSBeep();
    477         [sender setIntValue: [fDefaults integerForKey: @"StalledMinutes"]];
    478         return;
    479     }
    480    
    481     [fDefaults setInteger: minutes forKey: @"StalledMinutes"];
     434    [fDefaults setInteger: [sender intValue] forKey: @"StalledMinutes"];
    482435    [self setStalled: nil];
    483436}
Note: See TracChangeset for help on using the changeset viewer.