Changeset 1049 for trunk


Ignore:
Timestamp:
Nov 1, 2006, 4:37:14 PM (15 years ago)
Author:
livings124
Message:

Use an NSDatePicker for the speed limit scheduler...this will require 10.4 for now.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r1037 r1049  
    108108                A232D29E0A70903E00973B12 /* Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = A232D29D0A70903E00973B12 /* Filter.png */; };
    109109                A23BBEB70A9BBE77003F7274 /* BarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* BarButton.m */; };
     110                A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */; };
    110111                A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
    111112                A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
     
    119120                A253F7150A699178008EE24F /* FilterButtonPressedRight.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7120A699178008EE24F /* FilterButtonPressedRight.png */; };
    120121                A253F7160A699178008EE24F /* FilterButtonPressedMain.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7130A699178008EE24F /* FilterButtonPressedMain.png */; };
    121                 A253F7170A699178008EE24F /* FilterButtonPressedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */; };
    122122                A253F72A0A699373008EE24F /* FilterButtonSelectedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7270A699373008EE24F /* FilterButtonSelectedLeft.png */; };
    123123                A253F72B0A699373008EE24F /* FilterButtonSelectedMain.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7280A699373008EE24F /* FilterButtonSelectedMain.png */; };
     
    859859                                A253F7150A699178008EE24F /* FilterButtonPressedRight.png in Resources */,
    860860                                A253F7160A699178008EE24F /* FilterButtonPressedMain.png in Resources */,
    861                                 A253F7170A699178008EE24F /* FilterButtonPressedLeft.png in Resources */,
    862861                                A253F72A0A699373008EE24F /* FilterButtonSelectedLeft.png in Resources */,
    863862                                A253F72B0A699373008EE24F /* FilterButtonSelectedMain.png in Resources */,
     
    877876                                A29C8B330ACC6E93000ED9F9 /* YellowDot.tiff in Resources */,
    878877                                A22A8D560AEEAFA5007E9CB9 /* Localizable.strings in Resources */,
     878                                A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */,
    879879                        );
    880880                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/macosx/ActionMenuRatioToDisplayRatioTransformer.m

    r1034 r1049  
    2020}
    2121
    22 
    2322@end
  • trunk/macosx/ActionMenuSpeedToDisplayLimitTransformer.m

    r1034 r1049  
    2020}
    2121
    22 
    2322@end
  • trunk/macosx/Controller.m

    r1048 r1049  
    13191319        return;
    13201320 
    1321     int onHour = [fDefaults integerForKey: @"SpeedLimitAutoOnHour"],
    1322         offHour = [fDefaults integerForKey: @"SpeedLimitAutoOffHour"];
     1321    NSCalendarDate * onDate = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:
     1322                        [[fDefaults objectForKey: @"SpeedLimitAutoOnDate"] timeIntervalSinceReferenceDate]],
     1323        * offDate = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:
     1324                        [[fDefaults objectForKey: @"SpeedLimitAutoOffDate"] timeIntervalSinceReferenceDate]],
     1325        * nowDate = [NSCalendarDate calendarDate];
    13231326   
    13241327    //check if should be on if within range
    13251328    BOOL shouldBeOn;
    1326     int hour = [[NSCalendarDate calendarDate] hourOfDay];
    1327    
    1328     if (onHour == offHour)
     1329   
     1330    int onTime = [onDate hourOfDay] * 60 + [onDate minuteOfHour],
     1331        offTime = [offDate hourOfDay] * 60 + [offDate minuteOfHour],
     1332        nowTime = [nowDate hourOfDay] * 60 + [nowDate minuteOfHour];
     1333   
     1334    if (onTime == offTime)
    13291335        shouldBeOn = NO;
    1330     else if (onHour < offHour)
    1331         shouldBeOn = hour >= onHour && hour < offHour;
     1336    else if (onTime < offTime)
     1337        shouldBeOn = onTime <= nowTime && nowTime < offTime;
    13321338    else
    1333         shouldBeOn = hour < offHour || hour >= onHour;
     1339        shouldBeOn = onTime <= nowTime || nowTime < offTime;
    13341340   
    13351341    if ([fDefaults boolForKey: @"SpeedLimit"] != shouldBeOn)
     
    13411347    if (![fDefaults boolForKey: @"SpeedLimitAuto"])
    13421348        return;
    1343 
    1344     BOOL limited = [fDefaults boolForKey: @"SpeedLimit"];
    1345    
    1346     //toggle if within first few seconds of hour
    1347     NSCalendarDate * currentDate = [NSCalendarDate calendarDate];
    1348     if ([currentDate minuteOfHour] == 0 && [currentDate secondOfMinute] < AUTO_SPEED_LIMIT_SECONDS
    1349         && [currentDate hourOfDay] == [fDefaults integerForKey: limited
    1350                                         ? @"SpeedLimitAutoOffHour" : @"SpeedLimitAutoOnHour"]
    1351         && (limited || [fDefaults integerForKey: @"SpeedLimitAutoOnHour"]
    1352                                     != [fDefaults integerForKey: @"SpeedLimitAutoOffHour"]))
     1349   
     1350    //only toggle if within first few seconds of minutes
     1351    NSCalendarDate * nowDate = [NSCalendarDate calendarDate];
     1352    if ([nowDate secondOfMinute] < AUTO_SPEED_LIMIT_SECONDS)
     1353        return;
     1354   
     1355    NSCalendarDate * offDate = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:
     1356                        [[fDefaults objectForKey: @"SpeedLimitAutoOffDate"] timeIntervalSinceReferenceDate]];
     1357   
     1358    BOOL toggle;
     1359    if ([fDefaults boolForKey: @"SpeedLimit"])
     1360        toggle = [nowDate hourOfDay] == [offDate hourOfDay] && [nowDate minuteOfHour] == [offDate minuteOfHour];
     1361    else
     1362    {
     1363        NSCalendarDate * onDate = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:
     1364                        [[fDefaults objectForKey: @"SpeedLimitAutoOnDate"] timeIntervalSinceReferenceDate]];
     1365        toggle = ([nowDate hourOfDay] == [onDate hourOfDay] && [nowDate minuteOfHour] == [onDate minuteOfHour])
     1366                    && !([onDate hourOfDay] == [offDate hourOfDay] && [onDate minuteOfHour] == [offDate minuteOfHour]);
     1367    }
     1368   
     1369    if (toggle)
    13531370    {
    13541371        [self toggleSpeedLimit: nil];
    13551372       
    1356         [GrowlApplicationBridge notifyWithTitle: limited
     1373        [GrowlApplicationBridge notifyWithTitle: [fDefaults boolForKey: @"SpeedLimit"]
    13571374                ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
    13581375                : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
  • trunk/macosx/Defaults.plist

    r995 r1049  
    8989        <key>SpeedLimitAuto</key>
    9090        <false/>
    91         <key>SpeedLimitAutoOffHour</key>
    92         <integer>21</integer>
    93         <key>SpeedLimitAutoOnHour</key>
    94         <integer>9</integer>
     91        <key>SpeedLimitAutoOffDate</key>
     92        <date>2000-01-01T13:00:00Z</date>
     93        <key>SpeedLimitAutoOnDate</key>
     94        <date>2000-01-01T03:00:00Z</date>
    9595        <key>SpeedLimitDownloadLimit</key>
    9696        <integer>10</integer>
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r1044 r1049  
    2525        <string>446.1</string>
    2626        <key>IBLockedObjects</key>
    27         <array/>
     27        <array>
     28                <integer>21</integer>
     29        </array>
    2830        <key>IBOldestOS</key>
    2931        <integer>3</integer>
     
    3133        <array>
    3234                <integer>29</integer>
     35                <integer>21</integer>
    3336        </array>
    3437        <key>IBSystem Version</key>
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r1039 r1049  
    1212                setAutoImport = id;
    1313                setAutoSize = id;
    14                 setAutoSpeedLimitCheck = id;
    15                 setAutoSpeedLimitHour = id;
     14                setAutoSpeedLimit = id;
    1615                setBadge = id;
    1716                setCopyTorrents = id;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r1038 r1049  
    88        <dict>
    99                <key>153</key>
    10                 <string>294 445 563 267 0 0 1152 842 </string>
     10                <string>123 483 563 267 0 0 1152 842 </string>
    1111                <key>28</key>
    1212                <string>294 434 563 290 0 0 1152 842 </string>
     
    2424        <key>IBOpenObjects</key>
    2525        <array>
    26                 <integer>41</integer>
     26                <integer>153</integer>
    2727        </array>
    2828        <key>IBSystem Version</key>
  • trunk/macosx/PrefsController.h

    r1039 r1049  
    7878- (void) updateNatStatus;
    7979
    80 - (void) setAutoSpeedLimitCheck: (id) sender;
    81 - (void) setAutoSpeedLimitHour: (id) sender;
     80- (void) setAutoSpeedLimit: (id) sender;
    8281
    8382- (void) applySpeedSettings: (id) sender;
  • trunk/macosx/PrefsController.m

    r1039 r1049  
    317317}
    318318
    319 - (void) setAutoSpeedLimitCheck: (id) sender
    320 {
    321     [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
    322 }
    323 
    324 - (void) setAutoSpeedLimitHour: (id) sender
     319- (void) setAutoSpeedLimit: (id) sender
    325320{
    326321    [[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
Note: See TracChangeset for help on using the changeset viewer.