From 08935cff86f8d962ea04044c720fea6cfed5964c Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 26 May 2022 18:37:04 +0900 Subject: [PATCH 1/6] Detect exclusive fullscreen on Windows --- .../Sections/Graphics/LayoutSettings.cs | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 602ace6dea..981f5dbac3 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Framework.Platform; +using osu.Framework.Platform.Windows; using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -34,10 +35,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable sizeFullscreen; private readonly BindableList resolutions = new BindableList(new[] { new Size(9999, 9999) }); + private readonly IBindable fullscreenCapability = new Bindable(FullscreenCapability.Capable); [Resolved] private OsuGameBase game { get; set; } + [Resolved] + private GameHost host { get; set; } + private SettingsDropdown resolutionDropdown; private SettingsDropdown displayDropdown; private SettingsDropdown windowModeDropdown; @@ -65,6 +70,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics windowModes.BindTo(host.Window.SupportedWindowModes); } + if (host.Window is WindowsWindow windowsWindow) + fullscreenCapability.BindTo(windowsWindow.FullscreenCapability); + Children = new Drawable[] { windowModeDropdown = new SettingsDropdown @@ -139,6 +147,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } }, }; + + fullscreenCapability.BindValueChanged(_ => Schedule(updateScreenModeWarning), true); } protected override void LoadComplete() @@ -150,8 +160,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics windowModeDropdown.Current.BindValueChanged(mode => { updateDisplayModeDropdowns(); - - windowModeDropdown.WarningText = mode.NewValue != WindowMode.Fullscreen ? GraphicsSettingsStrings.NotFullscreenNote : default; + updateScreenModeWarning(); }, true); windowModes.BindCollectionChanged((sender, args) => @@ -213,6 +222,31 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } } + private void updateScreenModeWarning() + { + if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) + { + windowModeDropdown.WarningText = GraphicsSettingsStrings.NotFullscreenNote; + return; + } + + switch (fullscreenCapability.Value) + { + case FullscreenCapability.Unknown: + if (host.Window is WindowsWindow) + windowModeDropdown.WarningText = "Checking for exclusive fullscreen..."; + break; + + case FullscreenCapability.Capable: + windowModeDropdown.WarningText = default; + break; + + case FullscreenCapability.Incapable: + windowModeDropdown.WarningText = "Unable to enter exclusive fullscreen. You'll still experience some input latency."; + break; + } + } + private void bindPreviewEvent(Bindable bindable) { bindable.ValueChanged += _ => From dea7a27553a25caab9104b2a78fa2abc548ce6e1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 17:18:29 +0900 Subject: [PATCH 2/6] Adjust wording, add text for capable state --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 981f5dbac3..acbcdfcf76 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = "Checking for exclusive fullscreen..."; + windowModeDropdown.WarningText = "Checking for fullscreen capabilities..."; break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = default; + windowModeDropdown.WarningText = "osu! is running exclusive fullscreen, guaranteeing low latency!"; break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = "Unable to enter exclusive fullscreen. You'll still experience some input latency."; + windowModeDropdown.WarningText = "Unable to run exclusive fullscreen. You'll still experience some input latency."; break; } } From 5f9a69e5c2f060cbcc2143f53cc7938953a94509 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 30 May 2022 17:19:03 +0900 Subject: [PATCH 3/6] Add localisation --- .../Localisation/LayoutSettingsStrings.cs | 29 +++++++++++++++++++ .../Sections/Graphics/LayoutSettings.cs | 6 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Localisation/LayoutSettingsStrings.cs diff --git a/osu.Game/Localisation/LayoutSettingsStrings.cs b/osu.Game/Localisation/LayoutSettingsStrings.cs new file mode 100644 index 0000000000..5ac28f19b3 --- /dev/null +++ b/osu.Game/Localisation/LayoutSettingsStrings.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Localisation +{ + public static class LayoutSettingsStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.LayoutSettings"; + + /// + /// "Checking for fullscreen capabilities..." + /// + public static LocalisableString CheckingForFullscreenCapabilities => new TranslatableString(getKey(@"checking_for_fullscreen_capabilities"), @"Checking for fullscreen capabilities..."); + + /// + /// "osu! is running exclusive fullscreen, guaranteeing low latency!" + /// + public static LocalisableString OsuIsRunningExclusiveFullscreen => new TranslatableString(getKey(@"osu_is_running_exclusive_fullscreen"), @"osu! is running exclusive fullscreen, guaranteeing low latency!"); + + /// + /// "Unable to run exclusive fullscreen. You'll still experience some input latency." + /// + public static LocalisableString UnableToRunExclusiveFullscreen => new TranslatableString(getKey(@"unable_to_run_exclusive_fullscreen"), @"Unable to run exclusive fullscreen. You'll still experience some input latency."); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index acbcdfcf76..69a50c19b4 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = "Checking for fullscreen capabilities..."; + windowModeDropdown.WarningText = LayoutSettingsStrings.CheckingForFullscreenCapabilities; break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = "osu! is running exclusive fullscreen, guaranteeing low latency!"; + windowModeDropdown.WarningText = LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen; break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = "Unable to run exclusive fullscreen. You'll still experience some input latency."; + windowModeDropdown.WarningText = LayoutSettingsStrings.UnableToRunExclusiveFullscreen; break; } } From 53844d3df1548a1db0c31ebc6cd82b9b529655af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 14:01:42 +0900 Subject: [PATCH 4/6] Refactor settings item "warning" text to allow non-warning state --- .../Visual/Settings/TestSceneSettingsItem.cs | 19 +++++---- .../Sections/Graphics/LayoutSettings.cs | 8 ++-- .../Sections/Graphics/RendererSettings.cs | 11 +++++- .../Settings/Sections/Input/MouseSettings.cs | 4 +- .../Settings/Sections/Input/TabletSettings.cs | 5 ++- .../UserInterface/MainMenuSettings.cs | 5 ++- osu.Game/Overlays/Settings/SettingsItem.cs | 39 +++++++++++-------- .../Overlays/Settings/SettingsNoticeText.cs | 19 --------- 8 files changed, 57 insertions(+), 53 deletions(-) delete mode 100644 osu.Game/Overlays/Settings/SettingsNoticeText.cs diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index 83265e13ad..f631e1603b 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -83,7 +84,7 @@ namespace osu.Game.Tests.Visual.Settings AddStep("clear label", () => textBox.LabelText = default); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); - AddStep("set warning text", () => textBox.WarningText = "This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator..."); + AddStep("set warning text", () => textBox.SetWarningText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...")); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); } @@ -129,16 +130,18 @@ namespace osu.Game.Tests.Visual.Settings SettingsNumberBox numberBox = null; AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox()); - AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); + AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text", () => numberBox.WarningText = "this is a warning!"); - AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); + AddStep("set warning text", () => numberBox.SetWarningText("this is a warning!")); + AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("unset warning text", () => numberBox.WarningText = default); - AddAssert("warning text hidden", () => numberBox.ChildrenOfType().Single().Alpha == 0); + AddStep("unset warning text", () => numberBox.ClearWarningText()); + AddAssert("warning text hidden", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text again", () => numberBox.WarningText = "another warning!"); - AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); + AddStep("set warning text again", () => numberBox.SetWarningText("another warning!")); + AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); + + AddStep("set non warning text", () => numberBox.SetWarningText("you did good!", false)); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 69a50c19b4..1ebe5aa85e 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -226,7 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) { - windowModeDropdown.WarningText = GraphicsSettingsStrings.NotFullscreenNote; + windowModeDropdown.SetWarningText(GraphicsSettingsStrings.NotFullscreenNote); return; } @@ -234,15 +234,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { case FullscreenCapability.Unknown: if (host.Window is WindowsWindow) - windowModeDropdown.WarningText = LayoutSettingsStrings.CheckingForFullscreenCapabilities; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); break; case FullscreenCapability.Capable: - windowModeDropdown.WarningText = LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); break; case FullscreenCapability.Incapable: - windowModeDropdown.WarningText = LayoutSettingsStrings.UnableToRunExclusiveFullscreen; + windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); break; } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 653f30a018..6ec4decdda 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -48,7 +48,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics frameLimiterDropdown.Current.BindValueChanged(limit => { - frameLimiterDropdown.WarningText = limit.NewValue == FrameSync.Unlimited ? GraphicsSettingsStrings.UnlimitedFramesNote : default; + switch (limit.NewValue) + { + case FrameSync.Unlimited: + frameLimiterDropdown.SetWarningText(GraphicsSettingsStrings.UnlimitedFramesNote); + break; + + default: + frameLimiterDropdown.ClearWarningText(); + break; + } }, true); } } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 4235dc0a05..042cec106a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -117,9 +117,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows) { if (highPrecision.NewValue) - highPrecisionMouse.WarningText = MouseSettingsStrings.HighPrecisionPlatformWarning; + highPrecisionMouse.SetWarningText(MouseSettingsStrings.HighPrecisionPlatformWarning); else - highPrecisionMouse.WarningText = null; + highPrecisionMouse.ClearWarningText(); } }, true); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs index 802d442ced..5d31c38ae7 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs @@ -11,6 +11,7 @@ using osu.Framework.Localisation; using osu.Framework.Platform; using osu.Framework.Threading; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK; using osu.Game.Localisation; @@ -95,11 +96,13 @@ namespace osu.Game.Overlays.Settings.Sections.Input Origin = Anchor.TopCentre, Text = TabletSettingsStrings.NoTabletDetected, }, - new SettingsNoticeText(colours) + new LinkFlowContainer(cp => cp.Colour = colours.Yellow) { TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, }.With(t => { if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux) diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index 284e9cb2de..d3cc889abe 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -61,7 +61,10 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface user.BindValueChanged(u => { - backgroundSourceDropdown.WarningText = u.NewValue?.IsSupporter != true ? UserInterfaceStrings.NotSupporterNote : default; + if (u.NewValue?.IsSupporter != true) + backgroundSourceDropdown.SetWarningText(UserInterfaceStrings.NotSupporterNote); + else + backgroundSourceDropdown.ClearWarningText(); }, true); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index ee9daa1c0d..fa521c0126 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -70,27 +70,32 @@ namespace osu.Game.Overlays.Settings } /// - /// Text to be displayed at the bottom of this . + /// Clear any warning text. + /// + public void ClearWarningText() + { + warningText?.Expire(); + warningText = null; + } + + /// + /// Set the text to be displayed at the bottom of this . /// Generally used to recommend the user change their setting as the current one is considered sub-optimal. /// - public LocalisableString? WarningText + /// The text to display. + /// Whether the text is in a warning state. Will decide how this is visually represented. + public void SetWarningText(LocalisableString text, bool isWarning = true) { - set + ClearWarningText(); + + // construct lazily for cases where the label is not needed (may be provided by the Control). + FlowContent.Add(warningText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) { - bool hasValue = value != default; - - if (warningText == null) - { - if (!hasValue) - return; - - // construct lazily for cases where the label is not needed (may be provided by the Control). - FlowContent.Add(warningText = new SettingsNoticeText(colours) { Margin = new MarginPadding { Bottom = 5 } }); - } - - warningText.Alpha = hasValue ? 1 : 0; - warningText.Text = value ?? default; - } + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Margin = new MarginPadding { Bottom = 5 }, + Text = text, + }); } public virtual Bindable Current diff --git a/osu.Game/Overlays/Settings/SettingsNoticeText.cs b/osu.Game/Overlays/Settings/SettingsNoticeText.cs deleted file mode 100644 index 76ecf7edd4..0000000000 --- a/osu.Game/Overlays/Settings/SettingsNoticeText.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; - -namespace osu.Game.Overlays.Settings -{ - public class SettingsNoticeText : LinkFlowContainer - { - public SettingsNoticeText(OsuColour colours) - : base(s => s.Colour = colours.Yellow) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - } - } -} From f7110116de361f40e6c8aeb76b761eb250714c9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 May 2022 14:04:56 +0900 Subject: [PATCH 5/6] Only display exclusive fullscreen hinting on windows --- .../Sections/Graphics/LayoutSettings.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 1ebe5aa85e..53f84a9bb2 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -230,20 +230,27 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics return; } - switch (fullscreenCapability.Value) + if (host.Window is WindowsWindow) { - case FullscreenCapability.Unknown: - if (host.Window is WindowsWindow) + switch (fullscreenCapability.Value) + { + case FullscreenCapability.Unknown: windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); - break; + break; - case FullscreenCapability.Capable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); - break; + case FullscreenCapability.Capable: + windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); + break; - case FullscreenCapability.Incapable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); - break; + case FullscreenCapability.Incapable: + windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); + break; + } + } + else + { + // We can only detect exclusive fullscreen status on windows currently. + windowModeDropdown.ClearWarningText(); } } From 42598ce22aa7852054ce74771b685db186d434aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Jun 2022 16:51:34 +0900 Subject: [PATCH 6/6] Refactor `warning` to `notice` in method names and usages --- .../Visual/Settings/TestSceneSettingsItem.cs | 10 +++++----- .../Settings/Sections/Graphics/LayoutSettings.cs | 10 +++++----- .../Sections/Graphics/RendererSettings.cs | 4 ++-- .../Settings/Sections/Input/MouseSettings.cs | 4 ++-- .../Sections/UserInterface/MainMenuSettings.cs | 4 ++-- osu.Game/Overlays/Settings/SettingsItem.cs | 16 ++++++++-------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs index f631e1603b..3e679a7905 100644 --- a/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs +++ b/osu.Game.Tests/Visual/Settings/TestSceneSettingsItem.cs @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Settings AddStep("clear label", () => textBox.LabelText = default); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); - AddStep("set warning text", () => textBox.SetWarningText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...")); + AddStep("set warning text", () => textBox.SetNoticeText("This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...", true)); AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); } @@ -132,16 +132,16 @@ namespace osu.Game.Tests.Visual.Settings AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox()); AddAssert("warning text not created", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text", () => numberBox.SetWarningText("this is a warning!")); + AddStep("set warning text", () => numberBox.SetNoticeText("this is a warning!", true)); AddAssert("warning text created", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("unset warning text", () => numberBox.ClearWarningText()); + AddStep("unset warning text", () => numberBox.ClearNoticeText()); AddAssert("warning text hidden", () => !numberBox.ChildrenOfType().Any()); - AddStep("set warning text again", () => numberBox.SetWarningText("another warning!")); + AddStep("set warning text again", () => numberBox.SetNoticeText("another warning!", true)); AddAssert("warning text shown again", () => numberBox.ChildrenOfType().Single().Alpha == 1); - AddStep("set non warning text", () => numberBox.SetWarningText("you did good!", false)); + AddStep("set non warning text", () => numberBox.SetNoticeText("you did good!")); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 53f84a9bb2..d79ba593f7 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -226,7 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) { - windowModeDropdown.SetWarningText(GraphicsSettingsStrings.NotFullscreenNote); + windowModeDropdown.SetNoticeText(GraphicsSettingsStrings.NotFullscreenNote, true); return; } @@ -235,22 +235,22 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics switch (fullscreenCapability.Value) { case FullscreenCapability.Unknown: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.CheckingForFullscreenCapabilities, true); break; case FullscreenCapability.Capable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen); break; case FullscreenCapability.Incapable: - windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); + windowModeDropdown.SetNoticeText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen, true); break; } } else { // We can only detect exclusive fullscreen status on windows currently. - windowModeDropdown.ClearWarningText(); + windowModeDropdown.ClearNoticeText(); } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 6ec4decdda..8c3e45cd62 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -51,11 +51,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics switch (limit.NewValue) { case FrameSync.Unlimited: - frameLimiterDropdown.SetWarningText(GraphicsSettingsStrings.UnlimitedFramesNote); + frameLimiterDropdown.SetNoticeText(GraphicsSettingsStrings.UnlimitedFramesNote, true); break; default: - frameLimiterDropdown.ClearWarningText(); + frameLimiterDropdown.ClearNoticeText(); break; } }, true); diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 042cec106a..1511d53b6b 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -117,9 +117,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows) { if (highPrecision.NewValue) - highPrecisionMouse.SetWarningText(MouseSettingsStrings.HighPrecisionPlatformWarning); + highPrecisionMouse.SetNoticeText(MouseSettingsStrings.HighPrecisionPlatformWarning, true); else - highPrecisionMouse.ClearWarningText(); + highPrecisionMouse.ClearNoticeText(); } }, true); } diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index d3cc889abe..fceffa09c5 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -62,9 +62,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface user.BindValueChanged(u => { if (u.NewValue?.IsSupporter != true) - backgroundSourceDropdown.SetWarningText(UserInterfaceStrings.NotSupporterNote); + backgroundSourceDropdown.SetNoticeText(UserInterfaceStrings.NotSupporterNote, true); else - backgroundSourceDropdown.ClearWarningText(); + backgroundSourceDropdown.ClearNoticeText(); }, true); } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index fa521c0126..ea076b77ac 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings private SpriteText labelText; - private OsuTextFlowContainer warningText; + private OsuTextFlowContainer noticeText; public bool ShowsDefaultIndicator = true; private readonly Container defaultValueIndicatorContainer; @@ -72,24 +72,24 @@ namespace osu.Game.Overlays.Settings /// /// Clear any warning text. /// - public void ClearWarningText() + public void ClearNoticeText() { - warningText?.Expire(); - warningText = null; + noticeText?.Expire(); + noticeText = null; } /// /// Set the text to be displayed at the bottom of this . - /// Generally used to recommend the user change their setting as the current one is considered sub-optimal. + /// Generally used to provide feedback to a user about a sub-optimal setting. /// /// The text to display. /// Whether the text is in a warning state. Will decide how this is visually represented. - public void SetWarningText(LocalisableString text, bool isWarning = true) + public void SetNoticeText(LocalisableString text, bool isWarning = false) { - ClearWarningText(); + ClearNoticeText(); // construct lazily for cases where the label is not needed (may be provided by the Control). - FlowContent.Add(warningText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) + FlowContent.Add(noticeText = new LinkFlowContainer(cp => cp.Colour = isWarning ? colours.Yellow : colours.Green) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y,