Changeset 802


Ignore:
Timestamp:
Aug 20, 2006, 8:46:55 PM (15 years ago)
Author:
livings124
Message:

Make sure the scheduler 24-hour format is double digits.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r801 r802  
    118118                size += [torrent size];
    119119           
    120             [fSizeField setStringValue: [[NSString stringForFileSize: size]
    121                                 stringByAppendingString: @" Total"]];
     120            [fSizeField setStringValue: [[NSString stringForFileSize: size] stringByAppendingString: @" Total"]];
    122121        }
    123122        else
     
    449448    if (tableView == fPeerTable)
    450449        return [fPeers count];
    451     else if (tableView == fFileTable)
     450    else
    452451        return [fFiles count];
    453     else
    454         return 0;
    455452}
    456453
     
    554551
    555552    float ratioLimit = [sender floatValue];
    556     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratioLimit]]
    557             || ratioLimit < 0)
     553    if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratioLimit]] || ratioLimit < 0)
    558554    {
    559555        NSBeep();
  • trunk/macosx/PrefsController.m

    r779 r802  
    175175   
    176176    int speedLimitAutoOnHour = [fDefaults integerForKey: @"SpeedLimitAutoOnHour"];
    177     [fSpeedLimitAutoOnField setIntValue: speedLimitAutoOnHour];
     177    [fSpeedLimitAutoOnField setStringValue: [NSString stringWithFormat: @"%02d", speedLimitAutoOnHour]];
    178178    [fSpeedLimitAutoOnField setEnabled: speedLimitAuto];
    179179   
    180180    int speedLimitAutoOffHour = [fDefaults integerForKey: @"SpeedLimitAutoOffHour"];
    181     [fSpeedLimitAutoOffField setIntValue: speedLimitAutoOffHour];
     181    [fSpeedLimitAutoOffField setStringValue: [NSString stringWithFormat: @"%02d", speedLimitAutoOffHour]];
    182182    [fSpeedLimitAutoOffField setEnabled: speedLimitAuto];
    183183   
     
    513513
    514514    int hour = [sender intValue];
    515     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", hour]] || hour < 0 || hour > 23
     515   
     516    //allow numbers under ten in the format 0x
     517    if (!([[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", hour]]
     518        || [[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%02d", hour]]) || hour < 0 || hour > 23
    516519        || [fSpeedLimitAutoOnField intValue] == [fSpeedLimitAutoOffField intValue])
    517520    {
    518521        NSBeep();
    519522        hour = [fDefaults integerForKey: key];
    520         [sender setIntValue: hour];
     523        [sender setStringValue: [NSString stringWithFormat: @"%02d", hour]];
    521524    }
    522525    else
    523526        [fDefaults setInteger: hour forKey: key];
     527   
     528    [sender setStringValue: [NSString stringWithFormat: @"%02d", hour]]; //ensure number has 2 digits
    524529   
    525530    [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
Note: See TracChangeset for help on using the changeset viewer.