make setting code more dynamic

This commit is contained in:
Mitchell Livingston 2007-09-15 20:09:28 +00:00
parent 55111cd53d
commit 1502435758
4 changed files with 11 additions and 23 deletions

View File

@ -2113,7 +2113,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[self updateTorrentsInQueue];
[fInfoController updateInfoStats];
[fInfoController updateRatioForTorrent: torrent];
if ([fDefaults boolForKey: @"PlaySeedingSound"])
{

View File

@ -71,8 +71,6 @@
- (Torrent *) selectedTorrent;
- (void) updateInfoStats;
- (void) updateRatioForTorrent: (Torrent *) torrent;
- (void) setNextTab;
- (void) setPreviousTab;

View File

@ -108,11 +108,7 @@
//allow for update notifications
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self selector: @selector(updateInfoStats)
name: @"UpdateStats" object: nil];
[nc addObserver: self selector: @selector(updateInfoSettings)
name: @"UpdateSettings" object: nil];
[nc addObserver: self selector: @selector(updateInfoStats) name: @"UpdateStats" object: nil];
}
- (void) dealloc
@ -308,7 +304,7 @@
}
//update stats and settings
[self updateInfoSettings];
[self updateInfoStats];
[fPeerTable reloadData];
[fFileOutline deselectAll: nil];
@ -331,6 +327,8 @@
[self updateInfoGeneral];
else if ([ident isEqualToString: TAB_FILES_IDENT])
[self updateInfoFiles];
else if ([ident isEqualToString: TAB_OPTIONS_IDENT])
[self updateInfoSettings];
else;
}
@ -579,14 +577,15 @@
pexState = NSMixedState;
}
#warning change even when already active
[fPexCheck setEnabled: pexEnabled];
[fPexCheck setState: pexState];
[fPexCheck setToolTip: !pexEnabled ? NSLocalizedString(@"PEX can only be toggled on public torrents when paused.",
[fPexCheck setToolTip: !pexEnabled ? NSLocalizedString(@"PEX can only be toggled on paused public torrents.",
"Inspector -> pex check") : @""];
}
else
{
#warning move
[fUploadLimitPopUp setEnabled: NO];
[fUploadLimitPopUp selectItemAtIndex: -1];
[fUploadLimitField setHidden: YES];
@ -608,14 +607,6 @@
[fPexCheck setState: NSOffState];
[fPexCheck setToolTip: @""];
}
[self updateInfoStats];
}
- (void) updateRatioForTorrent: (Torrent *) torrent
{
if ([fTorrents containsObject: torrent])
[self updateInfoSettings];
}
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem

View File

@ -394,7 +394,7 @@
[fMenuTorrent setSpeedMode: mode upload: [sender menu] == fUploadMenu];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateStats" object: nil];
}
- (void) setQuickLimit: (id) sender
@ -403,7 +403,7 @@
[fMenuTorrent setSpeedMode: TR_SPEEDLIMIT_SINGLE upload: upload];
[fMenuTorrent setSpeedLimit: [[sender title] intValue] upload: upload];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateStats" object: nil];
}
- (void) setQuickRatioMode: (id) sender
@ -420,7 +420,7 @@
[fMenuTorrent setRatioSetting: mode];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateStats" object: nil];
}
- (void) setQuickRatio: (id) sender
@ -428,7 +428,7 @@
[fMenuTorrent setRatioSetting: NSOnState];
[fMenuTorrent setRatioLimit: [[sender title] floatValue]];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateSettings" object: nil];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateStats" object: nil];
}
- (void) checkFile: (id) sender