Changeset 6013


Ignore:
Timestamp:
Jun 3, 2008, 5:55:43 PM (14 years ago)
Author:
livings124
Message:

implement most of the rpc preferences updating

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r5950 r6013  
    269269
    270270- (void) rpcCallback: (tr_rpc_callback_type) type forTorrentStruct: (struct tr_torrent *) torrentStruct;
     271- (void) rpcAddTorrentStruct: (NSValue *) torrentStructPtr;
     272- (void) rpcRemoveTorrent: (Torrent *) torrent;
     273- (void) rpcStartedStoppedTorrent: (Torrent *) torrent;
     274- (void) rpcChangedTorrent: (Torrent *) torrent;
    271275
    272276@end
  • trunk/macosx/Controller.m

    r6012 r6013  
    41604160   
    41614161    //get the torrent
    4162     Torrent * torrent;
     4162    Torrent * torrent = nil;
    41634163    if (torrentStruct != NULL && (type != TR_RPC_TORRENT_ADDED && type != TR_RPC_SESSION_CHANGED))
    41644164    {
     
    41984198       
    41994199        case TR_RPC_SESSION_CHANGED:
     4200            [fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
    42004201            break;
    42014202       
    42024203        default:
    42034204            NSLog(@"Unknown RPC command received!");
     4205            [torrent release];
    42044206    }
    42054207   
     
    42494251    if ([[fTableView selectedTorrents] containsObject: torrent])
    42504252    {
     4253        #warning update the file table as well
     4254       
    42514255        [fInfoController updateInfoStats];
    42524256        [fInfoController updateOptions];
  • trunk/macosx/PrefsController.h

    r5913 r6013  
    117117- (void) helpForNetwork: (id) sender;
    118118
     119- (void) rpcUpdatePrefs;
     120
    119121@end
  • trunk/macosx/PrefsController.m

    r6000 r6013  
    625625}
    626626
     627- (void) rpcUpdatePrefs
     628{
     629    //encryption
     630    tr_encryption_mode encryptionMode = tr_sessionGetEncryption(fHandle);
     631    [fDefaults setBool: encryptionMode != TR_PLAINTEXT_PREFERRED forKey: @"EncryptionPrefer"];
     632    [fDefaults setBool: encryptionMode == TR_ENCRYPTION_PREFERRED forKey: @"EncryptionPrefer"];
     633   
     634    //download directory
     635    #warning missing!
     636   
     637    //peers
     638    uint16_t peersTotal = tr_sessionGetPeerLimit(fHandle);
     639    [fDefaults setInteger: peersTotal forKey: @"PeersTotal"];
     640   
     641    //pex
     642    BOOL pex = tr_sessionIsPexEnabled(fHandle);
     643    [fDefaults setBool: pex forKey: @"PEXGlobal"];
     644   
     645    //port
     646    int port = tr_sessionGetPeerPort(fHandle);
     647    [fDefaults setInteger: port forKey: @"BindPort"];
     648   
     649    BOOL nat = tr_sessionIsPortForwardingEnabled(fHandle);
     650    [fDefaults setBool: nat forKey: @"NatTraversal"];
     651   
     652    fPeerPort = -1;
     653    fNatStatus = -1;
     654    [self updatePortStatus];
     655   
     656    //speed limit - down
     657    BOOL downLimitEnabled = tr_sessionIsSpeedLimitEnabled(fHandle, TR_DOWN);
     658    [fDefaults setBool: downLimitEnabled forKey: @"CheckDownload"];
     659   
     660    int downLimit = tr_sessionGetSpeedLimit(fHandle, TR_DOWN);
     661    [fDefaults setInteger: downLimit forKey: @"DownloadLimit"];
     662   
     663    //speed limit - up
     664    BOOL upLimitEnabled = tr_sessionIsSpeedLimitEnabled(fHandle, TR_UP);
     665    [fDefaults setBool: upLimitEnabled forKey: @"CheckUpload"];
     666   
     667    int upLimit = tr_sessionGetSpeedLimit(fHandle, TR_UP);
     668    [fDefaults setInteger: upLimit forKey: @"UploadLimit"];
     669   
     670   
     671    //update gui if necessary
     672    if (fHasLoaded)
     673    {
     674        //encryption handled by bindings
     675       
     676        [fPeersGlobalField setIntValue: peersTotal];
     677       
     678        //pex handled by bindings
     679       
     680        [fPortField setIntValue: port];
     681        //port forwarding (nat) handled by bindings
     682       
     683        //limit check handled by bindings
     684        [fDownloadField setIntValue: downLimit];
     685       
     686        //limit check handled by bindings
     687        [fUploadField setIntValue: upLimit];
     688    }
     689}
     690
    627691@end
    628692
Note: See TracChangeset for help on using the changeset viewer.