mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
add ratio settings to the individual torrent menu
This commit is contained in:
parent
4bcc5fa687
commit
5c2f4e5fd1
6 changed files with 57 additions and 4 deletions
9
macosx/English.lproj/MainMenu.nib/classes.nib
generated
9
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -179,7 +179,13 @@
|
|||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{
|
||||
ACTIONS = {checkFile = id; setQuickLimit = id; setQuickLimitMode = id; };
|
||||
ACTIONS = {
|
||||
checkFile = id;
|
||||
setQuickLimit = id;
|
||||
setQuickLimitMode = id;
|
||||
setQuickRatio = id;
|
||||
setQuickRatioMode = id;
|
||||
};
|
||||
CLASS = TorrentTableView;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
|
@ -188,6 +194,7 @@
|
|||
fContextRow = NSMenu;
|
||||
fController = Controller;
|
||||
fDownloadMenu = NSMenu;
|
||||
fRatioMenu = NSMenu;
|
||||
fUploadMenu = NSMenu;
|
||||
};
|
||||
SUPERCLASS = NSTableView;
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -33,9 +33,9 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>21</integer>
|
||||
<integer>1936</integer>
|
||||
<integer>29</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8R4031</string>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -521,6 +521,7 @@ static int static_lastid = 0;
|
|||
return fStat->ratio;
|
||||
}
|
||||
|
||||
#warning make enum
|
||||
- (int) ratioSetting
|
||||
{
|
||||
return fRatioSetting;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
NSDictionary * fSmallStatusAttributes;
|
||||
|
||||
IBOutlet NSMenu * fActionMenu, * fUploadMenu, * fDownloadMenu;
|
||||
IBOutlet NSMenu * fActionMenu, * fUploadMenu, * fDownloadMenu, * fRatioMenu;
|
||||
Torrent * fMenuTorrent;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,9 @@
|
|||
- (void) setQuickLimitMode: (id) sender;
|
||||
- (void) setQuickLimit: (id) sender;
|
||||
|
||||
- (void) setQuickRatioMode: (id) sender;
|
||||
- (void) setQuickRatio: (id) sender;
|
||||
|
||||
- (void) checkFile: (id) sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -374,6 +374,23 @@
|
|||
|
||||
return;
|
||||
}
|
||||
else if (menu == fRatioMenu)
|
||||
{
|
||||
int mode = [fMenuTorrent ratioSetting];
|
||||
|
||||
NSMenuItem * item = [menu itemWithTag: ACTION_MENU_LIMIT_TAG];
|
||||
[item setState: mode == NSOnState ? NSOnState : NSOffState];
|
||||
[item setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
|
||||
"torrent action context menu -> ratio stop"), [fMenuTorrent ratioLimit]]];
|
||||
|
||||
item = [menu itemWithTag: ACTION_MENU_UNLIMITED_TAG];
|
||||
[item setState: mode == NSOffState ? NSOnState : NSOffState];
|
||||
|
||||
item = [menu itemWithTag: ACTION_MENU_GLOBAL_TAG];
|
||||
[item setState: mode == NSMixedState ? NSOnState : NSOffState];
|
||||
|
||||
return;
|
||||
}
|
||||
else if ((folderDict = [[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]] representedObject]))
|
||||
items = [[[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]] representedObject] objectForKey: @"Children"];
|
||||
else
|
||||
|
@ -434,7 +451,7 @@
|
|||
- (void) setQuickLimitMode: (id) sender
|
||||
{
|
||||
int tag = [sender tag];
|
||||
tr_speedlimit_t mode;
|
||||
int mode;
|
||||
if (tag == ACTION_MENU_UNLIMITED_TAG)
|
||||
mode = TR_SPEEDLIMIT_UNLIMITED;
|
||||
else if (tag == ACTION_MENU_LIMIT_TAG)
|
||||
|
@ -456,6 +473,31 @@
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
|
||||
}
|
||||
|
||||
- (void) setQuickRatioMode: (id) sender
|
||||
|
||||
{
|
||||
int tag = [sender tag];
|
||||
int mode;
|
||||
if (tag == ACTION_MENU_UNLIMITED_TAG)
|
||||
mode = NSOffState;
|
||||
else if (tag == ACTION_MENU_LIMIT_TAG)
|
||||
mode = NSOnState;
|
||||
else
|
||||
mode = NSMixedState;
|
||||
|
||||
[fMenuTorrent setRatioSetting: mode];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
|
||||
}
|
||||
|
||||
- (void) setQuickRatio: (id) sender
|
||||
{
|
||||
[fMenuTorrent setRatioSetting: NSOnState];
|
||||
[fMenuTorrent setRatioLimit: [[sender title] floatValue]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
|
||||
}
|
||||
|
||||
- (void) checkFile: (id) sender
|
||||
{
|
||||
#warning get working
|
||||
|
|
Loading…
Add table
Reference in a new issue