1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

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);
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<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);
AddStep("unset warning text", () => numberBox.ClearWarningText());
AddStep("unset warning text", () => numberBox.ClearNoticeText());
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);
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)
{
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();
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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
/// <summary>
/// Clear any warning text.
/// </summary>
public void ClearWarningText()
public void ClearNoticeText()
{
warningText?.Expire();
warningText = null;
noticeText?.Expire();
noticeText = null;
}
/// <summary>
/// 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>
/// <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>
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,