Implement settings keywords

This commit is contained in:
Andrei Zavatski 2019-11-20 19:27:34 +03:00
parent a81c26577d
commit e820ddd3e8
10 changed files with 35 additions and 9 deletions

View File

@ -60,7 +60,10 @@ protected override void LoadComplete()
Children = new Drawable[]
{
dropdown = new AudioDeviceSettingsDropdown()
dropdown = new AudioDeviceSettingsDropdown
{
Keywords = new[] { "Speaker" }
}
};
updateItems();

View File

@ -22,6 +22,8 @@ private void load(AudioManager audio, OsuConfigManager config)
new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f },
new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f },
};
Keywords = new[] { "Sound" };
}
}
}

View File

@ -38,6 +38,7 @@ private void load(OsuConfigManager config)
{
LabelText = "Show health display even when you can't fail",
Bindable = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
Keywords = new[] { "bar" }
},
new SettingsCheckbox
{

View File

@ -18,7 +18,8 @@ private void load(OsuConfigManager config)
new SettingsCheckbox
{
LabelText = "Increase visibility of first object when visual impairment mods are enabled",
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility)
Bindable = config.GetBindable<bool>(OsuSetting.IncreaseFirstObjectVisibility),
Keywords = new[] { "Hidden", "Traceable" }
},
};
}

View File

@ -26,18 +26,21 @@ private void load(OsuConfigManager config)
{
LabelText = "Show converted beatmaps",
Bindable = config.GetBindable<bool>(OsuSetting.ShowConvertedBeatmaps),
Keywords = new[] { "Converts" }
},
new SettingsSlider<double, StarSlider>
{
LabelText = "Display beatmaps from",
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMinimum),
KeyboardStep = 0.1f
KeyboardStep = 0.1f,
Keywords = new[] { "Stars" }
},
new SettingsSlider<double, StarSlider>
{
LabelText = "up to",
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
KeyboardStep = 0.1f
KeyboardStep = 0.1f,
Keywords = new[] { "Stars" }
},
new SettingsEnumDropdown<RandomSelectAlgorithm>
{

View File

@ -75,12 +75,14 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, Osu
LabelText = "UI Scaling",
TransferValueOnCommit = true,
Bindable = osuConfig.GetBindable<float>(OsuSetting.UIScale),
KeyboardStep = 0.01f
KeyboardStep = 0.01f,
Keywords = new[] { "Scale" },
},
new SettingsEnumDropdown<ScalingMode>
{
LabelText = "Screen Scaling",
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
Keywords = new[] { "Scale" },
},
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
{

View File

@ -30,6 +30,8 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
Bindable = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
},
};
Keywords = new[] { "fps" };
}
}
}

View File

@ -27,12 +27,14 @@ private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
new SettingsCheckbox
{
LabelText = "Raw input",
Bindable = rawInputToggle
Bindable = rawInputToggle,
Keywords = new[] { "Speed" }
},
sensitivity = new SensitivitySetting
{
LabelText = "Cursor sensitivity",
Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity)
Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity),
Keywords = new[] { "Speed" }
},
new SettingsCheckbox
{

View File

@ -76,7 +76,12 @@ public virtual Bindable<T> Bindable
}
}
public virtual IEnumerable<string> FilterTerms => new[] { LabelText };
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { LabelText } : new List<string>(Keywords)
{
LabelText
}.ToArray();
public IEnumerable<string> Keywords { get; set; }
public bool MatchingFilter
{

View File

@ -21,7 +21,12 @@ public abstract class SettingsSubsection : FillFlowContainer, IHasFilterableChil
protected abstract string Header { get; }
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
public IEnumerable<string> FilterTerms => new[] { Header };
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { Header } : new List<string>(Keywords)
{
Header
}.ToArray();
public IEnumerable<string> Keywords { get; set; }
public bool MatchingFilter
{