Fix delete dialogs having generic "Caution" header text

Regressed in https://github.com/ppy/osu/pull/28363.
This commit is contained in:
Dean Herbert 2024-10-07 16:44:10 +09:00
parent cf66d40b00
commit 11fc811e2f
No known key found for this signature in database
13 changed files with 39 additions and 19 deletions

View File

@ -2,18 +2,16 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Editors.Components
{
public partial class DeleteRoundDialog : DangerousActionDialog
public partial class DeleteRoundDialog : DeletionDialog
{
public DeleteRoundDialog(TournamentRound round, Action action)
{
HeaderText = round.Name.Value.Length > 0 ? $@"Delete round ""{round.Name.Value}""?" : @"Delete unnamed round?";
Icon = FontAwesome.Solid.Trash;
DangerousAction = action;
}
}

View File

@ -2,20 +2,18 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Editors.Components
{
public partial class DeleteTeamDialog : DangerousActionDialog
public partial class DeleteTeamDialog : DeletionDialog
{
public DeleteTeamDialog(TournamentTeam team, Action action)
{
HeaderText = team.FullName.Value.Length > 0 ? $@"Delete team ""{team.FullName.Value}""?" :
team.Acronym.Value.Length > 0 ? $@"Delete team ""{team.Acronym.Value}""?" :
@"Delete unnamed team?";
Icon = FontAwesome.Solid.Trash;
DangerousAction = action;
}
}

View File

@ -8,7 +8,7 @@
namespace osu.Game.Collections
{
public partial class DeleteCollectionDialog : DangerousActionDialog
public partial class DeleteCollectionDialog : DeletionDialog
{
public DeleteCollectionDialog(Live<BeatmapCollection> collection, Action deleteAction)
{

View File

@ -12,7 +12,12 @@ public static class DialogStrings
/// <summary>
/// "Caution"
/// </summary>
public static LocalisableString Caution => new TranslatableString(getKey(@"header_text"), @"Caution");
public static LocalisableString CautionHeaderText => new TranslatableString(getKey(@"header_text"), @"Caution");
/// <summary>
/// "Are you sure you want to delete the following:"
/// </summary>
public static LocalisableString DeletionHeaderText => new TranslatableString(getKey(@"deletion_header_text"), @"Are you sure you want to delete the following:");
/// <summary>
/// "Yes. Go for it."

View File

@ -46,7 +46,7 @@ public partial class ExternalLinkDialog : PopupDialog
{
public ExternalLinkDialog(string url, Action openExternalLinkAction, Action copyExternalLinkAction)
{
HeaderText = DialogStrings.Caution;
HeaderText = DialogStrings.CautionHeaderText;
BodyText = $"Are you sure you want to open the following link in a web browser?\n\n{url}";
Icon = FontAwesome.Solid.ExclamationTriangle;

View File

@ -30,9 +30,9 @@ public abstract partial class DangerousActionDialog : PopupDialog
protected DangerousActionDialog()
{
HeaderText = DialogStrings.Caution;
HeaderText = DialogStrings.CautionHeaderText;
Icon = FontAwesome.Regular.TrashAlt;
Icon = FontAwesome.Solid.ExclamationTriangle;
Buttons = new PopupDialogButton[]
{

View File

@ -0,0 +1,20 @@
// 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.Graphics.Sprites;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Dialog
{
/// <summary>
/// A dialog which provides confirmation for deletion of something.
/// </summary>
public abstract partial class DeletionDialog : DangerousActionDialog
{
protected DeletionDialog()
{
HeaderText = DialogStrings.DeletionHeaderText;
Icon = FontAwesome.Solid.Trash;
}
}
}

View File

@ -7,7 +7,7 @@
namespace osu.Game.Overlays.Mods
{
public partial class DeleteModPresetDialog : DangerousActionDialog
public partial class DeleteModPresetDialog : DeletionDialog
{
public DeleteModPresetDialog(Live<ModPreset> modPreset)
{

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Overlays.Dialog;
@ -12,6 +13,7 @@ public partial class MassDeleteConfirmationDialog : DangerousActionDialog
public MassDeleteConfirmationDialog(Action deleteAction, LocalisableString deleteContent)
{
BodyText = deleteContent;
Icon = FontAwesome.Solid.Trash;
DangerousAction = deleteAction;
}
}

View File

@ -7,7 +7,7 @@
namespace osu.Game.Screens.Edit
{
public partial class DeleteDifficultyConfirmationDialog : DangerousActionDialog
public partial class DeleteDifficultyConfirmationDialog : DeletionDialog
{
public DeleteDifficultyConfirmationDialog(BeatmapInfo beatmapInfo, Action deleteAction)
{

View File

@ -7,7 +7,7 @@
namespace osu.Game.Screens.Select
{
public partial class BeatmapDeleteDialog : DangerousActionDialog
public partial class BeatmapDeleteDialog : DeletionDialog
{
private readonly BeatmapSetInfo beatmapSet;

View File

@ -4,11 +4,10 @@
using osu.Framework.Allocation;
using osu.Game.Overlays.Dialog;
using osu.Game.Scoring;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Screens.Select
{
public partial class LocalScoreDeleteDialog : DangerousActionDialog
public partial class LocalScoreDeleteDialog : DeletionDialog
{
private readonly ScoreInfo score;
@ -21,8 +20,6 @@ public LocalScoreDeleteDialog(ScoreInfo score)
private void load(ScoreManager scoreManager)
{
BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})";
Icon = FontAwesome.Regular.TrashAlt;
DangerousAction = () => scoreManager.Delete(score);
}
}

View File

@ -7,7 +7,7 @@
namespace osu.Game.Screens.Select
{
public partial class SkinDeleteDialog : DangerousActionDialog
public partial class SkinDeleteDialog : DeletionDialog
{
private readonly Skin skin;