Merge pull request #8716 from LittleEndu/no-video-option

Implement "prefer no-video" option
This commit is contained in:
Dean Herbert 2020-04-14 12:05:07 +09:00 committed by GitHub
commit a4792a572c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 11 deletions

View File

@ -149,8 +149,8 @@ namespace osu.Game.Tests.Visual.Online
public DownloadState DownloadState => State.Value; public DownloadState DownloadState => State.Value;
public TestDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) public TestDownloadButton(BeatmapSetInfo beatmapSet)
: base(beatmapSet, noVideo) : base(beatmapSet)
{ {
} }
} }

View File

@ -49,6 +49,7 @@ namespace osu.Game.Configuration
}; };
Set(OsuSetting.ExternalLinkWarning, true); Set(OsuSetting.ExternalLinkWarning, true);
Set(OsuSetting.PreferNoVideo, false);
// Audio // Audio
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01); Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
@ -214,6 +215,7 @@ namespace osu.Game.Configuration
IncreaseFirstObjectVisibility, IncreaseFirstObjectVisibility,
ScoreDisplayMode, ScoreDisplayMode,
ExternalLinkWarning, ExternalLinkWarning,
PreferNoVideo,
Scaling, Scaling,
ScalingPositionX, ScalingPositionX,
ScalingPositionY, ScalingPositionY,

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online; using osu.Game.Online;
@ -16,8 +17,6 @@ namespace osu.Game.Overlays.Direct
{ {
protected bool DownloadEnabled => button.Enabled.Value; protected bool DownloadEnabled => button.Enabled.Value;
private readonly bool noVideo;
/// <summary> /// <summary>
/// Currently selected beatmap. Used to present the correct difficulty after completing a download. /// Currently selected beatmap. Used to present the correct difficulty after completing a download.
/// </summary> /// </summary>
@ -25,12 +24,11 @@ namespace osu.Game.Overlays.Direct
private readonly ShakeContainer shakeContainer; private readonly ShakeContainer shakeContainer;
private readonly DownloadButton button; private readonly DownloadButton button;
private Bindable<bool> noVideoSetting;
public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) public PanelDownloadButton(BeatmapSetInfo beatmapSet)
: base(beatmapSet) : base(beatmapSet)
{ {
this.noVideo = noVideo;
InternalChild = shakeContainer = new ShakeContainer InternalChild = shakeContainer = new ShakeContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -50,7 +48,7 @@ namespace osu.Game.Overlays.Direct
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuGame game, BeatmapManager beatmaps) private void load(OsuGame game, BeatmapManager beatmaps, OsuConfigManager osuConfig)
{ {
if (BeatmapSet.Value?.OnlineInfo?.Availability?.DownloadDisabled ?? false) if (BeatmapSet.Value?.OnlineInfo?.Availability?.DownloadDisabled ?? false)
{ {
@ -59,6 +57,8 @@ namespace osu.Game.Overlays.Direct
return; return;
} }
noVideoSetting = osuConfig.GetBindable<bool>(OsuSetting.PreferNoVideo);
button.Action = () => button.Action = () =>
{ {
switch (State.Value) switch (State.Value)
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Direct
break; break;
default: default:
beatmaps.Download(BeatmapSet.Value, noVideo); beatmaps.Download(BeatmapSet.Value, noVideoSetting.Value);
break; break;
} }
}; };

View File

@ -21,6 +21,12 @@ namespace osu.Game.Overlays.Settings.Sections.Online
LabelText = "Warn about opening external links", LabelText = "Warn about opening external links",
Bindable = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning) Bindable = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning)
}, },
new SettingsCheckbox
{
LabelText = "Prefer downloads without video",
Keywords = new[] { "no-video" },
Bindable = config.GetBindable<bool>(OsuSetting.PreferNoVideo)
},
}; };
} }
} }

View File

@ -212,8 +212,8 @@ namespace osu.Game.Screens.Multi
private class PlaylistDownloadButton : PanelDownloadButton private class PlaylistDownloadButton : PanelDownloadButton
{ {
public PlaylistDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) public PlaylistDownloadButton(BeatmapSetInfo beatmapSet)
: base(beatmapSet, noVideo) : base(beatmapSet)
{ {
Alpha = 0; Alpha = 0;
} }