Changeset 1304


Ignore:
Timestamp:
Dec 31, 2006, 9:38:35 PM (16 years ago)
Author:
livings124
Message:

bindings + formatters = trouble....revert to glue code for speed limit, torrent limit, and port fields in prefs...more to come later

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/clients.c

    r1301 r1304  
    7979        else if( !memcmp( &id[1], "BOW", 3 ) )
    8080        {
    81             asprintf( &ret, "Bits on Wheels (%c%c)",
    82                       id[5], id[6] );
     81            asprintf( &ret, "Bits on Wheels (%c%c%c)",
     82                      id[4], id[5], id[6] );
    8383        }
    8484        else if( !memcmp( &id[1], "BR", 2 ) )
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r1295 r1304  
    77            ACTIONS = {
    88                applySpeedSettings = id;
    9                 applyTorrentSpeedSetting = id;
     9                applyTorrentLimitSetting = id;
    1010                folderSheetShow = id;
    1111                helpForNetwork = id;
     
    2121                setQueueNumber = id;
    2222                setSound = id;
     23                setSpeedLimit = id;
     24                setTorrentLimit = id;
    2325                setUpdate = id;
    2426            };
     
    3032                fDownloadField = NSTextField;
    3133                fDownloadSoundPopUp = NSPopUpButton;
     34                fDownloadTorrentField = NSTextField;
    3235                fFolderPopUp = NSPopUpButton;
    3336                fGeneralView = NSView;
     
    3841                fNatStatusImage = NSImageView;
    3942                fNetworkView = NSView;
     43                fPortField = NSTextField;
    4044                fPortStatusField = NSTextField;
    4145                fPortStatusImage = NSImageView;
     
    4852                fUploadCheck = NSButton;
    4953                fUploadField = NSTextField;
     54                fUploadTorrentField = NSTextField;
    5055            };
    5156            SUPERCLASS = NSWindowController;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r1298 r1304  
    88        <dict>
    99                <key>153</key>
    10                 <string>119 428 571 335 0 0 1152 842 </string>
     10                <string>290 411 571 335 0 0 1152 842 </string>
    1111                <key>28</key>
    12                 <string>99 386 571 290 0 0 1152 842 </string>
     12                <string>290 434 571 290 0 0 1152 842 </string>
    1313                <key>41</key>
    1414                <string>290 426 571 305 0 0 1152 842 </string>
    1515                <key>66</key>
    16                 <string>139 501 571 144 0 0 1152 842 </string>
     16                <string>290 507 571 144 0 0 1152 842 </string>
    1717        </dict>
    1818        <key>IBFramework Version</key>
  • trunk/macosx/PrefsController.h

    r1295 r1304  
    4646
    4747    IBOutlet NSTextField    * fUploadField, * fDownloadField,
     48                            * fUploadTorrentField, * fDownloadTorrentField,
    4849                            * fSpeedLimitUploadField, * fSpeedLimitDownloadField;
    4950    IBOutlet NSButton       * fUploadCheck, * fDownloadCheck;
    5051
    51     IBOutlet NSTextField            * fNatStatusField,
    52                                     * fPortStatusField;
     52    IBOutlet NSTextField            * fPortField, * fNatStatusField, * fPortStatusField;
    5353    IBOutlet NSButton               * fNatCheck;
    5454    IBOutlet NSImageView            * fNatStatusImage, * fPortStatusImage;
     
    7777- (void) updateNatStatus;
    7878
     79- (void) applySpeedSettings: (id) sender;
     80
     81- (void) applyTorrentLimitSetting: (id) sender;
     82- (void) setTorrentLimit: (id) sender;
     83
     84- (void) setSpeedLimit: (id) sender;
    7985- (void) setAutoSpeedLimit: (id) sender;
    80 
    81 - (void) applySpeedSettings: (id) sender;
    82 - (void) applyTorrentSpeedSetting: (id) sender;
    8386
    8487- (void) setAutoImport: (id) sender;
  • trunk/macosx/PrefsController.m

    r1295 r1304  
    134134        [fFolderPopUp selectItemAtIndex: DOWNLOAD_ASK];
    135135   
     136    //set torrent limits
     137    [fUploadTorrentField setIntValue: [fDefaults integerForKey: @"UploadLimitTorrent"]];
     138    [fDownloadTorrentField setIntValue: [fDefaults integerForKey: @"DownloadLimitTorrent"]];
     139   
     140    //set speed limit
     141    [fSpeedLimitUploadField setIntValue: [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
     142    [fSpeedLimitDownloadField setIntValue: [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]];
     143   
     144    //set port
     145    [fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]];
     146   
    136147    [self updatePortStatus];
    137148   
     
    221232- (void) setPort: (id) sender
    222233{
     234    int port = [sender intValue];
     235    if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", port]])
     236    {
     237        NSBeep();
     238        [sender setIntValue: [fDefaults integerForKey: @"BindPort"]];
     239        return;
     240    }
     241   
     242    [fDefaults setInteger: port forKey: @"BindPort"];
     243   
    223244    tr_setBindPort(fHandle, [fDefaults integerForKey: @"BindPort"]);
    224245    [self updateNatStatus];
     
    314335}
    315336
    316 - (void) applyTorrentSpeedSetting: (id) sender
     337- (void) applyTorrentLimitSetting: (id) sender
    317338{
    318339    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSpeedSetting" object: self];
     340}
     341
     342- (void) setTorrentLimit: (id) sender
     343{
     344    BOOL upload = sender == fUploadTorrentField;
     345   
     346    int limit = [sender intValue];
     347    if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
     348    {
     349        NSBeep();
     350        [sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"]];
     351        return;
     352    }
     353   
     354    [fDefaults setInteger: limit forKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"];
     355   
     356    [self applyTorrentLimitSetting: self];
     357}
     358
     359- (void) setSpeedLimit: (id) sender
     360{
     361    BOOL upload = sender == fSpeedLimitUploadField;
     362   
     363    int limit = [sender intValue];
     364    if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
     365    {
     366        NSBeep();
     367        [sender setIntValue: [fDefaults integerForKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]];
     368        return;
     369    }
     370   
     371    [fDefaults setInteger: limit forKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"];
     372   
     373    [self applySpeedSettings: self];
    319374}
    320375
Note: See TracChangeset for help on using the changeset viewer.