1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 19:53:23 +08:00

Rename spectator-specific settings to more generic (with backwards migration)

This commit is contained in:
Bartłomiej Dach 2023-09-18 14:46:24 +02:00
parent 27471ad170
commit 3bddf4bf9a
No known key found for this signature in database
6 changed files with 43 additions and 9 deletions

View File

@ -64,7 +64,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.Username, string.Empty); SetDefault(OsuSetting.Username, string.Empty);
SetDefault(OsuSetting.Token, string.Empty); SetDefault(OsuSetting.Token, string.Empty);
SetDefault(OsuSetting.AutomaticallyDownloadWhenSpectating, false); SetDefault(OsuSetting.AutomaticallyDownloadMissingBeatmaps, false);
SetDefault(OsuSetting.SavePassword, false).ValueChanged += enabled => SetDefault(OsuSetting.SavePassword, false).ValueChanged += enabled =>
{ {
@ -215,6 +215,12 @@ namespace osu.Game.Configuration
// migrations can be added here using a condition like: // migrations can be added here using a condition like:
// if (combined < 20220103) { performMigration() } // if (combined < 20220103) { performMigration() }
if (combined < 20230918)
{
#pragma warning disable CS0618 // Type or member is obsolete
SetValue(OsuSetting.AutomaticallyDownloadMissingBeatmaps, Get<OsuSetting>(OsuSetting.AutomaticallyDownloadWhenSpectating)); // can be removed 20240618
#pragma warning restore CS0618 // Type or member is obsolete
}
} }
public override TrackedSettings CreateTrackedSettings() public override TrackedSettings CreateTrackedSettings()
@ -383,13 +389,17 @@ namespace osu.Game.Configuration
EditorShowHitMarkers, EditorShowHitMarkers,
EditorAutoSeekOnPlacement, EditorAutoSeekOnPlacement,
DiscordRichPresence, DiscordRichPresence,
[Obsolete($"Use {nameof(AutomaticallyDownloadMissingBeatmaps)} instead.")] // can be removed 20240318
AutomaticallyDownloadWhenSpectating, AutomaticallyDownloadWhenSpectating,
ShowOnlineExplicitContent, ShowOnlineExplicitContent,
LastProcessedMetadataId, LastProcessedMetadataId,
SafeAreaConsiderations, SafeAreaConsiderations,
ComboColourNormalisationAmount, ComboColourNormalisationAmount,
ProfileCoverExpanded, ProfileCoverExpanded,
EditorLimitedDistanceSnap, EditorLimitedDistanceSnap,
ReplaySettingsOverlay ReplaySettingsOverlay,
AutomaticallyDownloadMissingBeatmaps,
} }
} }

View File

@ -33,7 +33,7 @@ namespace osu.Game.Database
private readonly APIBeatmapSet beatmapSetInfo; private readonly APIBeatmapSet beatmapSetInfo;
private readonly string beatmapHash; private readonly string beatmapHash;
private Bindable<bool> autodownloadConfig = null!; private Bindable<bool> autoDownloadConfig = null!;
private Bindable<bool> noVideoSetting = null!; private Bindable<bool> noVideoSetting = null!;
private BeatmapCardNano card = null!; private BeatmapCardNano card = null!;
@ -63,7 +63,7 @@ namespace osu.Game.Database
} }
}); });
autodownloadConfig = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating); autoDownloadConfig = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadMissingBeatmaps);
noVideoSetting = config.GetBindable<bool>(OsuSetting.PreferNoVideo); noVideoSetting = config.GetBindable<bool>(OsuSetting.PreferNoVideo);
Content.Add(card = new BeatmapCardNano(beatmapSetInfo)); Content.Add(card = new BeatmapCardNano(beatmapSetInfo));
@ -73,7 +73,7 @@ namespace osu.Game.Database
{ {
base.LoadComplete(); base.LoadComplete();
if (autodownloadConfig.Value) if (autoDownloadConfig.Value)
beatmapDownloader.Download(beatmapSetInfo, noVideoSetting.Value); beatmapDownloader.Download(beatmapSetInfo, noVideoSetting.Value);
} }

View File

@ -59,6 +59,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString AutomaticallyDownloadWhenSpectating => new TranslatableString(getKey(@"automatically_download_when_spectating"), @"Automatically download beatmaps when spectating"); public static LocalisableString AutomaticallyDownloadWhenSpectating => new TranslatableString(getKey(@"automatically_download_when_spectating"), @"Automatically download beatmaps when spectating");
/// <summary>
/// "Automatically download missing beatmaps"
/// </summary>
public static LocalisableString AutomaticallyDownloadMissingBeatmaps => new TranslatableString(getKey(@"automatically_download_missing_beatmaps"), @"Automatically download missing beatmaps");
/// <summary> /// <summary>
/// "Show explicit content in search results" /// "Show explicit content in search results"
/// </summary> /// </summary>

View File

@ -0,0 +1,19 @@
// 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 osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class WebSettingsStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.WebSettings";
/// <summary>
/// "Automatically download missing beatmaps"
/// </summary>
public static LocalisableString AutomaticallyDownloadMissingBeatmaps => new TranslatableString(getKey(@"automatically_download_missing_beatmaps"), @"Automatically download missing beatmaps");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -31,9 +31,9 @@ namespace osu.Game.Overlays.Settings.Sections.Online
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = OnlineSettingsStrings.AutomaticallyDownloadWhenSpectating, LabelText = OnlineSettingsStrings.AutomaticallyDownloadMissingBeatmaps,
Keywords = new[] { "spectator" }, Keywords = new[] { "spectator", "replay" },
Current = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating), Current = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadMissingBeatmaps),
}, },
new SettingsCheckbox new SettingsCheckbox
{ {

View File

@ -143,7 +143,7 @@ namespace osu.Game.Screens.Play
automaticDownload = new SettingsCheckbox automaticDownload = new SettingsCheckbox
{ {
LabelText = "Automatically download beatmaps", LabelText = "Automatically download beatmaps",
Current = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadWhenSpectating), Current = config.GetBindable<bool>(OsuSetting.AutomaticallyDownloadMissingBeatmaps),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },