Changeset 2826


Ignore:
Timestamp:
Aug 18, 2007, 12:53:28 AM (15 years ago)
Author:
livings124
Message:

add ratio settings to the individual torrent menu

Location:
trunk/macosx
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r2824 r2826  
    180180        },
    181181        {
    182             ACTIONS = {checkFile = id; setQuickLimit = id; setQuickLimitMode = id; };
     182            ACTIONS = {
     183                checkFile = id;
     184                setQuickLimit = id;
     185                setQuickLimitMode = id;
     186                setQuickRatio = id;
     187                setQuickRatioMode = id;
     188            };
    183189            CLASS = TorrentTableView;
    184190            LANGUAGE = ObjC;
     
    189195                fController = Controller;
    190196                fDownloadMenu = NSMenu;
     197                fRatioMenu = NSMenu;
    191198                fUploadMenu = NSMenu;
    192199            };
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r2825 r2826  
    3434        <key>IBOpenObjects</key>
    3535        <array>
     36                <integer>21</integer>
    3637                <integer>1936</integer>
    3738                <integer>29</integer>
    38                 <integer>21</integer>
    3939        </array>
    4040        <key>IBSystem Version</key>
  • trunk/macosx/Torrent.m

    r2824 r2826  
    522522}
    523523
     524#warning make enum
    524525- (int) ratioSetting
    525526{
  • trunk/macosx/TorrentTableView.h

    r2824 r2826  
    5353    NSDictionary * fSmallStatusAttributes;
    5454   
    55     IBOutlet NSMenu * fActionMenu, * fUploadMenu, * fDownloadMenu;
     55    IBOutlet NSMenu * fActionMenu, * fUploadMenu, * fDownloadMenu, * fRatioMenu;
    5656    Torrent * fMenuTorrent;
    5757}
     
    6464- (void) setQuickLimit: (id) sender;
    6565
     66- (void) setQuickRatioMode: (id) sender;
     67- (void) setQuickRatio: (id) sender;
     68
    6669- (void) checkFile: (id) sender;
    6770
  • trunk/macosx/TorrentTableView.m

    r2825 r2826  
    372372        item = [menu itemWithTag: ACTION_MENU_GLOBAL_TAG];
    373373        [item setState: mode == TR_SPEEDLIMIT_GLOBAL ? NSOnState : NSOffState];
     374       
     375        return;
     376    }
     377    else if (menu == fRatioMenu)
     378    {
     379        int mode = [fMenuTorrent ratioSetting];
     380       
     381        NSMenuItem * item = [menu itemWithTag: ACTION_MENU_LIMIT_TAG];
     382        [item setState: mode == NSOnState ? NSOnState : NSOffState];
     383        [item setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
     384                    "torrent action context menu -> ratio stop"), [fMenuTorrent ratioLimit]]];
     385       
     386        item = [menu itemWithTag: ACTION_MENU_UNLIMITED_TAG];
     387        [item setState: mode == NSOffState ? NSOnState : NSOffState];
     388       
     389        item = [menu itemWithTag: ACTION_MENU_GLOBAL_TAG];
     390        [item setState: mode == NSMixedState ? NSOnState : NSOffState];
    374391       
    375392        return;
     
    435452{
    436453    int tag = [sender tag];
    437     tr_speedlimit_t mode;
     454    int mode;
    438455    if (tag == ACTION_MENU_UNLIMITED_TAG)
    439456        mode = TR_SPEEDLIMIT_UNLIMITED;
     
    453470    [fMenuTorrent setSpeedMode: TR_SPEEDLIMIT_SINGLE upload: upload];
    454471    [fMenuTorrent setSpeedLimit: [[sender title] intValue] upload: upload];
     472   
     473    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
     474}
     475
     476- (void) setQuickRatioMode: (id) sender
     477
     478{
     479    int tag = [sender tag];
     480    int mode;
     481    if (tag == ACTION_MENU_UNLIMITED_TAG)
     482        mode = NSOffState;
     483    else if (tag == ACTION_MENU_LIMIT_TAG)
     484        mode = NSOnState;
     485    else
     486        mode = NSMixedState;
     487   
     488    [fMenuTorrent setRatioSetting: mode];
     489   
     490    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
     491}
     492
     493- (void) setQuickRatio: (id) sender
     494{
     495    [fMenuTorrent setRatioSetting: NSOnState];
     496    [fMenuTorrent setRatioLimit: [[sender title] floatValue]];
    455497   
    456498    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
Note: See TracChangeset for help on using the changeset viewer.