mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
bindings + formatters = trouble....revert to glue code for speed limit, torrent limit, and port fields in prefs...more to come later
This commit is contained in:
@@ -133,6 +133,17 @@
|
||||
else
|
||||
[fFolderPopUp selectItemAtIndex: DOWNLOAD_ASK];
|
||||
|
||||
//set torrent limits
|
||||
[fUploadTorrentField setIntValue: [fDefaults integerForKey: @"UploadLimitTorrent"]];
|
||||
[fDownloadTorrentField setIntValue: [fDefaults integerForKey: @"DownloadLimitTorrent"]];
|
||||
|
||||
//set speed limit
|
||||
[fSpeedLimitUploadField setIntValue: [fDefaults integerForKey: @"SpeedLimitUploadLimit"]];
|
||||
[fSpeedLimitDownloadField setIntValue: [fDefaults integerForKey: @"SpeedLimitDownloadLimit"]];
|
||||
|
||||
//set port
|
||||
[fPortField setIntValue: [fDefaults integerForKey: @"BindPort"]];
|
||||
|
||||
[self updatePortStatus];
|
||||
|
||||
fNatStatus = -1;
|
||||
@@ -220,6 +231,16 @@
|
||||
|
||||
- (void) setPort: (id) sender
|
||||
{
|
||||
int port = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", port]])
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: @"BindPort"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: port forKey: @"BindPort"];
|
||||
|
||||
tr_setBindPort(fHandle, [fDefaults integerForKey: @"BindPort"]);
|
||||
[self updateNatStatus];
|
||||
[self updatePortStatus];
|
||||
@@ -313,11 +334,45 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void) applyTorrentSpeedSetting: (id) sender
|
||||
- (void) applyTorrentLimitSetting: (id) sender
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSpeedSetting" object: self];
|
||||
}
|
||||
|
||||
- (void) setTorrentLimit: (id) sender
|
||||
{
|
||||
BOOL upload = sender == fUploadTorrentField;
|
||||
|
||||
int limit = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: limit forKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"];
|
||||
|
||||
[self applyTorrentLimitSetting: self];
|
||||
}
|
||||
|
||||
- (void) setSpeedLimit: (id) sender
|
||||
{
|
||||
BOOL upload = sender == fSpeedLimitUploadField;
|
||||
|
||||
int limit = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: limit forKey: upload ? @"SpeedLimitUploadLimit" : @"SpeedLimitDownloadLimit"];
|
||||
|
||||
[self applySpeedSettings: self];
|
||||
}
|
||||
|
||||
- (void) setAutoSpeedLimit: (id) sender
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"AutoSpeedLimitChange" object: self];
|
||||
|
||||
Reference in New Issue
Block a user