Ignore:
Timestamp:
Apr 5, 2009, 3:36:51 PM (13 years ago)
Author:
livings124
Message:

first pass through for making the Mac client respond to the new rpc messages - still missing a few things

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PrefsController.m

    r8131 r8147  
    388388- (void) setPort: (id) sender
    389389{
    390     int port = [sender intValue];
     390    const int port = [sender intValue];
    391391    [fDefaults setInteger: port forKey: @"BindPort"];
    392392    tr_sessionSetPeerPort(fHandle, port);
     
    398398- (void) randomPort: (id) sender
    399399{
    400     tr_port port = tr_sessionSetPeerPortRandom(fHandle);
     400    const tr_port port = tr_sessionSetPeerPortRandom(fHandle);
    401401   
    402402    [fPortField setIntValue: port];
     
    543543- (void) updateBlocklistFields
    544544{
    545     BOOL exists = tr_blocklistExists(fHandle);
     545    const BOOL exists = tr_blocklistExists(fHandle);
    546546   
    547547    if (exists)
     
    11801180{
    11811181    //encryption
    1182     tr_encryption_mode encryptionMode = tr_sessionGetEncryption(fHandle);
     1182    const tr_encryption_mode encryptionMode = tr_sessionGetEncryption(fHandle);
    11831183    [fDefaults setBool: encryptionMode != TR_CLEAR_PREFERRED forKey: @"EncryptionPrefer"];
    11841184    [fDefaults setBool: encryptionMode == TR_ENCRYPTION_REQUIRED forKey: @"EncryptionRequire"];
     
    11891189   
    11901190    //peers
    1191     uint16_t peersTotal = tr_sessionGetPeerLimit(fHandle);
     1191    const uint16_t peersTotal = tr_sessionGetPeerLimit(fHandle);
    11921192    [fDefaults setInteger: peersTotal forKey: @"PeersTotal"];
    11931193   
     1194    const uint16_t peersTorrent = tr_sessionGetPeerLimitPerTorrent(fHandle);
     1195    [fDefaults setInteger: peersTotal forKey: @"PeersTorrent"];
     1196   
    11941197    //pex
    1195     BOOL pex = tr_sessionIsPexEnabled(fHandle);
     1198    const BOOL pex = tr_sessionIsPexEnabled(fHandle);
    11961199    [fDefaults setBool: pex forKey: @"PEXGlobal"];
    11971200   
    11981201    //port
    1199     tr_port port = tr_sessionGetPeerPort(fHandle);
     1202    const tr_port port = tr_sessionGetPeerPort(fHandle);
    12001203    [fDefaults setInteger: port forKey: @"BindPort"];
    12011204   
    1202     BOOL nat = tr_sessionIsPortForwardingEnabled(fHandle);
     1205    const BOOL nat = tr_sessionIsPortForwardingEnabled(fHandle);
    12031206    [fDefaults setBool: nat forKey: @"NatTraversal"];
    12041207   
     
    12071210    [self updatePortStatus];
    12081211   
     1212    const BOOL randomPort = tr_sessionGetPeerPortRandomOnStart(fHandle);
     1213    [fDefaults setBool: randomPort forKey: @"RandomPort"];
     1214   
    12091215    //speed limit - down
    1210     BOOL downLimitEnabled = tr_sessionIsSpeedLimited(fHandle, TR_DOWN);
     1216    const BOOL downLimitEnabled = tr_sessionIsSpeedLimited(fHandle, TR_DOWN);
    12111217    [fDefaults setBool: downLimitEnabled forKey: @"CheckDownload"];
    12121218   
    1213     int downLimit = tr_sessionGetSpeedLimit(fHandle, TR_DOWN);
     1219    const int downLimit = tr_sessionGetSpeedLimit(fHandle, TR_DOWN);
    12141220    [fDefaults setInteger: downLimit forKey: @"DownloadLimit"];
    12151221   
    12161222    //speed limit - up
    1217     BOOL upLimitEnabled = tr_sessionIsSpeedLimited(fHandle, TR_UP);
     1223    const BOOL upLimitEnabled = tr_sessionIsSpeedLimited(fHandle, TR_UP);
    12181224    [fDefaults setBool: upLimitEnabled forKey: @"CheckUpload"];
    12191225   
    1220     int upLimit = tr_sessionGetSpeedLimit(fHandle, TR_UP);
     1226    const int upLimit = tr_sessionGetSpeedLimit(fHandle, TR_UP);
    12211227    [fDefaults setInteger: upLimit forKey: @"UploadLimit"];
    12221228   
     1229    #warning fix
     1230    //alt speed limit enabled
     1231    /*const BOOL useAltSpeed = tr_sessionUsesAltSpeed(fHandle);
     1232    [fDefaults setBool: useAltSpeed forKey: @"SpeedLimit"];*/
     1233   
     1234    //alt speed limit - down
     1235    const int downLimitAlt = tr_sessionGetAltSpeed(fHandle, TR_DOWN);
     1236    [fDefaults setInteger: downLimit forKey: @"SpeedLimitDownloadLimit"];
     1237   
     1238    //alt speed limit - up
     1239    const int upLimitAlt = tr_sessionGetAltSpeed(fHandle, TR_UP);
     1240    [fDefaults setInteger: upLimitAlt forKey: @"SpeedLimitDownloadLimit"];
     1241   
     1242    //alt speed limit schedule
     1243    const BOOL useAltSpeedSched = tr_sessionUsesAltSpeedTime(fHandle);
     1244    [fDefaults setBool: useAltSpeedSched forKey: @"SpeedLimitAuto"];
     1245   
     1246    #warning refactor schedule date?
     1247    /*NSDate * limitStartDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedBegin(fHandle)];
     1248    [fDefaults setObject: limitStartDate forKey: @"SpeedLimitAutoOnDate"];
     1249   
     1250    NSDate * limitEndDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedEnd(fHandle)];
     1251    [fDefaults setObject: limitEndDate forKey: @"SpeedLimitAutoOffDate"];*/
     1252   
     1253    #warning refactor how to work with schedule day
     1254   
    12231255    [[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
     1256   
     1257    //blocklist
     1258    const BOOL blocklist = tr_blocklistIsEnabled(fHandle);
     1259    [fDefaults setBool: blocklist forKey: @"Blocklist"];
     1260   
     1261    //seed ratio
     1262    const BOOL ratioLimited = tr_sessionIsRatioLimited(fHandle);
     1263    [fDefaults setBool: ratioLimited forKey: @"RatioCheck"];
     1264   
     1265    const float ratioLimit = tr_sessionGetRatioLimit(fHandle);
     1266    [fDefaults setFloat: ratioLimit forKey: @"RatioLimit"];
    12241267   
    12251268    //update gui if loaded
     
    12311274       
    12321275        [fPeersGlobalField setIntValue: peersTotal];
     1276        [fPeersTorrentField setIntValue: peersTorrent];
    12331277       
    12341278        //pex handled by bindings
     
    12361280        [fPortField setIntValue: port];
    12371281        //port forwarding (nat) handled by bindings
     1282        //random port handled by bindings
    12381283       
    12391284        //limit check handled by bindings
     
    12421287        //limit check handled by bindings
    12431288        [fUploadField setIntValue: upLimit];
     1289       
     1290        [fSpeedLimitDownloadField setIntValue: downLimitAlt];
     1291       
     1292        [fSpeedLimitUploadField setIntValue: upLimitAlt];
     1293       
     1294        //speed limit schedule handled by bindings
     1295       
     1296        //speed limit schedule times handled by bindings
     1297       
     1298        #warning need to set schedule day
     1299       
     1300        [self updateBlocklistFields];
     1301       
     1302        //ratio limit enabled handled by bindings
     1303        [fRatioStopField setFloatValue: ratioLimit];
    12441304    }
    12451305}
Note: See TracChangeset for help on using the changeset viewer.