mirror of
https://github.com/transmission/transmission
synced 2025-03-03 10:15:45 +00:00
remove bindings from the rest of the text fields, added back glue code
This commit is contained in:
parent
5c0230cfcb
commit
0cc6a306ac
6 changed files with 88 additions and 5 deletions
|
@ -1563,6 +1563,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fDefaults setInteger: [[sender title] intValue] forKey: [sender menu] == fUploadMenu ? @"UploadLimit" : @"DownloadLimit"];
|
||||
[fDefaults setBool: YES forKey: [sender menu] == fUploadMenu ? @"CheckUpload" : @"CheckDownload"];
|
||||
|
||||
[fPrefsController updateLimitFields];
|
||||
[fPrefsController applySpeedSettings: nil];
|
||||
}
|
||||
|
||||
|
@ -1570,6 +1571,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
[fDefaults setBool: YES forKey: @"RatioCheck"];
|
||||
[fDefaults setFloat: [[sender title] floatValue] forKey: @"RatioLimit"];
|
||||
|
||||
[fPrefsController updateRatioStopField];
|
||||
}
|
||||
|
||||
- (void) checkWaitingForStopped: (NSNotification *) notification
|
||||
|
|
4
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
4
macosx/English.lproj/PrefsWindow.nib/classes.nib
generated
|
@ -16,9 +16,11 @@
|
|||
setAutoSpeedLimit = id;
|
||||
setBadge = id;
|
||||
setDownloadLocation = id;
|
||||
setGlobalLimit = id;
|
||||
setNat = id;
|
||||
setPort = id;
|
||||
setQueueNumber = id;
|
||||
setRatioStop = id;
|
||||
setSound = id;
|
||||
setSpeedLimit = id;
|
||||
setTorrentLimit = id;
|
||||
|
@ -44,6 +46,8 @@
|
|||
fPortStatusField = NSTextField;
|
||||
fPortStatusImage = NSImageView;
|
||||
fPortStatusProgress = NSProgressIndicator;
|
||||
fQueueField = NSTextField;
|
||||
fRatioStopField = NSTextField;
|
||||
fSeedingSoundPopUp = NSPopUpButton;
|
||||
fSpeedLimitDownloadField = NSTextField;
|
||||
fSpeedLimitUploadField = NSTextField;
|
||||
|
|
6
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
6
macosx/English.lproj/PrefsWindow.nib/info.nib
generated
|
@ -7,11 +7,11 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>153</key>
|
||||
<string>290 411 571 335 0 0 1152 842 </string>
|
||||
<string>191 408 571 335 0 0 1152 842 </string>
|
||||
<key>28</key>
|
||||
<string>290 434 571 290 0 0 1152 842 </string>
|
||||
<key>41</key>
|
||||
<string>290 426 571 305 0 0 1152 842 </string>
|
||||
<string>151 440 571 305 0 0 1152 842 </string>
|
||||
<key>66</key>
|
||||
<string>290 507 571 144 0 0 1152 842 </string>
|
||||
</dict>
|
||||
|
@ -23,7 +23,7 @@
|
|||
</array>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>153</integer>
|
||||
<integer>41</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8L127</string>
|
||||
|
|
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/PrefsWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -32,12 +32,14 @@
|
|||
tr_handle_t * fHandle;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
BOOL hasLoaded;
|
||||
|
||||
NSToolbar * fToolbar;
|
||||
IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fNetworkView;
|
||||
|
||||
IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp,
|
||||
* fDownloadSoundPopUp, * fSeedingSoundPopUp;
|
||||
IBOutlet NSTextField * fRatioStopField, * fQueueField;
|
||||
|
||||
NSArray * fSounds;
|
||||
|
||||
|
@ -76,8 +78,14 @@
|
|||
- (void) setNat: (id) sender;
|
||||
- (void) updateNatStatus;
|
||||
|
||||
- (void) updateRatioStopField;
|
||||
- (void) setRatioStop: (id) sender;
|
||||
|
||||
- (void) applySpeedSettings: (id) sender;
|
||||
|
||||
- (void) updateLimitFields;
|
||||
- (void) setGlobalLimit: (id) sender;
|
||||
|
||||
- (void) applyTorrentLimitSetting: (id) sender;
|
||||
- (void) setTorrentLimit: (id) sender;
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@
|
|||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
hasLoaded = YES;
|
||||
|
||||
fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
|
||||
[fToolbar setDelegate: self];
|
||||
[fToolbar setAllowsUserCustomization: NO];
|
||||
|
@ -133,6 +135,12 @@
|
|||
else
|
||||
[fFolderPopUp selectItemAtIndex: DOWNLOAD_ASK];
|
||||
|
||||
//set stop ratio
|
||||
[self updateRatioStopField];
|
||||
|
||||
//set limits
|
||||
[self updateLimitFields];
|
||||
|
||||
//set torrent limits
|
||||
[fUploadTorrentField setIntValue: [fDefaults integerForKey: @"UploadLimitTorrent"]];
|
||||
[fDownloadTorrentField setIntValue: [fDefaults integerForKey: @"DownloadLimitTorrent"]];
|
||||
|
@ -150,7 +158,10 @@
|
|||
[self updateNatStatus];
|
||||
fNatStatusTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0 target: self
|
||||
selector: @selector(updateNatStatus) userInfo: nil repeats: YES];
|
||||
|
||||
|
||||
//set queue values
|
||||
[fQueueField setIntValue: [fDefaults integerForKey: @"QueueDownloadNumber"]];
|
||||
|
||||
//set update check
|
||||
NSString * updateCheck = [fDefaults stringForKey: @"UpdateCheck"];
|
||||
if ([updateCheck isEqualToString: @"Weekly"])
|
||||
|
@ -334,6 +345,53 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) updateRatioStopField
|
||||
{
|
||||
if (!hasLoaded)
|
||||
return;
|
||||
|
||||
[fRatioStopField setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
}
|
||||
|
||||
- (void) setRatioStop: (id) sender
|
||||
{
|
||||
float ratio = [sender floatValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%.2f", ratio]] || ratio < 0)
|
||||
{
|
||||
NSBeep();
|
||||
[sender setFloatValue: [fDefaults floatForKey: @"RatioLimit"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setFloat: ratio forKey: @"RatioLimit"];
|
||||
}
|
||||
|
||||
- (void) updateLimitFields
|
||||
{
|
||||
if (!hasLoaded)
|
||||
return;
|
||||
|
||||
[fUploadField setIntValue: [fDefaults integerForKey: @"UploadLimit"]];
|
||||
[fDownloadField setIntValue: [fDefaults integerForKey: @"DownloadLimit"]];
|
||||
}
|
||||
|
||||
- (void) setGlobalLimit: (id) sender
|
||||
{
|
||||
BOOL upload = sender == fUploadField;
|
||||
|
||||
int limit = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0)
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: limit forKey: upload ? @"UploadLimit" : @"DownloadLimit"];
|
||||
|
||||
[self applySpeedSettings: self];
|
||||
}
|
||||
|
||||
- (void) applyTorrentLimitSetting: (id) sender
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSpeedSetting" object: self];
|
||||
|
@ -344,7 +402,7 @@
|
|||
BOOL upload = sender == fUploadTorrentField;
|
||||
|
||||
int limit = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]])
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0)
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: upload ? @"UploadLimitTorrent" : @"DownloadLimitTorrent"]];
|
||||
|
@ -420,6 +478,16 @@
|
|||
|
||||
- (void) setQueueNumber: (id) sender
|
||||
{
|
||||
int limit = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", limit]] || limit < 0)
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: @"QueueDownloadNumber"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: limit forKey: @"QueueDownloadNumber"];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"GlobalStartSettingChange" object: self];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue