Changeset 1317


Ignore:
Timestamp:
Jan 8, 2007, 3:11:15 PM (15 years ago)
Author:
livings124
Message:

let's make things simpler: no need for default individual torrent bandwidth limits...global limits and inspector options are enough

Location:
trunk/macosx
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Defaults.plist

    r1295 r1317  
    1919        <key>CheckDownload</key>
    2020        <false/>
    21         <key>CheckDownloadTorrent</key>
    22         <false/>
    2321        <key>CheckQuit</key>
    2422        <true/>
     
    3129        <key>CheckUpload</key>
    3230        <true/>
    33         <key>CheckUploadTorrent</key>
    34         <false/>
    3531        <key>DeleteOriginalTorrent</key>
    3632        <false/>
     
    4137        <key>DownloadLimit</key>
    4238        <integer>100</integer>
    43         <key>DownloadLimitTorrent</key>
    44         <integer>50</integer>
    4539        <key>DownloadSound</key>
    4640        <string>Glass</string>
     
    109103        <key>UploadLimit</key>
    110104        <integer>20</integer>
    111         <key>UploadLimitTorrent</key>
    112         <integer>20</integer>
    113105        <key>UseAdvancedBar</key>
    114106        <false/>
  • trunk/macosx/English.lproj/PrefsWindow.nib/classes.nib

    r1305 r1317  
    77            ACTIONS = {
    88                applySpeedSettings = id;
    9                 applyTorrentLimitSetting = id;
    109                folderSheetShow = id;
    1110                helpForNetwork = id;
     
    2423                setSound = id;
    2524                setSpeedLimit = id;
    26                 setTorrentLimit = id;
    2725                setUpdate = id;
    2826            };
     
    3129            OUTLETS = {
    3230                fBandwidthView = NSView;
    33                 fDownloadCheck = NSButton;
    3431                fDownloadField = NSTextField;
    3532                fDownloadSoundPopUp = NSPopUpButton;
    36                 fDownloadTorrentField = NSTextField;
    3733                fFolderPopUp = NSPopUpButton;
    3834                fGeneralView = NSView;
     
    5450                fTransfersView = NSView;
    5551                fUpdatePopUp = NSPopUpButton;
    56                 fUploadCheck = NSButton;
    5752                fUploadField = NSTextField;
    58                 fUploadTorrentField = NSTextField;
    5953            };
    6054            SUPERCLASS = NSWindowController;
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r1305 r1317  
    88        <dict>
    99                <key>153</key>
    10                 <string>191 408 571 335 0 0 1152 842 </string>
     10                <string>57 332 563 268 0 0 1152 842 </string>
    1111                <key>28</key>
    12                 <string>290 434 571 290 0 0 1152 842 </string>
     12                <string>156 256 571 290 0 0 1152 842 </string>
    1313                <key>41</key>
    14                 <string>151 440 571 305 0 0 1152 842 </string>
     14                <string>89 307 563 305 0 0 1152 842 </string>
    1515                <key>66</key>
    16                 <string>290 507 571 144 0 0 1152 842 </string>
     16                <string>294 507 563 144 0 0 1152 842 </string>
    1717        </dict>
    1818        <key>IBFramework Version</key>
     
    2424        <key>IBOpenObjects</key>
    2525        <array>
    26                 <integer>41</integer>
     26                <integer>66</integer>
    2727        </array>
    2828        <key>IBSystem Version</key>
  • trunk/macosx/PrefsController.h

    r1305 r1317  
    4848
    4949    IBOutlet NSTextField    * fUploadField, * fDownloadField,
    50                             * fUploadTorrentField, * fDownloadTorrentField,
    5150                            * fSpeedLimitUploadField, * fSpeedLimitDownloadField;
    52     IBOutlet NSButton       * fUploadCheck, * fDownloadCheck;
    5351
    5452    IBOutlet NSTextField            * fPortField, * fNatStatusField, * fPortStatusField;
     
    8785- (void) setGlobalLimit: (id) sender;
    8886
    89 - (void) applyTorrentLimitSetting: (id) sender;
    90 - (void) setTorrentLimit: (id) sender;
    91 
    9287- (void) setSpeedLimit: (id) sender;
    9388- (void) setAutoSpeedLimit: (id) sender;
  • trunk/macosx/PrefsController.m

    r1305 r1317  
    142142    [self updateLimitFields];
    143143   
    144     //set torrent limits
    145     [fUploadTorrentField setIntValue: [fDefaults integerForKey: @"UploadLimitTorrent"]];
    146     [fDownloadTorrentField setIntValue: [fDefaults integerForKey: @"DownloadLimitTorrent"]];
    147    
    148144    //set speed limit
    149145    [fSpeedLimitUploadField setIntValue: [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
     
    393389}
    394390
    395 - (void) applyTorrentLimitSetting: (id) sender
    396 {
    397     [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSpeedSetting" object: self];
    398 }
    399 
    400 - (void) setTorrentLimit: (id) sender
    401 {
    402     BOOL upload = sender == fUploadTorrentField;
    403    
    404     int limit = [sender intValue];
    405     if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0)
    406     {
    407         NSBeep();
    408         [sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"]];
    409         return;
    410     }
    411    
    412     [fDefaults setInteger: limit forKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"];
    413    
    414     [self applyTorrentLimitSetting: self];
    415 }
    416 
    417391- (void) setSpeedLimit: (id) sender
    418392{
  • trunk/macosx/Torrent.h

    r1295 r1317  
    102102- (BOOL)    customLimitSetting;
    103103- (void)    setCustomLimitSetting: (BOOL) setting;
    104 - (void)    updateSpeedSetting: (NSNotification *) notification;
     104- (void)    updateSpeedSetting;
    105105
    106106- (void) setWaitToStart: (BOOL) wait;
  • trunk/macosx/Torrent.m

    r1302 r1317  
    2626#import "StringAdditions.h"
    2727
     28#define DOWNLOAD_LIMIT_DEFAULT 50
     29#define UPLOAD_LIMIT_DEFAULT 20
     30
    2831#define BAR_HEIGHT 12.0
    2932
     
    172175    {
    173176        tr_torrentClose(fLib, fHandle);
    174        
    175         [[NSNotificationCenter defaultCenter] removeObserver: self];
    176177       
    177178        if (fDownloadFolder)
     
    546547{
    547548    fCheckUpload = limit;
    548     [self updateSpeedSetting: nil];
     549    [self updateSpeedSetting];
    549550}
    550551
     
    557558{
    558559    fUploadLimit = limit;
    559     [self updateSpeedSetting: nil];
     560    [self updateSpeedSetting];
    560561}
    561562
     
    568569{
    569570    fCheckDownload = limit;
    570     [self updateSpeedSetting: nil];
     571    [self updateSpeedSetting];
    571572}
    572573
     
    579580{
    580581    fDownloadLimit = limit;
    581     [self updateSpeedSetting: nil];
     582    [self updateSpeedSetting];
    582583}
    583584
     
    590591{
    591592    fLimitCustom = setting;
    592     [self updateSpeedSetting: nil];
    593 }
    594 
    595 - (void) updateSpeedSetting: (NSNotification *) notification
     593    [self updateSpeedSetting];
     594}
     595
     596- (void) updateSpeedSetting
    596597{
    597598    if (fLimitCustom)
     
    602603    else
    603604    {
    604         tr_setUploadLimit(fHandle, [fDefaults boolForKey: @"CheckUploadTorrent"]
    605                                         ? [fDefaults integerForKey: @"UploadLimitTorrent"] : -1);
    606         tr_setDownloadLimit(fHandle, [fDefaults boolForKey: @"CheckDownloadTorrent"]
    607                                         ? [fDefaults integerForKey: @"DownloadLimitTorrent"] : -1);
     605        tr_setUploadLimit(fHandle, -1);
     606        tr_setDownloadLimit(fHandle, -1);
    608607    }
    609608}
     
    11851184   
    11861185    fLimitCustom = limitCustom ? [limitCustom boolValue] : NO;
    1187     fCheckUpload = checkUpload ? [checkUpload boolValue] : [fDefaults boolForKey: @"CheckUploadTorrent"];
    1188     fUploadLimit = uploadLimit ? [uploadLimit intValue] : [fDefaults integerForKey: @"UploadLimitTorrent"];
    1189     fCheckDownload = checkDownload ? [checkDownload boolValue] : [fDefaults boolForKey: @"CheckDownloadTorrent"];
    1190     fDownloadLimit = downloadLimit ? [downloadLimit intValue] : [fDefaults integerForKey: @"DownloadLimitTorrent"];
    1191     [self updateSpeedSetting: nil];
     1186    fCheckUpload = checkUpload ? [checkUpload boolValue] : NO;
     1187    fUploadLimit = uploadLimit ? [uploadLimit intValue] : UPLOAD_LIMIT_DEFAULT;
     1188    fCheckDownload = checkDownload ? [checkDownload boolValue] : NO;
     1189    fDownloadLimit = downloadLimit ? [downloadLimit intValue] : DOWNLOAD_LIMIT_DEFAULT;
     1190    [self updateSpeedSetting];
    11921191   
    11931192    fWaitToStart = waitToStart ? [waitToStart boolValue] : [fDefaults boolForKey: @"AutoStartDownload"];
Note: See TracChangeset for help on using the changeset viewer.