Ignore:
Timestamp:
Apr 5, 2009, 8:13:16 PM (13 years ago)
Author:
livings124
Message:

save the value of the speed limit day without conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PrefsController.m

    r8153 r8156  
    3737#define DOWNLOAD_TORRENT    2
    3838
    39 #define SCHED_ALL_TAG       0
    40 #define SCHED_WEEKDAY_TAG   1
    41 #define SCHED_WEEKEND_TAG   2
    42 #define SCHED_MON_TAG       3
    43 #define SCHED_TUES_TAG      4
    44 #define SCHED_WED_TAG       5
    45 #define SCHED_THURS_TAG     6
    46 #define SCHED_FRI_TAG       7
    47 #define SCHED_SAT_TAG       8
    48 #define SCHED_SUN_TAG       9
    49 
    5039#define PROXY_HTTP      0
    5140#define PROXY_SOCKS4    1
     
    112101        }
    113102       
    114         //set auto speed limit day
    115         [self updateAutoSpeedLimitDay];
    116        
    117103        //save a new random port
    118104        if ([fDefaults boolForKey: @"RandomPort"])
     
    201187    [fSpeedLimitUploadField setIntValue: [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
    202188    [fSpeedLimitDownloadField setIntValue: [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]];
    203    
    204     int schedDay;
    205     switch (tr_sessionGetAltSpeedDay(fHandle))
    206     {
    207         case TR_SCHED_ALL:
    208             schedDay = SCHED_ALL_TAG;
    209             break;
    210         case TR_SCHED_WEEKDAY:
    211             schedDay = SCHED_WEEKDAY_TAG;
    212             break;
    213         case TR_SCHED_WEEKEND:
    214             schedDay = SCHED_WEEKEND_TAG;
    215             break;
    216         case TR_SCHED_MON:
    217             schedDay = SCHED_MON_TAG;
    218             break;
    219         case TR_SCHED_TUES:
    220             schedDay = SCHED_TUES_TAG;
    221             break;
    222         case TR_SCHED_WED:
    223             schedDay = SCHED_WED_TAG;
    224             break;
    225         case TR_SCHED_THURS:
    226             schedDay = SCHED_THURS_TAG;
    227             break;
    228         case TR_SCHED_FRI:
    229             schedDay = SCHED_FRI_TAG;
    230             break;
    231         case TR_SCHED_SAT:
    232             schedDay = SCHED_SAT_TAG;
    233             break;
    234         case TR_SCHED_SUN:
    235             schedDay = SCHED_SUN_TAG;
    236             break;
    237     }
    238     [fAutoSpeedDayTypePopUp selectItemWithTag: schedDay];
    239189   
    240190    //set port
     
    662612- (void) setAutoSpeedLimitDay: (id) sender
    663613{
    664     NSString * day;
    665     switch ([[sender selectedItem] tag])
    666     {
    667         case SCHED_ALL_TAG:
    668             day = @"ALL";
    669             break;
    670         case SCHED_WEEKDAY_TAG:
    671             day = @"WEEKDAY";
    672             break;
    673         case SCHED_WEEKEND_TAG:
    674             day = @"WEEKEND";
    675             break;
    676         case SCHED_MON_TAG:
    677             day = @"MON";
    678             break;
    679         case SCHED_TUES_TAG:
    680             day = @"TUES";
    681             break;
    682         case SCHED_WED_TAG:
    683             day = @"WED";
    684             break;
    685         case SCHED_THURS_TAG:
    686             day = @"THURS";
    687             break;
    688         case SCHED_FRI_TAG:
    689             day = @"FRI";
    690             break;
    691         case SCHED_SAT_TAG:
    692             day = @"SAT";
    693             break;
    694         case SCHED_SUN_TAG:
    695             day = @"SUN";
    696             break;
    697     }
    698    
    699     [fDefaults setObject: day forKey: @"SpeedLimitAutoDay"];
    700     [self updateAutoSpeedLimitDay];
    701 }
    702 
    703 - (void) updateAutoSpeedLimitDay
    704 {
    705     NSString * dayString = [fDefaults stringForKey: @"SpeedLimitAutoDay"];
    706     tr_sched_day day;
    707     if ([dayString isEqualToString: @"WEEKDAY"])
    708         day = TR_SCHED_WEEKDAY;
    709     else if ([dayString isEqualToString: @"WEEKEND"])
    710         day = TR_SCHED_WEEKEND;
    711     else if ([dayString isEqualToString: @"MON"])
    712         day = TR_SCHED_MON;
    713     else if ([dayString isEqualToString: @"TUES"])
    714         day = TR_SCHED_TUES;
    715     else if ([dayString isEqualToString: @"WED"])
    716         day = TR_SCHED_WED;
    717     else if ([dayString isEqualToString: @"THURS"])
    718         day = TR_SCHED_THURS;
    719     else if ([dayString isEqualToString: @"FRI"])
    720         day = TR_SCHED_FRI;
    721     else if ([dayString isEqualToString: @"SAT"])
    722         day = TR_SCHED_SAT;
    723     else if ([dayString isEqualToString: @"SUN"])
    724         day = TR_SCHED_SUN;
    725     else
    726     {
    727         //safety
    728         if (![dayString isEqualToString: @"ALL"])
    729         {
    730             dayString = @"ALL";
    731             [fDefaults setObject: dayString forKey: @"SpeedLimitAutoDay"];
    732         }
    733         day = TR_SCHED_ALL;
    734     }
    735    
    736     tr_sessionSetAltSpeedDay(fHandle, day);
     614    tr_sessionSetAltSpeedDay(fHandle, [[sender selectedItem] tag]);
    737615}
    738616
     
    11851063}
    11861064
    1187 #warning probably needs to be updated
    11881065- (void) rpcUpdatePrefs
    11891066{
     
    12581135    [fDefaults setObject: limitEndDate forKey: @"SpeedLimitAutoOffDate"];
    12591136   
    1260     #warning refactor how to work with schedule day
     1137    const int limitDay = tr_sessionGetAltSpeedDay(fHandle);
     1138    [fDefaults setInteger: limitDay forKey: @"SpeedLimitAutoDay"];
    12611139   
    12621140    //blocklist
     
    12991177        //speed limit schedule handled by bindings
    13001178       
    1301         //speed limit schedule times handled by bindings
    1302        
    1303         #warning need to set schedule day
     1179        //speed limit schedule times and day handled by bindings
    13041180       
    13051181        [self updateBlocklistFields];
Note: See TracChangeset for help on using the changeset viewer.