Simplify Keywords usage for SettingsSubsection

This commit is contained in:
Andrei Zavatski 2019-11-20 21:03:31 +03:00
parent f3d9abc84a
commit 6b3010535f
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
@ -12,6 +14,8 @@ public class VolumeSettings : SettingsSubsection
{
protected override string Header => "Volume";
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "Sound" });
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config)
{
@ -22,8 +26,6 @@ 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

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -12,6 +14,8 @@ public class RendererSettings : SettingsSubsection
{
protected override string Header => "Renderer";
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "FPS" });
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
{
@ -30,8 +34,6 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
Bindable = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
},
};
Keywords = new[] { "fps" };
}
}
}

View File

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