Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
dotnet-version: 9.0.x

- name: Install wasm-tools
run: dotnet workload install wasm-tools
run: dotnet workload install wasm-tools-net9

- name: Build release
run: dotnet publish AudioCuesheetEditor --configuration Release --output release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
dotnet-version: 9.0.x

- name: Install wasm-tools
run: dotnet workload install wasm-tools
run: dotnet workload install wasm-tools-net9

- name: Build & Install
run: dotnet build
Expand Down
5 changes: 5 additions & 0 deletions AudioCuesheetEditor.End2EndTests/Models/DetailView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ internal async Task SelectTracksAsync(IEnumerable<int> trackTablePositions, Bool
}
}

internal async Task EditSelectedTracksModalAsync()
{
await _page.GetByRole(AriaRole.Button, new() { Name = "Edit selected tracks" }).ClickAsync();
}

internal async Task EditTracksModalAsync(string artist, string title, string end, IEnumerable<string> flagsToSelect)
{
await _page.GetByRole(AriaRole.Button, new() { Name = "Edit selected tracks" }).ClickAsync();
Expand Down
38 changes: 38 additions & 0 deletions AudioCuesheetEditor.End2EndTests/Models/ViewModes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//This file is part of AudioCuesheetEditor.

//AudioCuesheetEditor is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//AudioCuesheetEditor is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with Foobar. If not, see
//<http: //www.gnu.org/licenses />.
using Microsoft.Playwright;
using System.Text.RegularExpressions;

namespace AudioCuesheetEditor.End2EndTests.Models
{
internal partial class ViewModes(IPage page, bool mobile)
{
private readonly IPage _page = page;
private readonly bool _isMobile = mobile;

internal async Task SwitchView(string viewMode)
{
if (_isMobile)
{
await _page.GetByRole(AriaRole.Button).Filter(new() { HasTextRegex = ViewModeForward() }).Nth(4).ClickAsync();
}
await _page.GetByText(viewMode).ClickAsync();
}

[GeneratedRegex("^$")]
internal static partial Regex ViewModeForward();
}
}
6 changes: 6 additions & 0 deletions AudioCuesheetEditor.End2EndTests/Tests/Desktop/RecordTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class RecordTest : PlaywrightTestBase
public async Task Record_ShouldRecordTracks_WhenTracksAdded()
{
var recordView = new RecordView(TestPage);
var viewModes = new ViewModes(TestPage, DeviceName != null);
var detailView = new DetailView(TestPage, DeviceName != null);
await recordView.GotoAsync();
await recordView.StartRecordingAsync();
await recordView.AddRecordingTrackAsync("Test Track 1 Artist", "Test Track 1 Title");
Expand All @@ -34,6 +36,10 @@ public async Task Record_ShouldRecordTracks_WhenTracksAdded()
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 1 Title Clear" })).ToBeVisibleAsync();
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 2 Artist Clear" })).ToBeVisibleAsync();
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 2 Title Clear" })).ToBeVisibleAsync();
await viewModes.SwitchView("Detail view");
await detailView.SelectTracksAsync([1]);
await detailView.EditSelectedTracksModalAsync();
await Expect(TestPage.GetByRole(AriaRole.Checkbox, new() { Name = "Link to previous track" })).ToBeCheckedAsync();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class RecordTestSmartphone : PlaywrightTestBase
public async Task Record_ShouldRecordTracks_WhenTracksAdded()
{
var recordView = new RecordView(TestPage);
var viewModes = new ViewModes(TestPage, DeviceName != null);
var detailView = new DetailView(TestPage, DeviceName != null);
await recordView.GotoAsync();
await recordView.StartRecordingAsync();
await recordView.AddRecordingTrackAsync("Test Track 1 Artist", "Test Track 1 Title");
Expand All @@ -35,6 +37,10 @@ public async Task Record_ShouldRecordTracks_WhenTracksAdded()
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 1 Title Clear" })).ToBeVisibleAsync();
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 2 Artist Clear" })).ToBeVisibleAsync();
await Expect(TestPage.GetByRole(AriaRole.Cell, new() { Name = "Test Track 2 Title Clear" })).ToBeVisibleAsync();
await viewModes.SwitchView("Detail view");
await detailView.SelectTracksAsync([1]);
await detailView.EditSelectedTracksModalAsync();
await Expect(TestPage.GetByRole(AriaRole.Checkbox, new() { Name = "Link to previous track" })).ToBeCheckedAsync();
}
}
}
7 changes: 3 additions & 4 deletions AudioCuesheetEditor/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ along with Foobar. If not, see
@inherits BaseLocalizedComponent

