(iOS) Add a lable to the main settings menu to display whether a core has a custom config. For now, the labels wont update until you back out of the main settings menu.
This commit is contained in:
parent
1fa9fdc374
commit
68eefb7656
|
@ -152,9 +152,10 @@ static RASettingData* aspect_setting(config_file_t* config, NSString* label)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RASettingData* custom_action(NSString* action, id data)
|
static RASettingData* custom_action(NSString* action, NSString* value, id data)
|
||||||
{
|
{
|
||||||
RASettingData* result = [[RASettingData alloc] initWithType:CustomAction label:action name:nil];
|
RASettingData* result = [[RASettingData alloc] initWithType:CustomAction label:action name:nil];
|
||||||
|
result.value = value;
|
||||||
|
|
||||||
if (data != nil)
|
if (data != nil)
|
||||||
objc_setAssociatedObject(result, "USERDATA", data, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(result, "USERDATA", data, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
@ -186,8 +187,8 @@ static RASettingData* custom_action(NSString* action, id data)
|
||||||
|
|
||||||
NSArray* settings = [NSArray arrayWithObjects:
|
NSArray* settings = [NSArray arrayWithObjects:
|
||||||
[NSArray arrayWithObjects:@"Core",
|
[NSArray arrayWithObjects:@"Core",
|
||||||
custom_action(@"Core Info", nil),
|
custom_action(@"Core Info", nil, nil),
|
||||||
_module.hasCustomConfig ? custom_action(@"Delete Custom Config", nil) : nil,
|
_module.hasCustomConfig ? custom_action(@"Delete Custom Config", nil, nil) : nil,
|
||||||
nil],
|
nil],
|
||||||
|
|
||||||
[NSArray arrayWithObjects:@"Video",
|
[NSArray arrayWithObjects:@"Video",
|
||||||
|
@ -319,18 +320,17 @@ static RASettingData* custom_action(NSString* action, id data)
|
||||||
|
|
||||||
NSMutableArray* modules = [NSMutableArray array];
|
NSMutableArray* modules = [NSMutableArray array];
|
||||||
[modules addObject:@"Cores"];
|
[modules addObject:@"Cores"];
|
||||||
[modules addObject:custom_action(@"Global Core Config", nil)];
|
[modules addObject:custom_action(@"Global Core Config", nil, nil)];
|
||||||
|
|
||||||
NSArray* module_data = [RAModuleInfo getModules];
|
NSArray* moduleList = [RAModuleInfo getModules];
|
||||||
for (int i = 0; i != module_data.count; i ++)
|
for (RAModuleInfo* i in moduleList)
|
||||||
{
|
{
|
||||||
RAModuleInfo* info = (RAModuleInfo*)module_data[i];
|
[modules addObject:custom_action(i.displayName, i.hasCustomConfig ? @"[Custom]" : @"[Global]", i)];
|
||||||
[modules addObject:custom_action(info.displayName, info)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSArray* settings = [NSArray arrayWithObjects:
|
NSArray* settings = [NSArray arrayWithObjects:
|
||||||
[NSArray arrayWithObjects:@"Frontend",
|
[NSArray arrayWithObjects:@"Frontend",
|
||||||
custom_action(@"Diagnostic Log", nil),
|
custom_action(@"Diagnostic Log", nil, nil),
|
||||||
nil],
|
nil],
|
||||||
[NSArray arrayWithObjects:@"Bluetooth",
|
[NSArray arrayWithObjects:@"Bluetooth",
|
||||||
// TODO: Note that with this turned off the native bluetooth is expected to be a real keyboard
|
// TODO: Note that with this turned off the native bluetooth is expected to be a real keyboard
|
||||||
|
@ -564,11 +564,14 @@ static RASettingData* custom_action(NSString* action, id data)
|
||||||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cell.textLabel.text = setting.label;
|
||||||
|
|
||||||
UISwitch* swt = (UISwitch*)cell.accessoryView;
|
UISwitch* swt = (UISwitch*)cell.accessoryView;
|
||||||
swt.on = [setting.value isEqualToString:@"true"];
|
swt.on = [setting.value isEqualToString:@"true"];
|
||||||
objc_setAssociatedObject(swt, "SETTING", setting, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(swt, "SETTING", setting, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
|
||||||
|
return cell;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case RangeSetting:
|
case RangeSetting:
|
||||||
{
|
{
|
||||||
|
@ -586,50 +589,41 @@ static RASettingData* custom_action(NSString* action, id data)
|
||||||
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cell.textLabel.text = setting.label;
|
||||||
|
|
||||||
UISlider* sld = (UISlider*)cell.accessoryView;
|
UISlider* sld = (UISlider*)cell.accessoryView;
|
||||||
sld.minimumValue = setting.rangeMin;
|
sld.minimumValue = setting.rangeMin;
|
||||||
sld.maximumValue = setting.rangeMax;
|
sld.maximumValue = setting.rangeMax;
|
||||||
sld.value = [setting.value doubleValue];
|
sld.value = [setting.value doubleValue];
|
||||||
objc_setAssociatedObject(sld, "SETTING", setting, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(sld, "SETTING", setting, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
|
|
||||||
|
return cell;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EnumerationSetting:
|
default:
|
||||||
case FileListSetting:
|
|
||||||
case ButtonSetting:
|
|
||||||
case CustomAction:
|
|
||||||
case AspectSetting:
|
|
||||||
{
|
{
|
||||||
cell = [self.tableView dequeueReusableCellWithIdentifier:@"enumeration"];
|
cell = [self.tableView dequeueReusableCellWithIdentifier:@"default"];
|
||||||
cell = cell ? cell : [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"enumeration"];
|
|
||||||
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
if (!cell)
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GroupSetting:
|
|
||||||
{
|
|
||||||
cell = [self.tableView dequeueReusableCellWithIdentifier:@"group"];
|
|
||||||
|
|
||||||
if (cell == nil)
|
|
||||||
{
|
{
|
||||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"group"];
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"default"];
|
||||||
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
cell.textLabel.text = setting.label;
|
||||||
}
|
|
||||||
|
|
||||||
cell.textLabel.text = setting.label;
|
|
||||||
|
|
||||||
if (setting.type != ButtonSetting)
|
if (setting.type != ButtonSetting)
|
||||||
cell.detailTextLabel.text = setting.value;
|
cell.detailTextLabel.text = setting.value;
|
||||||
else
|
else
|
||||||
cell.detailTextLabel.text = [NSString stringWithFormat:@"[KB:%@] [JS:%@] [AX:%@]",
|
cell.detailTextLabel.text = [NSString stringWithFormat:@"[KB:%@] [JS:%@] [AX:%@]",
|
||||||
[setting.msubValues[0] length] ? setting.msubValues[0] : @"N/A",
|
[setting.msubValues[0] length] ? setting.msubValues[0] : @"N/A",
|
||||||
[setting.msubValues[1] length] ? setting.msubValues[1] : @"N/A",
|
[setting.msubValues[1] length] ? setting.msubValues[1] : @"N/A",
|
||||||
[setting.msubValues[2] length] ? setting.msubValues[2] : @"N/A"];
|
[setting.msubValues[2] length] ? setting.msubValues[2] : @"N/A"];
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue