Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix delete dialogs having generic "Caution" header text #30133

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Collections/DeleteCollectionDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 6 additions & 1 deletion osu.Game/Localisation/DialogStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Online/Chat/ExternalLinkOpener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Overlays/Dialog/DangerousActionDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
{
Expand Down
20 changes: 20 additions & 0 deletions osu.Game/Overlays/Dialog/DeletionDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. 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;
}
}
}
2 changes: 1 addition & 1 deletion osu.Game/Overlays/Mods/DeleteModPresetDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace osu.Game.Overlays.Mods
{
public partial class DeleteModPresetDialog : DangerousActionDialog
public partial class DeleteModPresetDialog : DeletionDialog
{
public DeleteModPresetDialog(Live<ModPreset> modPreset)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -12,6 +13,7 @@ public partial class MassDeleteConfirmationDialog : DangerousActionDialog
public MassDeleteConfirmationDialog(Action deleteAction, LocalisableString deleteContent)
{
BodyText = deleteContent;
Icon = FontAwesome.Solid.Trash;
DangerousAction = deleteAction;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Select/BeatmapDeleteDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace osu.Game.Screens.Select
{
public partial class BeatmapDeleteDialog : DangerousActionDialog
public partial class BeatmapDeleteDialog : DeletionDialog
{
private readonly BeatmapSetInfo beatmapSet;

Expand Down
5 changes: 1 addition & 4 deletions osu.Game/Screens/Select/LocalScoreDeleteDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Select/SkinDeleteDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace osu.Game.Screens.Select
{
public partial class SkinDeleteDialog : DangerousActionDialog
public partial class SkinDeleteDialog : DeletionDialog
{
private readonly Skin skin;

Expand Down
Loading