Skip to content

Commit

Permalink
Rename the change handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Sep 13, 2024
1 parent 8586506 commit 7c94f24
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Beatmaps;

public partial class BeatmapLanguagesChangeHandlerTest : BaseChangeHandlerTest<BeatmapLanguagesChangeHandler>
public partial class BeatmapTranslationsChangeHandlerTest : BaseChangeHandlerTest<BeatmapTranslationsChangeHandler>
{
[Test]
public void TestAdd()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps;

public partial class BeatmapLanguagesChangeHandler : BeatmapListPropertyChangeHandler<CultureInfo>, IBeatmapLanguagesChangeHandler
public partial class BeatmapTranslationsChangeHandler : BeatmapListPropertyChangeHandler<CultureInfo>, IBeatmapTranslationsChangeHandler
{
public IBindableList<CultureInfo> Languages => Items;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps;

public interface IBeatmapLanguagesChangeHandler
public interface IBeatmapTranslationsChangeHandler
{
IBindableList<CultureInfo> Languages { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Component
public partial class CreateNewTranslationButton : IconButton, IHasPopover
{
[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

private readonly Bindable<CultureInfo?> currentLanguage = new();

Expand All @@ -33,9 +33,9 @@ public CreateNewTranslationButton()
if (newLanguage == null)
return;
if (!beatmapLanguagesChangeHandler.Languages.Contains(newLanguage))
if (!beatmapTranslationsChangeHandler.Languages.Contains(newLanguage))
{
beatmapLanguagesChangeHandler.Add(newLanguage);
beatmapTranslationsChangeHandler.Add(newLanguage);
}
// after selected the language, should always hide the popover.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Component
public partial class RemoveTranslationButton : IconButton
{
[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

[Resolved]
private IDialogOverlay dialogOverlay { get; set; } = null!;
Expand All @@ -27,17 +27,17 @@ public RemoveTranslationButton()
Icon = FontAwesome.Solid.Trash;
Action = () =>
{
if (beatmapLanguagesChangeHandler.IsLanguageContainsTranslation(currentLanguage.Value))
if (beatmapTranslationsChangeHandler.IsLanguageContainsTranslation(currentLanguage.Value))
{
dialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage.Value, isOk =>
{
if (isOk)
beatmapLanguagesChangeHandler.Remove(currentLanguage.Value);
beatmapTranslationsChangeHandler.Remove(currentLanguage.Value);
}));
}
else
{
beatmapLanguagesChangeHandler.Remove(currentLanguage.Value);
beatmapTranslationsChangeHandler.Remove(currentLanguage.Value);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class TranslationEditSection : Container, ITranslationInfoProvide
private readonly Bindable<CultureInfo?> currentLanguage = new();

[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

private readonly IBindableList<Lyric> bindableLyrics = new BindableList<Lyric>();

Expand Down Expand Up @@ -190,7 +190,7 @@ public TranslationEditSection()
[BackgroundDependencyLoader]
private void load(ILyricsProvider lyricsProvider, OverlayColourProvider colourProvider)
{
languageDropdown.ItemSource = beatmapLanguagesChangeHandler.Languages;
languageDropdown.ItemSource = beatmapTranslationsChangeHandler.Languages;

bindableLyrics.BindTo(lyricsProvider.BindableLyrics);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations;

public partial class TranslationScreen : BeatmapEditorRoundedScreen
{
[Cached(typeof(IBeatmapLanguagesChangeHandler))]
private readonly BeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler;
[Cached(typeof(IBeatmapTranslationsChangeHandler))]
private readonly BeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler;

[Cached(typeof(ILyricTranslationChangeHandler))]
private readonly LyricTranslationChangeHandler lyricTranslationChangeHandler;

public TranslationScreen()
: base(KaraokeBeatmapEditorScreenMode.Translation)
{
AddInternal(beatmapLanguagesChangeHandler = new BeatmapLanguagesChangeHandler());
AddInternal(beatmapTranslationsChangeHandler = new BeatmapTranslationsChangeHandler());
AddInternal(lyricTranslationChangeHandler = new LyricTranslationChangeHandler());
}

Expand Down

0 comments on commit 7c94f24

Please sign in to comment.