11#import "PerformanceEditorController.h" 
   12#import "ConnectionParams.h" 
   15@interface PerformanceEditorController (Private)
 
   16- (NSString *)keyPathForKey:(NSString *)key;
 
   23  return [
self initWithConnectionParams:params keyPath:nil];
 
   26- (id)initWithConnectionParams:(
ConnectionParams *)params keyPath:(NSString *)keyPath;
 
   28  self = [
super initWithStyle:UITableViewStyleGrouped];
 
   32    _params = [params retain];
 
   33    _keyPath = (keyPath != nil ? [keyPath retain] : nil);
 
   47  [
super viewDidUnload];
 
   51- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 
   56- (NSString *)keyPathForKey:(NSString *)key
 
   59    return [_keyPath stringByAppendingFormat:@".%@", key];
 
   71#pragma mark Table view data source 
   73- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
 
   79- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 
   85- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
 
   87  return NSLocalizedString(
@"Performance Settings",
 
   88                           @"'Performance Settings': performance settings header");
 
   92- (UITableViewCell *)tableView:(UITableView *)tableView
 
   93         cellForRowAtIndexPath:(NSIndexPath *)indexPath
 
   98  NSAssert(cell, 
@"Invalid cell");
 
  100  switch ([indexPath row])
 
  104      [[cell label] setText:NSLocalizedString(@"RemoteFX", @"RemoteFX performance setting")];
 
  105      [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_remotefx"]]];
 
  111      [[cell label] setText:NSLocalizedString(@"GFX", @"GFX performance setting")];
 
  112      [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_gfx"]]];
 
  118      [[cell label] setText:NSLocalizedString(@"H264", @"H264 performance setting")];
 
  119      [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_h264"]]];
 
  125      [[cell label] setText:NSLocalizedString(@"Desktop Background",
 
  126                                              @"Desktop background performance setting")];
 
  128          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_show_desktop"]]];
 
  134      [[cell label] setText:NSLocalizedString(@"Font Smoothing",
 
  135                                              @"Font smoothing performance setting")];
 
  137          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_font_smoothing"]]];
 
  143      [[cell label] setText:NSLocalizedString(@"Desktop Composition",
 
  144                                              @"Desktop composition performance setting")];
 
  146          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_desktop_composition"]]];
 
  152      [[cell label] setText:NSLocalizedString(@"Window contents while dragging",
 
  153                                              @"Window Dragging performance setting")];
 
  155          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_window_dragging"]]];
 
  161      [[cell label] setText:NSLocalizedString(@"Menu Animation",
 
  162                                              @"Menu Animations performance setting")];
 
  164          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_menu_animation"]]];
 
  171          setText:NSLocalizedString(@"Visual Styles", @"Use Themes performance setting")];
 
  173          setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_windows_themes"]]];
 
  181  [[cell toggle] setTag:GET_TAG_FROM_PATH(indexPath)];
 
  182  [[cell toggle] addTarget:self
 
  183                    action:@selector(togglePerformanceSetting:)
 
  184          forControlEvents:UIControlEventValueChanged];
 
  189#pragma mark Action Handlers 
  191- (void)togglePerformanceSetting:(
id)sender
 
  193  UISwitch *valueSwitch = (UISwitch *)sender;
 
  195  switch (valueSwitch.tag)
 
  198      [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_remotefx"]];
 
  202      [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_gfx"]];
 
  206      [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_h264"]];
 
  210      [_params setBool:[valueSwitch isOn]
 
  211            forKeyPath:[self keyPathForKey:
@"perf_show_desktop"]];
 
  215      [_params setBool:[valueSwitch isOn]
 
  216            forKeyPath:[self keyPathForKey:
@"perf_font_smoothing"]];
 
  220      [_params setBool:[valueSwitch isOn]
 
  221            forKeyPath:[self keyPathForKey:
@"perf_desktop_composition"]];
 
  225      [_params setBool:[valueSwitch isOn]
 
  226            forKeyPath:[self keyPathForKey:
@"perf_window_dragging"]];
 
  230      [_params setBool:[valueSwitch isOn]
 
  231            forKeyPath:[self keyPathForKey:
@"perf_menu_animation"]];
 
  235      [_params setBool:[valueSwitch isOn]
 
  236            forKeyPath:[self keyPathForKey:
@"perf_windows_themes"]];