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

2.0 beta #9

Merged
merged 5 commits into from
Jul 2, 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
22 changes: 13 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@ jobs:
- name: Set version number
shell: pwsh
run: |
$version = "0.1.0"
echo $version
echo "VERSION_NUMBER=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
$versionNumber = "2.0.0"
$versionSuffix = "beta.1"
$infoVersion = "$versionNumber-$versionSuffix"
echo $infoVersion
echo "VERSION_NUMBER=$versionNumber" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "VERSION_SUFFIX=$versionSuffix" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "INFO_VERSION=$infoVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Publish for win-x64
run: dotnet publish KaddaOK.AvaloniaApp.Windows/KaddaOK.AvaloniaApp.Windows.csproj /p:Version=${{ env.VERSION_NUMBER }}.0 /p:Configuration=Release /p:RuntimeIdentifier=win-x64 /p:PublishSingleFile=true /p:PublishDir=${{ github.workspace }}/publish
run: dotnet publish KaddaOK.AvaloniaApp.Windows/KaddaOK.AvaloniaApp.Windows.csproj /p:VersionPrefix=${{ env.VERSION_NUMBER }} /p:VersionSuffix=${{ env.VERSION_SUFFIX }} /p:Configuration=Release /p:RuntimeIdentifier=win-x64 /p:PublishSingleFile=true /p:PublishDir=${{ github.workspace }}/publish
- name: Zip for win-x64
shell: pwsh
run: Compress-Archive -Path ${{ github.workspace }}/publish/* -DestinationPath KaddaOKTools_win-x64_${{ env.VERSION_NUMBER }}.zip
run: Compress-Archive -Path ${{ github.workspace }}/publish/* -DestinationPath KaddaOKTools_win-x64_${{ env.INFO_VERSION }}.zip
- name: Upload win-x64 Artifact
uses: actions/upload-artifact@v4
with:
name: KaddaOKTools_win-x64_${{ env.VERSION_NUMBER }}
path: KaddaOKTools_win-x64_${{ env.VERSION_NUMBER }}.zip
name: KaddaOKTools_win-x64_${{ env.INFO_VERSION }}
path: KaddaOKTools_win-x64_${{ env.INFO_VERSION }}.zip
- name: Create Release
uses: ncipollo/release-action@v1.13.0
with:
artifacts: "KaddaOKTools_win-x64_${{ env.VERSION_NUMBER }}.zip"
tag: ${{ env.VERSION_NUMBER }}
artifacts: "KaddaOKTools_win-x64_${{ env.INFO_VERSION }}.zip"
tag: ${{ env.INFO_VERSION }}
15 changes: 13 additions & 2 deletions KaddaOK.AvaloniaApp.Tests/ViewModels/EditLinesViewModelTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Collections.ObjectModel;
using Avalonia.Input;
using FluentAvalonia.Core;
using KaddaOK.AvaloniaApp.Models;
using KaddaOK.AvaloniaApp.ViewModels;
using KaddaOK.AvaloniaApp.Views;
using KaddaOK.Library;
using NAudio.Wave;

Expand All @@ -26,14 +28,22 @@ private static KaraokeProcess GetNewCurrentProcess() =>
}
};

public class DummyEditLinesView : IEditLinesView
{
public bool Focus(NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None)
{
return true;
}
}
public class MoveLineToPrevious
{
[Fact]
public void ShouldMergeLines()
{
var currentProcess = GetNewCurrentProcess();

var viewModel = new EditLinesViewModel(currentProcess, new LineSplitter(), new WordMerger(), new MinMaxFloatWaveStreamSampler());
var viewModel = new EditLinesViewModel(currentProcess, new LineSplitter(), new WordMerger(), new MinMaxFloatWaveStreamSampler())
{ EditLinesView = new DummyEditLinesView() };

viewModel.MoveLineToPrevious(currentProcess.ChosenLines!.Last());

Expand All @@ -47,7 +57,8 @@ public void ShouldAddSpaceToPreviousWordWhenMergingLines()
{
var currentProcess = GetNewCurrentProcess();

var viewModel = new EditLinesViewModel(currentProcess, new LineSplitter(), new WordMerger(), new MinMaxFloatWaveStreamSampler());
var viewModel = new EditLinesViewModel(currentProcess, new LineSplitter(), new WordMerger(), new MinMaxFloatWaveStreamSampler())
{ EditLinesView = new DummyEditLinesView()};

viewModel.MoveLineToPrevious(currentProcess.ChosenLines!.Last());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AssemblyName>KaddaOKTools</AssemblyName>
<VersionPrefix>0.0.0</VersionPrefix>
<VersionSuffix>dev</VersionSuffix>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions KaddaOK.AvaloniaApp/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,20 @@
<Setter Property="DialogMargin" Value="0" />
<Setter Property="dialogHost:DialogHostStyle.CornerRadius" Value="10" />
</Style>
<Style Selector="TextBlock.pageTitleHeader">
<Setter Property="FontSize" Value="28" />
<Setter Property="Margin" Value="0,0,0,10" />
<Setter Property="Foreground" Value="{DynamicResource SystemBaseMediumColor}" />
</Style>
</Application.Styles>
<Application.Resources>
<local:WaveformToPointConverter x:Key="WaveformToPointConverter" />
<local:WaveformToLengthConverter x:Key="WaveformToLengthConverter" />
<local:ObjectEqualityBooleanConverter x:Key="ObjectEqualityBooleanConverter" />
<local:EnumEqualityBooleanConverter x:Key="EnumEqualityBooleanConverter" />
<local:RoundingConverter x:Key="RoundingConverter" />
<local:TimingWordIsPlayingConverter x:Key="TimingWordIsPlayingConverter" />
<local:TimingWordStartHasBeenSetConverter x:Key="TimingWordStartHasBeenSetConverter" />
<local:TimingWordEndHasBeenSetConverter x:Key="TimingWordEndHasBeenSetConverter" />
</Application.Resources>
</Application>
4 changes: 3 additions & 1 deletion KaddaOK.AvaloniaApp/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Initialize()

KaraokeProcess = new KaraokeProcess
{
KaraokeSource = InitialKaraokeSource.AzureSpeechService
KaraokeSource = InitialKaraokeSource.NotSelected
};

services.AddSingleton(KaraokeProcess);
Expand Down Expand Up @@ -53,6 +53,8 @@ public override void Initialize()
services.AddTransient<LyricsViewModel>();
services.AddTransient<NarrowingViewModel>();
services.AddTransient<RecognizeViewModel>();
services.AddTransient<StartViewModel>();
services.AddTransient<ManualAlignViewModel>();

// Build the service provider
ServiceProvider = services.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
<Grid RowDefinitions="*,*,*,*" MaxWidth="500">
<Label
Content="{Binding StartSecond}"
IsVisible="{Binding Converter={StaticResource TimingWordStartHasBeenSetConverter}}"
HorizontalAlignment="Left" />
<Label
Content="{Binding Text}"
HorizontalAlignment="Center" />
<Label
Content="{Binding EndSecond}"
IsVisible="{Binding Converter={StaticResource TimingWordEndHasBeenSetConverter}}"
HorizontalAlignment="Right" />
<TextBlock Grid.Row="1" TextWrapping="Wrap">
Enter the new text for this timed syllable. (You may break it up into multiple words or syllables by using space or | characters,
and the timing dialog will open automatically for you to check the new distribution.)
Enter the new text for this timed syllable. (You may break it up into multiple words or syllables by using space, /, or | characters.)
</TextBlock>
<TextBox
AttachedToVisualTree="TextBox_AttachedToVisualTree"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Enter the text for the new line.
</TextBlock>
<TextBlock TextWrapping="Wrap">
(To separate syllables, use a | (pipe) character.)
(To separate syllables, use a / or | character.)
</TextBlock>
<Grid ColumnDefinitions="36,*,36" RowDefinitions="*,*,*,*">
<Label FontSize="10" Content="{Binding PreviousLine.StartSecond}" />
Expand Down
59 changes: 59 additions & 0 deletions KaddaOK.AvaloniaApp/Controls/Dialogs/NudgeTimingsDialog.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dialogs="clr-namespace:KaddaOK.AvaloniaApp.Controls.Dialogs"
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:library="clr-namespace:KaddaOK.Library;assembly=KaddaOK.Library"
xmlns:viewModels="clr-namespace:KaddaOK.AvaloniaApp.ViewModels"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="350"
x:Class="KaddaOK.AvaloniaApp.Controls.Dialogs.NudgeTimingsDialog"
x:DataType="viewModels:NudgeTimingsViewModel">
<dialogs:ModalDialogChrome Title="Nudge All Timings">
<Grid RowDefinitions="170,30,100" MaxWidth="500">
<StackPanel>
<TextBlock TextWrapping="Wrap" Margin="2">
Shift all the starts and stops in the entire song by an offset value in seconds.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="2">
Positive values will move everything later relative to the music, and should
be applied if the scroll is happening too early.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="2">
Negative values will move everything earlier relative to the music, and should
be applied if the scroll isn't happening early enough.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="2">
For instance, to move everything 100ms earlier in the song to give singers more
time to react, enter -0.1 in the input below.
</TextBlock>
</StackPanel>
<Grid Grid.Row="1" ColumnDefinitions="*, 30">

<NumericUpDown
Increment="0.01"
FormatString="{}{0:#,0.00}"
Value="{Binding NudgeBy}"/>
<TextBlock Grid.Column="1" Text="s" Margin="5"/>
</Grid>

<StackPanel
Grid.Row="2"
Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="0,10,0,0">
<Button
Content="Apply"
Classes="accent"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
CommandParameter="{Binding}" />

<Button
Content="Cancel"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" />
</StackPanel>

</Grid>

</dialogs:ModalDialogChrome>
</UserControl>
36 changes: 36 additions & 0 deletions KaddaOK.AvaloniaApp/Controls/Dialogs/NudgeTimingsDialog.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.VisualTree;
using DialogHostAvalonia;

namespace KaddaOK.AvaloniaApp.Controls.Dialogs
{
public partial class NudgeTimingsDialog : UserControl
{
private DialogHost? dialogHost;

public NudgeTimingsDialog()
{
InitializeComponent();
}

private void TextBox_AttachedToVisualTree(object? sender, Avalonia.VisualTreeAttachmentEventArgs e)
{
(sender as TextBox)?.Focus();
dialogHost = this.FindAncestorOfType<DialogHost>();
}

private void TextBox_KeyDown(object? sender, Avalonia.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
dialogHost?.CloseDialogCommand.Execute(((TextBox)sender).Text);

Check warning on line 27 in KaddaOK.AvaloniaApp/Controls/Dialogs/NudgeTimingsDialog.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 27 in KaddaOK.AvaloniaApp/Controls/Dialogs/NudgeTimingsDialog.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}

if (e.Key == Key.Escape)
{
dialogHost?.CloseDialogCommand.Execute(null);
}
}
}
}
130 changes: 130 additions & 0 deletions KaddaOK.AvaloniaApp/Controls/InitialSyncOption.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:KaddaOK.AvaloniaApp.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="KaddaOK.AvaloniaApp.Controls.InitialSyncOption"
x:DataType="local:InitialSyncOption">
<UserControl.Styles>
<Style Selector="Image.sourceMethodIconImage">
<Setter Property="Width" Value="32" />
</Style>
<Style Selector="ScrollViewer.gettingFile">
<Setter
Property="Cursor"
Value="Wait" />
</Style>
<Style Selector="ScrollViewer.gettingFile StackPanel">
<Setter
Property="IsEnabled"
Value="False" />
</Style>
<Style Selector="Label.waveformLabel">
<Setter
Property="Margin"
Value="0,10,0,0" />
</Style>
<Style Selector="Border.outerWaveformBorder">
<Setter
Property="Margin"
Value="0,2,0,5" />
<Setter
Property="Background"
Value="#FF061424" />
<Setter
Property="BorderBrush"
Value="Gray" />
<Setter
Property="BorderThickness"
Value="1" />
<Setter
Property="CornerRadius"
Value="5" />
</Style>
<Style Selector="Border.innerWaveformBorder">
<Setter
Property="Margin"
Value="0,5" />
<Setter
Property="MinHeight"
Value="50" />
</Style>

<Style Selector="TextBlock.introText">
<Setter
Property="Margin"
Value="0,0,0,10" />
<Setter
Property="TextWrapping"
Value="Wrap" />
</Style>
<Style Selector="Border.initialOptionBorder">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="50%,0%" EndPoint="50%,100%">
<GradientStop Color="#FF385371" Offset="0" />
<GradientStop Color="#FF1E3851" Offset="0.5" />
<GradientStop Color="#FF112132" Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" Value="#FF5A6A83" />
<Setter Property="BorderThickness" Value="0,1,0,0" />
<Setter Property="Padding" Value="25, 12" />
<Setter Property="CornerRadius" Value="30" />
<Setter Property="Margin" Value="0,20,0,0" />
</Style>
<Style Selector="StackPanel.optionMainLineStackPanel">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="StackPanel.optionMainLineStackPanel TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0" />
</Style>
<Style Selector="StackPanel.optionMainLineStackPanel Button">
<Setter Property="Padding" Value="15,10" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="StackPanel.moreInfoStackPanel">
<Setter Property="Margin" Value="5" />
</Style>
<Style Selector="TextBlock.linkButtonText">
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontStyle" Value="Italic" />
</Style>
<Style Selector="TextBlock.summarySentence">
<Setter Property="Margin" Value="5,10,0,5" />
</Style>
</UserControl.Styles>
<Border Classes="initialOptionBorder">
<StackPanel>
<Grid ColumnDefinitions="50,*,60">
<Image VerticalAlignment="Center" Classes="sourceMethodIconImage" Source="{Binding $parent[local:InitialSyncOption].IconDrawing}" />
<TextBlock VerticalAlignment="Center" Margin="10,0" FontWeight="Bold" Grid.Column="1" Text="{Binding $parent[local:InitialSyncOption].OptionTitle}" />
<Button VerticalAlignment="Center" Content="GO ->"
Command="{Binding $parent[local:InitialSyncOption].ChooseCommand}"
Grid.Column="2" />
</Grid>
<StackPanel Orientation="Horizontal" Classes="optionMainLineStackPanel">
<TextBlock Classes="summarySentence">
<Run Text="{Binding $parent[local:InitialSyncOption].OptionSummary}"/> <InlineUIContainer>
<Button Margin="0" Padding="0" Background="Transparent"
Command="{Binding $parent[local:InitialSyncOption].ShowMoreInfoCommand}"
IsVisible="{Binding !$parent[local:InitialSyncOption].MoreInfoVisible}">
<TextBlock Classes="linkButtonText">(more info)</TextBlock>
</Button>
</InlineUIContainer>
</TextBlock>
</StackPanel>
<StackPanel IsVisible="{Binding $parent[local:InitialSyncOption].MoreInfoVisible}"
Classes="moreInfoStackPanel">
<ItemsControl ItemsSource="{Binding $parent[local:InitialSyncOption].MoreInfoContent}" />
<Button Margin="0" Padding="0" Background="Transparent"
Command="{Binding $parent[local:InitialSyncOption].HideMoreInfo}">
<TextBlock Classes="linkButtonText">(less info)</TextBlock>
</Button>
</StackPanel>
</StackPanel>
</Border>
</UserControl>
Loading
Loading