@inject IStringLocalizer<Index> _localizer
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

<CascadingValue Value="currentViewmode">
<MudTabs Rounded ApplyEffectsToContainer Outlined Color="Color.Success" ActivePanelIndex="(int)currentViewmode" ActivePanelIndexChanged="this.AsNonRenderingEventHandler<int>(ActiveTabIndexChanged)">
Expand All @@ -44,17 +43,17 @@ along with Foobar. If not, see
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
options = await _localStorageOptionsProvider.GetOptionsAsync<ViewOptions>();
options = await base.LocalStorageOptionsProvider.GetOptionsAsync<ViewOptions>();
currentViewmode = options.ActiveTab;
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ along with Foobar. If not, see
@inject ISessionStateContainer _sessionStateContainer
@inject IBlazorDownloadFileService _blazorDownloadFileService
@inject ValidationService _validationService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

<MudDialog>
<DialogContent>
Expand All @@ -42,14 +41,14 @@ along with Foobar. If not, see
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
options = await _localStorageOptionsProvider.GetOptionsAsync<DownloadOptions>();
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
options = await base.LocalStorageOptionsProvider.GetOptionsAsync<DownloadOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}

async Task DownloadProjectClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ along with Foobar. If not, see
@inject ValidationService _validationService
@inject IBlazorDownloadFileService _blazorDownloadFileService
@inject CuesheetExportService _cuesheetExportService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

<MudDialog>
<DialogContent>
Expand Down Expand Up @@ -64,15 +63,15 @@ along with Foobar. If not, see
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
options = await _localStorageOptionsProvider.GetOptionsAsync<DownloadOptions>();
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
options = await base.LocalStorageOptionsProvider.GetOptionsAsync<DownloadOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
exportfiles = _cuesheetExportService.GenerateExportfiles(options?.CuesheetFilename);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}

String? GetValidationErrorMessage()
Expand Down
1 change: 0 additions & 1 deletion AudioCuesheetEditor/Shared/Dialogs/SettingsDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ along with Foobar. If not, see

@inject IStringLocalizer<SettingsDialog> _localizer
@inject ValidationService _validationService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

<MudDialog>
<DialogContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ along with Foobar. If not, see
@inherits BaseLocalizedComponent

@inject IStringLocalizer<StartRecordCountdownDialog> _localizer
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

<MudDialog>
<TitleContent>
Expand All @@ -43,14 +42,14 @@ along with Foobar. If not, see
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
options = await _localStorageOptionsProvider.GetOptionsAsync<RecordOptions>();
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
options = await base.LocalStorageOptionsProvider.GetOptionsAsync<RecordOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}

void LocalStorageOptionsProvider_OptionSaved(object? sender, IOptions option)
Expand Down
7 changes: 3 additions & 4 deletions AudioCuesheetEditor/Shared/Import/Importprofiles.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ along with Foobar. If not, see
@inject IStringLocalizer<Importprofiles> _localizer
@inject ValidationService _validationService
@inject IDialogService _dialogService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider

@if (importOptions != null)
{
Expand Down Expand Up @@ -96,14 +95,14 @@ along with Foobar. If not, see
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
importOptions = await _localStorageOptionsProvider.GetOptionsAsync<ImportOptions>();
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
importOptions = await base.LocalStorageOptionsProvider.GetOptionsAsync<ImportOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}

void AppendPlaceholderToTextField(MudTextField<string>? mudTextField, string placeholder)
Expand Down
29 changes: 27 additions & 2 deletions AudioCuesheetEditor/Shared/Record/AddTrack.razor
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,31 @@ along with Foobar. If not, see
}
}

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
applicationOptions = await base.LocalStorageOptionsProvider.GetOptionsAsync<ApplicationOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
currentRecordingTrack = new()
{
IsLinkedToPreviousTrack = applicationOptions!.DefaultIsLinkedToPreviousTrack
};
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (Cuesheet != null)
{
Cuesheet.IsRecordingChanged -= Cuesheet_IsRecordingChanged;
}
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
}

