Refactor warning to notice in method names and usages

This commit is contained in:
Dean Herbert
2022-06-01 16:51:34 +09:00
parent f7110116de
commit 42598ce22a
6 changed files with 24 additions and 24 deletions

View File

@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Settings
AddStep("clear label", () => textBox.LabelText = default); AddStep("clear label", () => textBox.LabelText = default);
AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1)); 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)); 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()); AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox());
AddAssert("warning text not created", () => !numberBox.ChildrenOfType<LinkFlowContainer>().Any()); AddAssert("warning text not created", () => !numberBox.ChildrenOfType<LinkFlowContainer>().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<LinkFlowContainer>().Single().Alpha == 1); AddAssert("warning text created", () => numberBox.ChildrenOfType<LinkFlowContainer>().Single().Alpha == 1);
AddStep("unset warning text", () => numberBox.ClearWarningText()); AddStep("unset warning text", () => numberBox.ClearNoticeText());
AddAssert("warning text hidden", () => !numberBox.ChildrenOfType<LinkFlowContainer>().Any()); AddAssert("warning text hidden", () => !numberBox.ChildrenOfType<LinkFlowContainer>().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<LinkFlowContainer>().Single().Alpha == 1); AddAssert("warning text shown again", () => numberBox.ChildrenOfType<LinkFlowContainer>().Single().Alpha == 1);
AddStep("set non warning text", () => numberBox.SetWarningText("you did good!", false)); AddStep("set non warning text", () => numberBox.SetNoticeText("you did good!"));
} }
} }
} }

View File

@ -226,7 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
{ {
if (windowModeDropdown.Current.Value != WindowMode.Fullscreen) if (windowModeDropdown.Current.Value != WindowMode.Fullscreen)
{ {
windowModeDropdown.SetWarningText(GraphicsSettingsStrings.NotFullscreenNote); windowModeDropdown.SetNoticeText(GraphicsSettingsStrings.NotFullscreenNote, true);
return; return;
} }
@ -235,22 +235,22 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
switch (fullscreenCapability.Value) switch (fullscreenCapability.Value)
{ {
case FullscreenCapability.Unknown: case FullscreenCapability.Unknown:
windowModeDropdown.SetWarningText(LayoutSettingsStrings.CheckingForFullscreenCapabilities); windowModeDropdown.SetNoticeText(LayoutSettingsStrings.CheckingForFullscreenCapabilities, true);
break; break;
case FullscreenCapability.Capable: case FullscreenCapability.Capable:
windowModeDropdown.SetWarningText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen, false); windowModeDropdown.SetNoticeText(LayoutSettingsStrings.OsuIsRunningExclusiveFullscreen);
break; break;
case FullscreenCapability.Incapable: case FullscreenCapability.Incapable:
windowModeDropdown.SetWarningText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen); windowModeDropdown.SetNoticeText(LayoutSettingsStrings.UnableToRunExclusiveFullscreen, true);
break; break;
} }
} }
else else
{ {
// We can only detect exclusive fullscreen status on windows currently. // We can only detect exclusive fullscreen status on windows currently.
windowModeDropdown.ClearWarningText(); windowModeDropdown.ClearNoticeText();
} }
} }

View File

@ -51,11 +51,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
switch (limit.NewValue) switch (limit.NewValue)
{ {
case FrameSync.Unlimited: case FrameSync.Unlimited:
frameLimiterDropdown.SetWarningText(GraphicsSettingsStrings.UnlimitedFramesNote); frameLimiterDropdown.SetNoticeText(GraphicsSettingsStrings.UnlimitedFramesNote, true);
break; break;
default: default:
frameLimiterDropdown.ClearWarningText(); frameLimiterDropdown.ClearNoticeText();
break; break;
} }
}, true); }, true);

View File

@ -117,9 +117,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows) if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
{ {
if (highPrecision.NewValue) if (highPrecision.NewValue)
highPrecisionMouse.SetWarningText(MouseSettingsStrings.HighPrecisionPlatformWarning); highPrecisionMouse.SetNoticeText(MouseSettingsStrings.HighPrecisionPlatformWarning, true);
else else
highPrecisionMouse.ClearWarningText(); highPrecisionMouse.ClearNoticeText();
} }
}, true); }, true);
} }

View File

@ -62,9 +62,9 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
user.BindValueChanged(u => user.BindValueChanged(u =>
{ {
if (u.NewValue?.IsSupporter != true) if (u.NewValue?.IsSupporter != true)
backgroundSourceDropdown.SetWarningText(UserInterfaceStrings.NotSupporterNote); backgroundSourceDropdown.SetNoticeText(UserInterfaceStrings.NotSupporterNote, true);
else else
backgroundSourceDropdown.ClearWarningText(); backgroundSourceDropdown.ClearNoticeText();
}, true); }, true);
} }
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings
private SpriteText labelText; private SpriteText labelText;
private OsuTextFlowContainer warningText; private OsuTextFlowContainer noticeText;
public bool ShowsDefaultIndicator = true; public bool ShowsDefaultIndicator = true;
private readonly Container defaultValueIndicatorContainer; private readonly Container defaultValueIndicatorContainer;
@ -72,24 +72,24 @@ namespace osu.Game.Overlays.Settings
/// <summary> /// <summary>
/// Clear any warning text. /// Clear any warning text.
/// </summary> /// </summary>
public void ClearWarningText() public void ClearNoticeText()
{ {
warningText?.Expire(); noticeText?.Expire();
warningText = null; noticeText = null;
} }
/// <summary> /// <summary>
/// Set the text to be displayed at the bottom of this <see cref="SettingsItem{T}"/>. /// Set the text to be displayed at the bottom of this <see cref="SettingsItem{T}"/>.
/// 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.
/// </summary> /// </summary>
/// <param name="text">The text to display.</param> /// <param name="text">The text to display.</param>
/// <param name="isWarning">Whether the text is in a warning state. Will decide how this is visually represented.</param> /// <param name="isWarning">Whether the text is in a warning state. Will decide how this is visually represented.</param>
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). // 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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,