1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 00:04:06 +00:00

#2846 Priority Selection in "Add" window

This commit is contained in:
Mitchell Livingston 2010-02-11 01:34:32 +00:00
parent e03ad192c7
commit 609527fbca
3 changed files with 254 additions and 19 deletions

View file

@ -33,7 +33,7 @@
IBOutlet NSImageView * fIconView, * fLocationImageView;
IBOutlet NSTextField * fNameField, * fStatusField, * fLocationField;
IBOutlet NSButton * fStartCheck, * fDeleteCheck;
IBOutlet NSPopUpButton * fGroupPopUp;
IBOutlet NSPopUpButton * fGroupPopUp, * fPriorityPopUp;
IBOutlet NSProgressIndicator * fVerifyIndicator;
IBOutlet FileOutlineController * fFileController;
@ -63,6 +63,8 @@
- (void) verifyLocalData: (id) sender;
- (void) changePriority: (id) sender;
- (void) updateStatusField: (NSNotification *) notification;
- (void) updateGroupMenu: (NSNotification *) notification;

View file

@ -32,6 +32,10 @@
#define UPDATE_SECONDS 1.0
#define POPUP_PRIORITY_HIGH 0
#define POPUP_PRIORITY_NORMAL 1
#define POPUP_PRIORITY_LOW 2
@interface AddWindowController (Private)
- (void) updateFiles;
@ -94,6 +98,16 @@
[self setGroupsMenu];
[fGroupPopUp selectItemWithTag: fGroupValue];
NSInteger priorityTag;
switch ([fTorrent priority])
{
case TR_PRI_HIGH: priorityTag = POPUP_PRIORITY_HIGH; break;
case TR_PRI_NORMAL: priorityTag = POPUP_PRIORITY_NORMAL; break;
case TR_PRI_LOW: priorityTag = POPUP_PRIORITY_LOW; break;
default: NSAssert1(NO, @"Unknown priority for adding torrent: %d", [fTorrent priority]);
}
[fPriorityPopUp selectItemWithTag: priorityTag];
[fStartCheck setState: [[NSUserDefaults standardUserDefaults] boolForKey: @"AutoStartDownload"] ? NSOnState : NSOffState];
[fDeleteCheck setState: fDeleteTorrent ? NSOnState : NSOffState];
@ -197,6 +211,19 @@
[self updateFiles];
}
- (void) changePriority: (id) sender
{
tr_priority_t priority;
switch ([sender tag])
{
case POPUP_PRIORITY_HIGH: priority = TR_PRI_HIGH; break;
case POPUP_PRIORITY_NORMAL: priority = TR_PRI_NORMAL; break;
case POPUP_PRIORITY_LOW: priority = TR_PRI_LOW; break;
default: NSAssert1(NO, @"Unknown priority tag for adding torrent: %d", [sender tag]);
}
[fTorrent setPriority: priority];
}
- (void) updateStatusField: (NSNotification *) notification
{
NSString * statusString = [NSString stringForFileSize: [fTorrent size]];

View file

@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="42"/>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -305,7 +305,7 @@
<object class="NSPopUpButton" id="711151157">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{275, 68}, {122, 26}}</string>
<string key="NSFrame">{{272, 88}, {125, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="693599709">
@ -337,7 +337,7 @@
<object class="NSTextField" id="224369214">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{225, 73}, {48, 17}}</string>
<string key="NSFrame">{{224, 94}, {48, 17}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="580409040">
@ -363,7 +363,7 @@
<object class="NSOutlineView" id="591175582">
<reference key="NSNextResponder" ref="488449190"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{357, 262}</string>
<string key="NSFrameSize">{357, 241}</string>
<reference key="NSSuperview" ref="488449190"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
@ -501,7 +501,7 @@
<int key="NSTableViewDraggingDestinationStyle">0</int>
</object>
</object>
<string key="NSFrame">{{1, 1}, {357, 262}}</string>
<string key="NSFrame">{{1, 1}, {357, 241}}</string>
<reference key="NSSuperview" ref="399642967"/>
<reference key="NSNextKeyView" ref="591175582"/>
<reference key="NSDocView" ref="591175582"/>
@ -511,11 +511,11 @@
<object class="NSScroller" id="467034168">
<reference key="NSNextResponder" ref="399642967"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{358, 1}, {15, 262}}</string>
<string key="NSFrame">{{358, 1}, {15, 241}}</string>
<reference key="NSSuperview" ref="399642967"/>
<reference key="NSTarget" ref="399642967"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.99619771863117867</double>
<double key="NSPercent">0.88163265306122451</double>
</object>
<object class="NSScroller" id="297541548">
<reference key="NSNextResponder" ref="399642967"/>
@ -528,7 +528,7 @@
<double key="NSPercent">0.95348829999999996</double>
</object>
</object>
<string key="NSFrame">{{20, 107}, {374, 264}}</string>
<string key="NSFrame">{{20, 128}, {374, 243}}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSNextKeyView" ref="488449190"/>
<int key="NSsFlags">18</int>
@ -565,7 +565,7 @@
<object class="NSButton" id="38073450">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{14, 64}, {146, 32}}</string>
<string key="NSFrame">{{14, 85}, {146, 32}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="37031308">
@ -586,11 +586,110 @@
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">1316</int>
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{162, 72}, {16, 16}}</string>
<string key="NSFrame">{{162, 94}, {16, 16}}</string>
<reference key="NSSuperview" ref="1006"/>
<int key="NSpiFlags">28936</int>
<double key="NSMaxValue">1</double>
</object>
<object class="NSTextField" id="485847244">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{216, 66}, {54, 17}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="387612783">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">272629760</int>
<string key="NSContents">Priority:</string>
<reference key="NSSupport" ref="728563564"/>
<reference key="NSControlView" ref="485847244"/>
<reference key="NSBackgroundColor" ref="729622418"/>
<reference key="NSTextColor" ref="932603584"/>
</object>
</object>
<object class="NSPopUpButton" id="1049508202">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{272, 60}, {125, 26}}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="664513336">
<int key="NSCellFlags">-2076049856</int>
<int key="NSCellFlags2">2048</int>
<reference key="NSSupport" ref="728563564"/>
<reference key="NSControlView" ref="1049508202"/>
<int key="NSButtonFlags">109199615</int>
<int key="NSButtonFlags2">1</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
<object class="NSMenuItem" key="NSMenuItem" id="914442461">
<reference key="NSMenu" ref="842244290"/>
<string key="NSTitle">Low</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<object class="NSCustomResource" key="NSImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">PriorityLow</string>
</object>
<object class="NSCustomResource" key="NSOnImage" id="104623380">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="362275358">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">_popUpItemAction:</string>
<int key="NSTag">2</int>
<reference key="NSTarget" ref="664513336"/>
</object>
<bool key="NSMenuItemRespectAlignment">YES</bool>
<object class="NSMenu" key="NSMenu" id="842244290">
<string key="NSTitle">OtherViews</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="434739017">
<reference key="NSMenu" ref="842244290"/>
<string key="NSTitle">High</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">PriorityHigh</string>
</object>
<reference key="NSOnImage" ref="104623380"/>
<reference key="NSMixedImage" ref="362275358"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="664513336"/>
</object>
<object class="NSMenuItem" id="347354464">
<reference key="NSMenu" ref="842244290"/>
<string key="NSTitle">Normal</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">PriorityNormal</string>
</object>
<reference key="NSOnImage" ref="104623380"/>
<reference key="NSMixedImage" ref="362275358"/>
<string key="NSAction">_popUpItemAction:</string>
<int key="NSTag">1</int>
<reference key="NSTarget" ref="664513336"/>
</object>
<reference ref="914442461"/>
</object>
</object>
<int key="NSSelectedIndex">2</int>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<bool key="NSAltersState">YES</bool>
<int key="NSArrowPosition">2</int>
</object>
</object>
</object>
<string key="NSFrameSize">{414, 493}</string>
<reference key="NSSuperview"/>
@ -759,6 +858,22 @@
</object>
<int key="connectionID">69</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">changePriority:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1049508202"/>
</object>
<int key="connectionID">98</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fPriorityPopUp</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1049508202"/>
</object>
<int key="connectionID">99</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -818,6 +933,8 @@
<reference ref="46983627"/>
<reference ref="38073450"/>
<reference ref="744550600"/>
<reference ref="485847244"/>
<reference ref="1049508202"/>
</object>
<reference key="parent" ref="1005"/>
</object>
@ -1114,6 +1231,64 @@
<reference key="object" ref="744550600"/>
<reference key="parent" ref="1006"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">84</int>
<reference key="object" ref="485847244"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="387612783"/>
</object>
<reference key="parent" ref="1006"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">85</int>
<reference key="object" ref="1049508202"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="664513336"/>
</object>
<reference key="parent" ref="1006"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">86</int>
<reference key="object" ref="664513336"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="842244290"/>
</object>
<reference key="parent" ref="1049508202"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">87</int>
<reference key="object" ref="842244290"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="914442461"/>
<reference ref="347354464"/>
<reference ref="434739017"/>
</object>
<reference key="parent" ref="664513336"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">88</int>
<reference key="object" ref="914442461"/>
<reference key="parent" ref="842244290"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">89</int>
<reference key="object" ref="347354464"/>
<reference key="parent" ref="842244290"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">90</int>
<reference key="object" ref="434739017"/>
<reference key="parent" ref="842244290"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">91</int>
<reference key="object" ref="387612783"/>
<reference key="parent" ref="485847244"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -1194,15 +1369,26 @@
<string>68.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>84.IBPluginDependency</string>
<string>84.ImportedFromIB2</string>
<string>85.IBPluginDependency</string>
<string>86.IBPluginDependency</string>
<string>87.IBEditorWindowLastContentRect</string>
<string>87.IBPluginDependency</string>
<string>87.editorWindowContentRectSynchronizationRect</string>
<string>88.IBPluginDependency</string>
<string>89.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
<string>9.ImportedFromIB2</string>
<string>90.IBPluginDependency</string>
<string>91.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{82, 425}, {414, 493}}</string>
<string>{{81, 433}, {414, 493}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{82, 425}, {414, 493}}</string>
<string>{{81, 433}, {414, 493}}</string>
<integer value="1"/>
<string>{196, 240}</string>
<string>{{186, 418}, {414, 493}}</string>
@ -1234,7 +1420,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{333, 417}, {173, 4}}</string>
<string>{{347, 528}, {122, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{465, 481}, {173, 33}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -1275,6 +1461,17 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{342, 456}, {125, 63}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{465, 481}, {173, 33}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@ -1293,7 +1490,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">69</int>
<int key="maxID">99</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -1307,6 +1504,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>add:</string>
<string>cancelAdd:</string>
<string>changePriority:</string>
<string>setDestination:</string>
<string>verifyLocalData:</string>
</object>
@ -1316,6 +1514,7 @@
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@ -1329,6 +1528,7 @@
<string>fLocationField</string>
<string>fLocationImageView</string>
<string>fNameField</string>
<string>fPriorityPopUp</string>
<string>fStartCheck</string>
<string>fStatusField</string>
<string>fVerifyIndicator</string>
@ -1342,6 +1542,7 @@
<string>NSTextField</string>
<string>NSImageView</string>
<string>NSTextField</string>
<string>NSPopUpButton</string>
<string>NSButton</string>
<string>NSTextField</string>
<string>NSProgressIndicator</string>
@ -1535,6 +1736,14 @@
<string key="minorKey">AppKit.framework/Headers/NSMenu.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSMenuItem</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="886244950">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSMenuItemCell</string>
<string key="superclassName">NSButtonCell</string>
@ -1969,10 +2178,7 @@
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string>
</object>
<reference key="sourceIdentifier" ref="886244950"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>