Track currentRecordingTrack = new Track();
Track currentRecordingTrack = new();
MudAutocomplete<MusicBrainzArtist>? artistInput;
MudAutocomplete<MusicBrainzTrack>? titleInput;
ApplicationOptions? applicationOptions;

String? GetValidationErrorMessage(object model, string propertyName)
{
Expand All @@ -136,7 +149,10 @@ along with Foobar. If not, see
if (Cuesheet?.IsRecording == true)
{
Cuesheet?.AddTrack(currentRecordingTrack);
currentRecordingTrack = new();
currentRecordingTrack = new()
{
IsLinkedToPreviousTrack = applicationOptions!.DefaultIsLinkedToPreviousTrack
};
if (artistInput != null)
{
await artistInput.FocusAsync();
Expand All @@ -150,4 +166,13 @@ along with Foobar. If not, see
artistInput?.ClearAsync();
titleInput?.ClearAsync();
}

void LocalStorageOptionsProvider_OptionSaved(object? sender, IOptions option)
{
if (option is ApplicationOptions applicationOption)
{
applicationOptions = applicationOption;
StateHasChanged();
}
}
}
9 changes: 4 additions & 5 deletions AudioCuesheetEditor/Shared/TrackList/TrackList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ along with Foobar. If not, see
@inject AutocompleteManager _autocompleteManager
@inject DialogManager _editTrackModalManager
@inject ValidationService _validationService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider
@inject PlaybackService _playbackService
@inject IDialogService _dialogService
@inject ISessionStateContainer _sessionStateContainer
Expand All @@ -50,7 +49,7 @@ along with Foobar. If not, see
MoveTracksUpDisabled="!(Cuesheet?.MoveTracksPossible(selectedTracks, MoveDirection.Up) == true)" MoveTracksUpClicked="() => Cuesheet?.MoveTracks(selectedTracks, MoveDirection.Up)"
MoveTracksDownDisabled="!(Cuesheet?.MoveTracksPossible(selectedTracks, MoveDirection.Down) == true)" MoveTracksDownClicked="() => Cuesheet?.MoveTracks(selectedTracks, MoveDirection.Down)"
CopySelectedTracksDisabled="selectedTracks.Count != 1" CopySelectedTracksClicked="() => CopyTrackClicked()"
FixedHeader="applicationOptions?.FixedTracksTableHeader == true" FixedHeaderClicked="() => _localStorageOptionsProvider.SaveOptionsValueAsync<ApplicationOptions>(x => x.FixedTracksTableHeader, !applicationOptions?.FixedTracksTableHeader)" />
FixedHeader="applicationOptions?.FixedTracksTableHeader == true" FixedHeaderClicked="() => base.LocalStorageOptionsProvider.SaveOptionsValueAsync<ApplicationOptions>(x => x.FixedTracksTableHeader, !applicationOptions?.FixedTracksTableHeader)" />
</div>
break;
}
Expand Down Expand Up @@ -162,16 +161,16 @@ along with Foobar. If not, see
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_localStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
base.LocalStorageOptionsProvider.OptionSaved -= LocalStorageOptionsProvider_OptionSaved;
_sessionStateContainer.ImportCuesheetChanged -= SessionStateContainer_ImportCuesheetChanged;
_sessionStateContainer.CuesheetChanged -= SessionStateContainer_CuesheetChanged;
}

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
applicationOptions = await _localStorageOptionsProvider.GetOptionsAsync<ApplicationOptions>();
_localStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
applicationOptions = await base.LocalStorageOptionsProvider.GetOptionsAsync<ApplicationOptions>();
base.LocalStorageOptionsProvider.OptionSaved += LocalStorageOptionsProvider_OptionSaved;
_sessionStateContainer.ImportCuesheetChanged += SessionStateContainer_ImportCuesheetChanged;
_sessionStateContainer.CuesheetChanged += SessionStateContainer_CuesheetChanged;
}
Expand Down