Some fixes

This commit is contained in:
2026-08-13 12:39:03 +02:00
parent 027fc683ef
commit ab46a16726
11 changed files with 373 additions and 14 deletions
+16 -1
View File
@@ -31,7 +31,10 @@
<ListView x:Name="InputList"
Height="120"
SelectionMode="Single"
SelectionChanged="InputList_SelectionChanged" />
SelectionChanged="InputList_SelectionChanged"
AllowDrop="True"
DragOver="InputList_DragOver"
Drop="InputList_Drop" />
<Button x:Name="PreviewSourceButton"
Content="Preview selected"
Click="PreviewSource_Click"
@@ -163,6 +166,18 @@
</StackPanel>
</Border>
<Border Padding="14" Background="{ThemeResource PanelAltBrush}" BorderBrush="{ThemeResource BorderBrush}" BorderThickness="1" CornerRadius="12">
<StackPanel Spacing="10">
<TextBlock Text="Source files" Style="{StaticResource SectionTitleStyle}" />
<CheckBox x:Name="MoveSourcesBox"
Content="Move source videos to destination\originals"
IsChecked="True" />
<TextBlock Text="After a successful render, original recordings are moved into an originals subfolder of the output folder. Uncheck to leave them where they are."
TextWrapping="WrapWholeWords"
Style="{StaticResource MutedTextStyle}" />
</StackPanel>
</Border>
<Border Padding="14" Background="{ThemeResource PanelAltBrush}" BorderBrush="{ThemeResource BorderBrush}" BorderThickness="1" CornerRadius="12">
<StackPanel Spacing="10">
<TextBlock Text="FFmpeg tools" Style="{StaticResource SectionTitleStyle}" />
+35 -3
View File
@@ -7,6 +7,8 @@ using AmigaDB.VideoRenderer.Services;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Win32;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage;
using Windows.Storage.Pickers;
using WinRT.Interop;
@@ -39,6 +41,7 @@ public sealed partial class MainPage : Page
SelectEncoder(_loadedSettings.Encoder);
SelectTheme(_loadedSettings.Theme);
ApplyTheme(_loadedSettings.Theme);
MoveSourcesBox.IsChecked = _loadedSettings.ShouldMoveSourcesToOriginals;
}
private async void AddInputs_Click(object sender, RoutedEventArgs e)
@@ -55,6 +58,25 @@ public sealed partial class MainPage : Page
private void ClearInputs_Click(object sender, RoutedEventArgs e) => _inputs.Clear();
private void InputList_DragOver(object sender, DragEventArgs e)
{
e.AcceptedOperation = e.DataView.Contains(StandardDataFormats.StorageItems)
? DataPackageOperation.Copy
: DataPackageOperation.None;
}
private async void InputList_Drop(object sender, DragEventArgs e)
{
if (!e.DataView.Contains(StandardDataFormats.StorageItems)) return;
IReadOnlyList<IStorageItem> items = await e.DataView.GetStorageItemsAsync();
foreach (string path in items.OfType<StorageFile>()
.Select(file => file.Path)
.Where(path => string.Equals(Path.GetExtension(path), ".avi", StringComparison.OrdinalIgnoreCase))
.OrderBy(NaturalKey))
if (!_inputs.Contains(path, StringComparer.OrdinalIgnoreCase)) _inputs.Add(path);
}
private async void BrowseEndCard_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker picker = CreateFileOpenPicker();
@@ -111,7 +133,8 @@ public sealed partial class MainPage : Page
LogBox.Text = string.Empty;
_renderCancellation = new CancellationTokenSource();
Progress<RenderProgress> progress = new(UpdateProgress);
await new RenderPipeline().RenderAsync(settings, progress, AppendLog, _renderCancellation.Token);
IReadOnlyList<string> resolvedInputs = await new RenderPipeline().RenderAsync(settings, progress, AppendLog, _renderCancellation.Token);
ReplaceInputs(resolvedInputs);
_lastRenderedFile = Path.Combine(settings.OutputDirectory, settings.OutputName + "_final.mp4");
OpenOutputButton.IsEnabled = true;
PreviewRenderedButton.IsEnabled = File.Exists(_lastRenderedFile);
@@ -192,7 +215,15 @@ public sealed partial class MainPage : Page
Number(TrimBox.Text, "trim start"),
Number(FadeBox.Text, "fade"),
Number(HoldBox.Text, "end-card hold"),
interval);
interval,
MoveSourcesBox.IsChecked == true);
}
private void ReplaceInputs(IReadOnlyList<string> paths)
{
_inputs.Clear();
foreach (string path in paths)
_inputs.Add(path);
}
private void SetRendering(bool rendering)
@@ -260,7 +291,8 @@ public sealed partial class MainPage : Page
TrimBox.Text.Trim(),
FadeBox.Text.Trim(),
HoldBox.Text.Trim(),
IntervalBox.Text.Trim()));
IntervalBox.Text.Trim(),
MoveSourcesBox.IsChecked == true));
}
private string SelectedTheme() => (ThemeBox.SelectedItem as ComboBoxItem)?.Tag?.ToString() ?? "Dark";
+28
View File
@@ -1,4 +1,6 @@
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.IO;
@@ -14,6 +16,8 @@ namespace AmiReel_WinUI;
/// </summary>
public sealed partial class MainWindow : Window
{
private bool _exitConfirmed;
public MainWindow()
{
InitializeComponent();
@@ -27,5 +31,29 @@ public sealed partial class MainWindow : Window
// Navigate the root frame to the main page on startup.
RootFrame.Navigate(typeof(MainPage));
AppWindow.Closing += AppWindow_Closing;
}
private async void AppWindow_Closing(AppWindow sender, AppWindowClosingEventArgs args)
{
if (_exitConfirmed) return;
args.Cancel = true;
ContentDialog dialog = new()
{
Title = "Exit AmiReel?",
Content = "Are you sure you want to close the application?",
PrimaryButtonText = "Exit",
CloseButtonText = "Cancel",
DefaultButton = ContentDialogButton.Close,
XamlRoot = RootFrame.XamlRoot
};
ContentDialogResult result = await dialog.ShowAsync();
if (result != ContentDialogResult.Primary) return;
_exitConfirmed = true;
Close();
}
}