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:UITableViewStyleInsetGrouped];
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 setTitle:NSLocalizedString(@"RemoteFX", @"RemoteFX performance setting")];
105 [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_remotefx"]]];
111 [cell setTitle:NSLocalizedString(@"GFX", @"GFX performance setting")];
112 [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_gfx"]]];
118 [cell setTitle:NSLocalizedString(@"H264", @"H264 performance setting")];
119 [[cell toggle] setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_h264"]]];
125 [cell setTitle:NSLocalizedString(@"Desktop Background",
126 @"Desktop background performance setting")];
128 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_show_desktop"]]];
134 [cell setTitle:NSLocalizedString(@"Font Smoothing",
135 @"Font smoothing performance setting")];
137 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_font_smoothing"]]];
143 [cell setTitle:NSLocalizedString(@"Desktop Composition",
144 @"Desktop composition performance setting")];
146 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_desktop_composition"]]];
152 [cell setTitle:NSLocalizedString(@"Window contents while dragging",
153 @"Window Dragging performance setting")];
155 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_window_dragging"]]];
161 [cell setTitle:NSLocalizedString(@"Menu Animation",
162 @"Menu Animations performance setting")];
164 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_menu_animation"]]];
170 [cell setTitle:NSLocalizedString(@"Visual Styles", @"Use Themes performance setting")];
172 setOn:[_params boolForKeyPath:[
self keyPathForKey:@"perf_windows_themes"]]];
180 [[cell toggle] setTag:GET_TAG_FROM_PATH(indexPath)];
181 [[cell toggle] addTarget:self
182 action:@selector(togglePerformanceSetting:)
183 forControlEvents:UIControlEventValueChanged];
188#pragma mark Action Handlers
190- (void)togglePerformanceSetting:(
id)sender
192 UISwitch *valueSwitch = (UISwitch *)sender;
194 switch (valueSwitch.tag)
197 [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_remotefx"]];
201 [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_gfx"]];
205 [_params setBool:[valueSwitch isOn] forKeyPath:[self keyPathForKey:
@"perf_h264"]];
209 [_params setBool:[valueSwitch isOn]
210 forKeyPath:[self keyPathForKey:
@"perf_show_desktop"]];
214 [_params setBool:[valueSwitch isOn]
215 forKeyPath:[self keyPathForKey:
@"perf_font_smoothing"]];
219 [_params setBool:[valueSwitch isOn]
220 forKeyPath:[self keyPathForKey:
@"perf_desktop_composition"]];
224 [_params setBool:[valueSwitch isOn]
225 forKeyPath:[self keyPathForKey:
@"perf_window_dragging"]];
229 [_params setBool:[valueSwitch isOn]
230 forKeyPath:[self keyPathForKey:
@"perf_menu_animation"]];
234 [_params setBool:[valueSwitch isOn]
235 forKeyPath:[self keyPathForKey:
@"perf_windows_themes"]];