mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +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:
parent
111fc849d0
commit
5c0230cfcb
6 changed files with 75 additions and 12 deletions
|
@ -78,8 +78,8 @@ char * tr_clientForId( uint8_t * id )
|
|||
}
|
||||
else if( !memcmp( &id[1], "BOW", 3 ) )
|
||||
{
|
||||
asprintf( &ret, "Bits on Wheels (%c%c)",
|
||||
id[5], id[6] );
|
||||
asprintf( &ret, "Bits on Wheels (%c%c%c)",
|
||||
id[4], id[5], id[6] );
|
||||
}
|
||||
else if( !memcmp( &id[1], "BR", 2 ) )
|
||||
{
|
||||
|
|
7
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
7
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
ACTIONS = {
|
||||
applySpeedSettings = id;
|
||||
applyTorrentSpeedSetting = id;
|
||||
applyTorrentLimitSetting = id;
|
||||
folderSheetShow = id;
|
||||
helpForNetwork = id;
|
||||
importFolderSheetShow = id;
|
||||
|
@ -20,6 +20,8 @@
|
|||
setPort = id;
|
||||
setQueueNumber = id;
|
||||
setSound = id;
|
||||
setSpeedLimit = id;
|
||||
setTorrentLimit = id;
|
||||
setUpdate = id;
|
||||
};
|
||||
CLASS = PrefsController;
|
||||
|
@ -29,6 +31,7 @@
|
|||
fDownloadCheck = NSButton;
|
||||
fDownloadField = NSTextField;
|
||||
fDownloadSoundPopUp = NSPopUpButton;
|
||||
fDownloadTorrentField = NSTextField;
|
||||
fFolderPopUp = NSPopUpButton;
|
||||
fGeneralView = NSView;
|
||||
fImportFolderPopUp = NSPopUpButton;
|
||||
|
@ -37,6 +40,7 @@
|
|||
fNatStatusField = NSTextField;
|
||||
fNatStatusImage = NSImageView;
|
||||
fNetworkView = NSView;
|
||||
fPortField = NSTextField;
|
||||
fPortStatusField = NSTextField;
|
||||
fPortStatusImage = NSImageView;
|
||||
fPortStatusProgress = NSProgressIndicator;
|
||||
|
@ -47,6 +51,7 @@
|
|||
fUpdatePopUp = NSPopUpButton;
|
||||
fUploadCheck = NSButton;
|
||||
fUploadField = NSTextField;
|
||||
fUploadTorrentField = NSTextField;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
|
|
6
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
6
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
|
@ -7,13 +7,13 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>153</key>
|
||||
<string>119 428 571 335 0 0 1152 842 </string>
|
||||
<string>290 411 571 335 0 0 1152 842 </string>
|
||||
<key>28</key>
|
||||
<string>99 386 571 290 0 0 1152 842 </string>
|
||||
<string>290 434 571 290 0 0 1152 842 </string>
|
||||
<key>41</key>
|
||||
<string>290 426 571 305 0 0 1152 842 </string>
|
||||
<key>66</key>
|
||||
<string>139 501 571 144 0 0 1152 842 </string>
|
||||
<string>290 507 571 144 0 0 1152 842 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
|
|
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -45,11 +45,11 @@
|
|||
IBOutlet NSPopUpButton * fUpdatePopUp;
|
||||
|
||||
IBOutlet NSTextField * fUploadField, * fDownloadField,
|
||||
* fUploadTorrentField, * fDownloadTorrentField,
|
||||
* fSpeedLimitUploadField, * fSpeedLimitDownloadField;
|
||||
IBOutlet NSButton * fUploadCheck, * fDownloadCheck;
|
||||
|
||||
IBOutlet NSTextField * fNatStatusField,
|
||||
* fPortStatusField;
|
||||
IBOutlet NSTextField * fPortField, * fNatStatusField, * fPortStatusField;
|
||||
IBOutlet NSButton * fNatCheck;
|
||||
IBOutlet NSImageView * fNatStatusImage, * fPortStatusImage;
|
||||
IBOutlet NSProgressIndicator * fPortStatusProgress;
|
||||
|
@ -76,10 +76,13 @@
|
|||
- (void) setNat: (id) sender;
|
||||
- (void) updateNatStatus;
|
||||
|
||||
- (void) setAutoSpeedLimit: (id) sender;
|
||||
|
||||
- (void) applySpeedSettings: (id) sender;
|
||||
- (void) applyTorrentSpeedSetting: (id) sender;
|
||||
|
||||
- (void) applyTorrentLimitSetting: (id) sender;
|
||||
- (void) setTorrentLimit: (id) sender;
|
||||
|
||||
- (void) setSpeedLimit: (id) sender;
|
||||
- (void) setAutoSpeedLimit: (id) sender;
|
||||
|
||||
- (void) setAutoImport: (id) sender;
|
||||
- (void) importFolderSheetShow: (id) sender;
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue