allow the new limit checks to show a mixed state

This commit is contained in:
Mitchell Livingston 2009-03-05 01:23:19 +00:00
parent 852bbbe508
commit df9659ae8e
2 changed files with 64 additions and 59 deletions

View File

@ -541,19 +541,19 @@ typedef enum
|| downloadUseSpeedLimit != NSMixedState || downloadSpeedLimit != INVALID || downloadUseSpeedLimit != NSMixedState || downloadSpeedLimit != INVALID
|| globalUseSpeedLimit != NSMixedState)) || globalUseSpeedLimit != NSMixedState))
{ {
if (uploadUseSpeedLimit != INVALID && uploadUseSpeedLimit != ([torrent usesSpeedLimit: YES] ? NSOnState : NSOffState)) if (uploadUseSpeedLimit != NSMixedState && uploadUseSpeedLimit != ([torrent usesSpeedLimit: YES] ? NSOnState : NSOffState))
uploadUseSpeedLimit = NSMixedState; uploadUseSpeedLimit = NSMixedState;
if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES]) if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES])
uploadSpeedLimit = INVALID; uploadSpeedLimit = INVALID;
if (downloadUseSpeedLimit != INVALID && downloadUseSpeedLimit != ([torrent usesSpeedLimit: NO] ? NSOnState : NSOffState)) if (downloadUseSpeedLimit != NSMixedState && downloadUseSpeedLimit != ([torrent usesSpeedLimit: NO] ? NSOnState : NSOffState))
downloadUseSpeedLimit = NSMixedState; downloadUseSpeedLimit = NSMixedState;
if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO]) if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO])
downloadSpeedLimit = INVALID; downloadSpeedLimit = INVALID;
if (globalUseSpeedLimit != INVALID && globalUseSpeedLimit != ([torrent usesGlobalSpeedLimit] ? NSOnState : NSOffState)) if (globalUseSpeedLimit != NSMixedState && globalUseSpeedLimit != ([torrent usesGlobalSpeedLimit] ? NSOnState : NSOffState))
globalUseSpeedLimit = NSMixedState; globalUseSpeedLimit = NSMixedState;
} }
@ -1180,6 +1180,9 @@ typedef enum
- (void) setUseSpeedLimit: (id) sender - (void) setUseSpeedLimit: (id) sender
{ {
const BOOL upload = sender == fUploadLimitCheck; const BOOL upload = sender == fUploadLimitCheck;
if ([sender state] == NSMixedState)
[sender setState: NSOnState];
const BOOL limit = [sender state] == NSOnState; const BOOL limit = [sender state] == NSOnState;
for (Torrent * torrent in fTorrents) for (Torrent * torrent in fTorrents)
@ -1197,10 +1200,20 @@ typedef enum
[label setEnabled: limit]; [label setEnabled: limit];
} }
- (void) setUseGlobalSpeedLimit: (id) sender
{
if ([sender state] == NSMixedState)
[sender setState: NSOnState];
const BOOL limit = [sender state] == NSOnState;
for (Torrent * torrent in fTorrents)
[torrent setUseGlobalSpeedLimit: limit];
}
- (void) setSpeedLimit: (id) sender - (void) setSpeedLimit: (id) sender
{ {
BOOL upload = sender == fUploadLimitField; const BOOL upload = sender == fUploadLimitField;
NSInteger limit = [sender intValue]; const NSInteger limit = [sender intValue];
for (Torrent * torrent in fTorrents) for (Torrent * torrent in fTorrents)
[torrent setSpeedLimit: limit upload: upload]; [torrent setSpeedLimit: limit upload: upload];
@ -1237,14 +1250,6 @@ typedef enum
} }
} }
- (void) setUseGlobalSpeedLimit: (id) sender
{
const BOOL limit = [sender state] == NSOnState;
for (Torrent * torrent in fTorrents)
[torrent setUseGlobalSpeedLimit: limit];
}
- (void) setRatioLimit: (id) sender - (void) setRatioLimit: (id) sender
{ {
CGFloat limit = [sender floatValue]; CGFloat limit = [sender floatValue];

View File

@ -4387,7 +4387,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<reference key="NSControlView" ref="40458268"/> <reference key="NSControlView" ref="40458268"/>
<int key="NSButtonFlags">1211912703</int> <int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int> <int key="NSButtonFlags2">2</int>
<object class="NSButtonImageSource" key="NSAlternateImage" id="876504139"> <object class="NSButtonImageSource" key="NSAlternateImage" id="68311299">
<string key="NSImageName">NSSwitch</string> <string key="NSImageName">NSSwitch</string>
</object> </object>
<string key="NSAlternateContents"/> <string key="NSAlternateContents"/>
@ -4877,11 +4877,11 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<int key="NSKeyEquivModMask">1048576</int> <int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int> <int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int> <int key="NSState">1</int>
<object class="NSCustomResource" key="NSOnImage" id="132824476"> <object class="NSCustomResource" key="NSOnImage" id="1056605581">
<string key="NSClassName">NSImage</string> <string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string> <string key="NSResourceName">NSMenuCheckmark</string>
</object> </object>
<object class="NSCustomResource" key="NSMixedImage" id="109646542"> <object class="NSCustomResource" key="NSMixedImage" id="1011917088">
<string key="NSClassName">NSImage</string> <string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string> <string key="NSResourceName">NSMenuMixedState</string>
</object> </object>
@ -4902,8 +4902,8 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<string key="NSKeyEquiv"/> <string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int> <int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int> <int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="132824476"/> <reference key="NSOnImage" ref="1056605581"/>
<reference key="NSMixedImage" ref="109646542"/> <reference key="NSMixedImage" ref="1011917088"/>
<string key="NSAction">_popUpItemAction:</string> <string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="380288231"/> <reference key="NSTarget" ref="380288231"/>
</object> </object>
@ -4913,8 +4913,8 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<string key="NSKeyEquiv"/> <string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int> <int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int> <int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="132824476"/> <reference key="NSOnImage" ref="1056605581"/>
<reference key="NSMixedImage" ref="109646542"/> <reference key="NSMixedImage" ref="1011917088"/>
<string key="NSAction">_popUpItemAction:</string> <string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="380288231"/> <reference key="NSTarget" ref="380288231"/>
</object> </object>
@ -5052,69 +5052,69 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<reference key="NSTextColor" ref="534079857"/> <reference key="NSTextColor" ref="534079857"/>
</object> </object>
</object> </object>
<object class="NSButton" id="180242884"> <object class="NSButton" id="810746719">
<reference key="NSNextResponder" ref="1005910882"/> <reference key="NSNextResponder" ref="1005910882"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{76, 116}, {90, 18}}</string> <string key="NSFrame">{{76, 116}, {90, 18}}</string>
<reference key="NSSuperview" ref="1005910882"/> <reference key="NSSuperview" ref="1005910882"/>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="881855213"> <object class="NSButtonCell" key="NSCell" id="619542800">
<int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">131072</int> <int key="NSCellFlags2">16908288</int>
<string key="NSContents">Limit Upload</string> <string key="NSContents">Limit Upload</string>
<reference key="NSSupport" ref="26"/> <reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="180242884"/> <reference key="NSControlView" ref="810746719"/>
<int key="NSButtonFlags">1211912703</int> <int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">130</int> <int key="NSButtonFlags2">130</int>
<object class="NSCustomResource" key="NSNormalImage" id="538268923"> <object class="NSCustomResource" key="NSNormalImage" id="569323107">
<string key="NSClassName">NSImage</string> <string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string> <string key="NSResourceName">NSSwitch</string>
</object> </object>
<reference key="NSAlternateImage" ref="876504139"/> <reference key="NSAlternateImage" ref="68311299"/>
<string key="NSAlternateContents"/> <string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/> <string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int> <int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int> <int key="NSPeriodicInterval">25</int>
</object> </object>
</object> </object>
<object class="NSButton" id="798050396"> <object class="NSButton" id="768062986">
<reference key="NSNextResponder" ref="1005910882"/> <reference key="NSNextResponder" ref="1005910882"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{76, 96}, {224, 18}}</string> <string key="NSFrame">{{76, 96}, {224, 18}}</string>
<reference key="NSSuperview" ref="1005910882"/> <reference key="NSSuperview" ref="1005910882"/>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="873467762"> <object class="NSButtonCell" key="NSCell" id="44864906">
<int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">131072</int> <int key="NSCellFlags2">16908288</int>
<string key="NSContents">Stay within the global bandwidth limit</string> <string key="NSContents">Stay within the global bandwidth limit</string>
<reference key="NSSupport" ref="26"/> <reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="798050396"/> <reference key="NSControlView" ref="768062986"/>
<int key="NSButtonFlags">1211912703</int> <int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">130</int> <int key="NSButtonFlags2">130</int>
<reference key="NSNormalImage" ref="538268923"/> <reference key="NSNormalImage" ref="569323107"/>
<reference key="NSAlternateImage" ref="876504139"/> <reference key="NSAlternateImage" ref="68311299"/>
<string key="NSAlternateContents"/> <string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/> <string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int> <int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int> <int key="NSPeriodicInterval">25</int>
</object> </object>
</object> </object>
<object class="NSButton" id="556264839"> <object class="NSButton" id="1068855235">
<reference key="NSNextResponder" ref="1005910882"/> <reference key="NSNextResponder" ref="1005910882"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{76, 138}, {106, 18}}</string> <string key="NSFrame">{{76, 138}, {106, 18}}</string>
<reference key="NSSuperview" ref="1005910882"/> <reference key="NSSuperview" ref="1005910882"/>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="209993470"> <object class="NSButtonCell" key="NSCell" id="261385839">
<int key="NSCellFlags">-2080244224</int> <int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">131072</int> <int key="NSCellFlags2">16908288</int>
<string key="NSContents">Limit Download</string> <string key="NSContents">Limit Download</string>
<reference key="NSSupport" ref="26"/> <reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="556264839"/> <reference key="NSControlView" ref="1068855235"/>
<int key="NSButtonFlags">1211912703</int> <int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">130</int> <int key="NSButtonFlags2">130</int>
<reference key="NSNormalImage" ref="538268923"/> <reference key="NSNormalImage" ref="569323107"/>
<reference key="NSAlternateImage" ref="876504139"/> <reference key="NSAlternateImage" ref="68311299"/>
<string key="NSAlternateContents"/> <string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/> <string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int> <int key="NSPeriodicDelay">200</int>
@ -5860,7 +5860,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">fUploadLimitCheck</string> <string key="label">fUploadLimitCheck</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="180242884"/> <reference key="destination" ref="810746719"/>
</object> </object>
<int key="connectionID">1800</int> <int key="connectionID">1800</int>
</object> </object>
@ -5868,7 +5868,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">fDownloadLimitCheck</string> <string key="label">fDownloadLimitCheck</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="556264839"/> <reference key="destination" ref="1068855235"/>
</object> </object>
<int key="connectionID">1801</int> <int key="connectionID">1801</int>
</object> </object>
@ -5876,7 +5876,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">setUseSpeedLimit:</string> <string key="label">setUseSpeedLimit:</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="556264839"/> <reference key="destination" ref="1068855235"/>
</object> </object>
<int key="connectionID">1803</int> <int key="connectionID">1803</int>
</object> </object>
@ -5884,7 +5884,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">setUseSpeedLimit:</string> <string key="label">setUseSpeedLimit:</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="180242884"/> <reference key="destination" ref="810746719"/>
</object> </object>
<int key="connectionID">1804</int> <int key="connectionID">1804</int>
</object> </object>
@ -5892,7 +5892,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">fGlobalLimitCheck</string> <string key="label">fGlobalLimitCheck</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="798050396"/> <reference key="destination" ref="768062986"/>
</object> </object>
<int key="connectionID">1807</int> <int key="connectionID">1807</int>
</object> </object>
@ -5900,7 +5900,7 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">setUseGlobalSpeedLimit:</string> <string key="label">setUseGlobalSpeedLimit:</string>
<reference key="source" ref="1016287627"/> <reference key="source" ref="1016287627"/>
<reference key="destination" ref="798050396"/> <reference key="destination" ref="768062986"/>
</object> </object>
<int key="connectionID">1808</int> <int key="connectionID">1808</int>
</object> </object>
@ -6935,9 +6935,9 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
<reference ref="51607095"/> <reference ref="51607095"/>
<reference ref="924921889"/> <reference ref="924921889"/>
<reference ref="535987563"/> <reference ref="535987563"/>
<reference ref="180242884"/> <reference ref="810746719"/>
<reference ref="556264839"/> <reference ref="1068855235"/>
<reference ref="798050396"/> <reference ref="768062986"/>
</object> </object>
<reference key="parent" ref="261172737"/> <reference key="parent" ref="261172737"/>
<string key="objectName">Options</string> <string key="objectName">Options</string>
@ -8142,45 +8142,45 @@ zijOSc5pzorOqs66ztvO+88czzzPXc99z57Pvs/fz+/QANAg0EHQYdCC0KLQw9Dj0PPRFNE00VXRddGW
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1796</int> <int key="objectID">1796</int>
<reference key="object" ref="180242884"/> <reference key="object" ref="810746719"/>
<object class="NSMutableArray" key="children"> <object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="881855213"/> <reference ref="619542800"/>
</object> </object>
<reference key="parent" ref="1005910882"/> <reference key="parent" ref="1005910882"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1797</int> <int key="objectID">1797</int>
<reference key="object" ref="881855213"/> <reference key="object" ref="619542800"/>
<reference key="parent" ref="180242884"/> <reference key="parent" ref="810746719"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1798</int> <int key="objectID">1798</int>
<reference key="object" ref="556264839"/> <reference key="object" ref="1068855235"/>
<object class="NSMutableArray" key="children"> <object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="209993470"/> <reference ref="261385839"/>
</object> </object>
<reference key="parent" ref="1005910882"/> <reference key="parent" ref="1005910882"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1799</int> <int key="objectID">1799</int>
<reference key="object" ref="209993470"/> <reference key="object" ref="261385839"/>
<reference key="parent" ref="556264839"/> <reference key="parent" ref="1068855235"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1805</int> <int key="objectID">1805</int>
<reference key="object" ref="798050396"/> <reference key="object" ref="768062986"/>
<object class="NSMutableArray" key="children"> <object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="873467762"/> <reference ref="44864906"/>
</object> </object>
<reference key="parent" ref="1005910882"/> <reference key="parent" ref="1005910882"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">1806</int> <int key="objectID">1806</int>
<reference key="object" ref="873467762"/> <reference key="object" ref="44864906"/>
<reference key="parent" ref="798050396"/> <reference key="parent" ref="768062986"/>
</object> </object>
</object> </object>
</object> </object>