mirror of
https://github.com/transmission/transmission
synced 2024-12-26 17:47:37 +00:00
#3742 entering a blocklist URL should register while typing (and support undo) - boo for glue code replacing bindings!
This commit is contained in:
parent
35f3596db4
commit
d89cd601d1
3 changed files with 50 additions and 88 deletions
|
@ -45,6 +45,7 @@
|
|||
|
||||
IBOutlet NSTextField * fPeersGlobalField, * fPeersTorrentField,
|
||||
* fBlocklistURLField, * fBlocklistMessageField, * fBlocklistDateField;
|
||||
IBOutlet NSButton * fBlocklistButton;
|
||||
|
||||
PortChecker * fPortChecker;
|
||||
IBOutlet NSTextField * fPortField, * fPortStatusField;
|
||||
|
@ -90,6 +91,8 @@
|
|||
- (void) updateBlocklist: (id) sender;
|
||||
- (void) setBlocklistAutoUpdate: (id) sender;
|
||||
- (void) updateBlocklistFields;
|
||||
- (void) updateBlocklistURLField;
|
||||
- (void) updateBlocklistButton;
|
||||
|
||||
- (void) setAutoStartDownloads: (id) sender;
|
||||
|
||||
|
|
|
@ -215,10 +215,19 @@ tr_session * fHandle;
|
|||
[fStalledField setIntValue: [fDefaults integerForKey: @"StalledMinutes"]];
|
||||
|
||||
//set blocklist
|
||||
NSString * blocklistURL = [fDefaults stringForKey: @"BlocklistURL"];
|
||||
if (blocklistURL)
|
||||
[fBlocklistURLField setStringValue: blocklistURL];
|
||||
|
||||
[self updateBlocklistButton];
|
||||
[self updateBlocklistFields];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateBlocklistFields)
|
||||
name: @"BlocklistUpdated" object: nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateBlocklistURLField)
|
||||
name: NSControlTextDidChangeNotification object: fBlocklistURLField];
|
||||
|
||||
//set rpc port
|
||||
[fRPCPortField setIntValue: [fDefaults integerForKey: @"RPCPort"]];
|
||||
|
||||
|
@ -480,11 +489,8 @@ tr_session * fHandle;
|
|||
tr_blocklistSetEnabled(fHandle, [fDefaults boolForKey: @"BlocklistNew"]);
|
||||
|
||||
[[BlocklistScheduler scheduler] updateSchedule];
|
||||
}
|
||||
|
||||
- (void) setBlocklistURL: (id) sender
|
||||
{
|
||||
tr_blocklistSetURL(fHandle, [[fDefaults stringForKey: @"BlocklistURL"] UTF8String]);
|
||||
|
||||
[self updateBlocklistButton];
|
||||
}
|
||||
|
||||
- (void) updateBlocklist: (id) sender
|
||||
|
@ -541,6 +547,24 @@ tr_session * fHandle;
|
|||
NSLocalizedString(@"Last updated", "Prefs -> blocklist -> message"), updatedDateString]];
|
||||
}
|
||||
|
||||
- (void) updateBlocklistURLField
|
||||
{
|
||||
NSString * blocklistString = [fBlocklistURLField stringValue];
|
||||
|
||||
[fDefaults setObject: blocklistString forKey: @"BlocklistURL"];
|
||||
tr_blocklistSetURL(fHandle, [blocklistString UTF8String]);
|
||||
|
||||
[self updateBlocklistButton];
|
||||
}
|
||||
|
||||
- (void) updateBlocklistButton
|
||||
{
|
||||
NSString * blocklistString = [fDefaults objectForKey: @"BlocklistURL"];
|
||||
const BOOL enable = (blocklistString && ![blocklistString isEqualToString: @""])
|
||||
&& [fDefaults boolForKey: @"BlocklistNew"];
|
||||
[fBlocklistButton setEnabled: enable];
|
||||
}
|
||||
|
||||
- (void) setAutoStartDownloads: (id) sender
|
||||
{
|
||||
tr_sessionSetPaused(fHandle, ![fDefaults boolForKey: @"AutoStartDownload"]);
|
||||
|
@ -1159,6 +1183,8 @@ tr_session * fHandle;
|
|||
|
||||
//speed limit schedule times and day handled by bindings
|
||||
|
||||
[fBlocklistURLField setStringValue: blocklistURL];
|
||||
[self updateBlocklistButton];
|
||||
[self updateBlocklistFields];
|
||||
|
||||
//ratio limit enabled handled by bindings
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="1361"/>
|
||||
<integer value="256"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -434,7 +433,7 @@
|
|||
<string key="NSExtension">NSResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomView" id="314557528">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -1744,7 +1743,6 @@
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{542, 331}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<string key="NSClassName">NSView</string>
|
||||
<string key="NSExtension">NSResponder</string>
|
||||
</object>
|
||||
|
@ -3082,7 +3080,7 @@ AAABAAAAAQ</bytes>
|
|||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="1062646585">
|
||||
<int key="NSCellFlags">-1804468671</int>
|
||||
<int key="NSCellFlags2">272634880</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents"/>
|
||||
<reference key="NSSupport" ref="86725571"/>
|
||||
<reference key="NSControlView" ref="552496111"/>
|
||||
|
@ -4225,6 +4223,7 @@ AAABAAAAAQ</bytes>
|
|||
</object>
|
||||
<string key="NSFrame">{{1, 1}, {291, 76}}</string>
|
||||
<reference key="NSSuperview" ref="122119447"/>
|
||||
<reference key="NSNextKeyView" ref="173651346"/>
|
||||
<reference key="NSDocView" ref="173651346"/>
|
||||
<reference key="NSBGColor" ref="729660797"/>
|
||||
<int key="NScvFlags">4</int>
|
||||
|
@ -4251,6 +4250,7 @@ AAABAAAAAQ</bytes>
|
|||
</object>
|
||||
<string key="NSFrame">{{103, 96}, {308, 78}}</string>
|
||||
<reference key="NSSuperview" ref="810116101"/>
|
||||
<reference key="NSNextKeyView" ref="206862330"/>
|
||||
<int key="NSsFlags">18</int>
|
||||
<reference key="NSVScroller" ref="220703981"/>
|
||||
<reference key="NSHScroller" ref="383062716"/>
|
||||
|
@ -4369,12 +4369,6 @@ AAABAAAAAQ</bytes>
|
|||
<string key="NSExtension">NSResponder</string>
|
||||
</object>
|
||||
<object class="NSUserDefaultsController" id="356871564">
|
||||
<object class="NSMutableArray" key="NSDeclaredKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>BlocklistNew</string>
|
||||
<string>BlocklistNew.length</string>
|
||||
<string>BlocklistURL</string>
|
||||
</object>
|
||||
<bool key="NSSharedInstance">YES</bool>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="981493640">
|
||||
|
@ -7327,22 +7321,6 @@ AAABAAAAAQ</bytes>
|
|||
</object>
|
||||
<int key="connectionID">1989</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled: values.BlocklistNew</string>
|
||||
<reference key="source" ref="826556979"/>
|
||||
<reference key="destination" ref="356871564"/>
|
||||
<object class="NSNibBindingConnector" key="connector" id="2236">
|
||||
<reference key="NSSource" ref="826556979"/>
|
||||
<reference key="NSDestination" ref="356871564"/>
|
||||
<string key="NSLabel">enabled: values.BlocklistNew</string>
|
||||
<string key="NSBinding">enabled</string>
|
||||
<string key="NSKeyPath">values.BlocklistNew</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">1990</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled: values.BlocklistNew</string>
|
||||
|
@ -7400,64 +7378,12 @@ AAABAAAAAQ</bytes>
|
|||
<int key="connectionID">1994</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">setBlocklistURL:</string>
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">fBlocklistButton</string>
|
||||
<reference key="source" ref="511492310"/>
|
||||
<reference key="destination" ref="552496111"/>
|
||||
<reference key="destination" ref="826556979"/>
|
||||
</object>
|
||||
<int key="connectionID">1995</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">value: values.BlocklistURL</string>
|
||||
<reference key="source" ref="552496111"/>
|
||||
<reference key="destination" ref="356871564"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="552496111"/>
|
||||
<reference key="NSDestination" ref="356871564"/>
|
||||
<string key="NSLabel">value: values.BlocklistURL</string>
|
||||
<string key="NSBinding">value</string>
|
||||
<string key="NSKeyPath">values.BlocklistURL</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">1996</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled2: values.BlocklistURL</string>
|
||||
<reference key="source" ref="826556979"/>
|
||||
<reference key="destination" ref="356871564"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="826556979"/>
|
||||
<reference key="NSDestination" ref="356871564"/>
|
||||
<string key="NSLabel">enabled2: values.BlocklistURL</string>
|
||||
<string key="NSBinding">enabled2</string>
|
||||
<string key="NSKeyPath">values.BlocklistURL</string>
|
||||
<object class="NSDictionary" key="NSOptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSMultipleValuesPlaceholder</string>
|
||||
<string>NSNoSelectionPlaceholder</string>
|
||||
<string>NSNotApplicablePlaceholder</string>
|
||||
<string>NSNullPlaceholder</string>
|
||||
<string>NSValueTransformerName</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<string>NSIsNotNil</string>
|
||||
</object>
|
||||
</object>
|
||||
<reference key="NSPreviousConnector" ref="2236"/>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">2026</int>
|
||||
<int key="connectionID">2031</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
|
@ -11314,7 +11240,7 @@ AAABAAAAAQ</bytes>
|
|||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">2026</int>
|
||||
<int key="maxID">2031</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -11962,6 +11888,7 @@ AAABAAAAAQ</bytes>
|
|||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>fAutoSpeedDayTypePopUp</string>
|
||||
<string>fBandwidthView</string>
|
||||
<string>fBlocklistButton</string>
|
||||
<string>fBlocklistDateField</string>
|
||||
<string>fBlocklistMessageField</string>
|
||||
<string>fBlocklistURLField</string>
|
||||
|
@ -11999,6 +11926,7 @@ AAABAAAAAQ</bytes>
|
|||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSPopUpButton</string>
|
||||
<string>NSView</string>
|
||||
<string>NSButton</string>
|
||||
<string>NSTextField</string>
|
||||
<string>NSTextField</string>
|
||||
<string>NSTextField</string>
|
||||
|
@ -12039,6 +11967,7 @@ AAABAAAAAQ</bytes>
|
|||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>fAutoSpeedDayTypePopUp</string>
|
||||
<string>fBandwidthView</string>
|
||||
<string>fBlocklistButton</string>
|
||||
<string>fBlocklistDateField</string>
|
||||
<string>fBlocklistMessageField</string>
|
||||
<string>fBlocklistURLField</string>
|
||||
|
@ -12082,6 +12011,10 @@ AAABAAAAAQ</bytes>
|
|||
<string key="name">fBandwidthView</string>
|
||||
<string key="candidateClassName">NSView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">fBlocklistButton</string>
|
||||
<string key="candidateClassName">NSButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">fBlocklistDateField</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
|
|
Loading…
Reference in a new issue