Skip to content
Open
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
4 changes: 2 additions & 2 deletions SubRenamer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Avalonia;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using System;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -41,7 +41,7 @@ public static AppBuilder BuildAvaloniaApp()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.UseReactiveUI()
.UseReactiveUI(_ => {})
.With(new MacOSPlatformOptions
{
DisableDefaultApplicationMenuItems = true
Expand Down
7 changes: 2 additions & 5 deletions SubRenamer/Services/ClipboardService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Input.Platform;
using SubRenamer.Model;

namespace SubRenamer.Services;
Expand All @@ -16,10 +16,7 @@ public ClipboardService(Window target)

public async Task CopyToClipboard(string content)
{
var dataObject = new DataObject();
dataObject.Set(DataFormats.Text, content);
var clipboard = _target.Clipboard;
if (clipboard is not null) await clipboard.SetDataObjectAsync(dataObject);

if (clipboard is not null) await clipboard.SetTextAsync(content);
}
}
2 changes: 1 addition & 1 deletion SubRenamer/Services/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task OpenItemEdit(MatchItem item, ObservableCollection<MatchItem> c

public async Task<string?> OpenConflict(List<string> options)
{
var keepAllText = Application.Current.GetResource<string>("App.Strings.ConflictKeepAll");
var keepAllText = Application.Current.GetResource<string>("App.Strings.ConflictKeepAll") ?? "";

var store = new ConflictViewModel([..options, keepAllText]);
var dialog = new ConflictWindow
Expand Down
18 changes: 9 additions & 9 deletions SubRenamer/SubRenamer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.3" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
<PackageReference Include="Avalonia" Version="12.0.1" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="12.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="12.0.1" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.3" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.3" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1" />
<PackageReference Include="ReactiveUI.Avalonia" Version="12.0.1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.1" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="LoadingIndicators.Avalonia" Version="11.0.11.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Optris.LoadingIndicators.Avalonia" Version="12.0.3" />
<PackageReference Include="MessageBox.Avalonia" Version="12.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />

<!--Compresse with UPX-->
Expand Down
3 changes: 2 additions & 1 deletion SubRenamer/Views/ConflictWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
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:viewModels="clr-namespace:SubRenamer.ViewModels"
xmlns:viewModels="using:SubRenamer.ViewModels"
mc:Ignorable="d"
x:Class="SubRenamer.Views.ConflictWindow"
x:DataType="viewModels:ConflictViewModel"
Title="{DynamicResource App.Strings.ConflictTitle}"
WindowStartupLocation="CenterOwner"
Width="400"
Expand Down
3 changes: 2 additions & 1 deletion SubRenamer/Views/ItemEditWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
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:vm="clr-namespace:SubRenamer.ViewModels"
xmlns:vm="using:SubRenamer.ViewModels"
mc:Ignorable="d"
x:Class="SubRenamer.Views.ItemEditWindow"
x:DataType="vm:ItemEditViewModel"
Title="{DynamicResource App.Strings.ItemEditTitle}"
WindowStartupLocation="CenterOwner"
Width="500"
Expand Down
9 changes: 5 additions & 4 deletions SubRenamer/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Avalonia.ReactiveUI;
using ReactiveUI;
using ReactiveUI.Avalonia;
using SubRenamer.Helper;
using SubRenamer.Model;
using SubRenamer.ViewModels;
Expand All @@ -24,9 +25,9 @@ public MainWindow()

private async void OnDrop(object? sender, DragEventArgs e)
{
if (!e.Data.Contains(DataFormats.Files)) return;
var items = e.Data.GetFiles() ?? Array.Empty<IStorageItem>();
if (!e.DataTransfer.Contains(DataFormat.File)) return;

var items = e.DataTransfer.TryGetFiles() ?? Array.Empty<IStorageItem>();
var files = new List<IStorageFile>();

foreach (var item in items)
Expand Down
9 changes: 5 additions & 4 deletions SubRenamer/Views/ManualRuleWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
mc:Ignorable="d"
x:Name="Window"
x:Class="SubRenamer.Views.ManualRuleWindow"
xmlns:vm="clr-namespace:SubRenamer.ViewModels"
xmlns:vm="using:SubRenamer.ViewModels"
xmlns:common="clr-namespace:SubRenamer.Common"
Title="{DynamicResource App.Strings.ManualRuleTitle}"
WindowStartupLocation="CenterOwner"
Width="710"
SizeToContent="Height">
SizeToContent="Height"
x:DataType="vm:ManualRuleViewModel">

<Design.DataContext>
<vm:ManualRuleViewModel />
Expand All @@ -26,7 +27,7 @@
<StackPanel Grid.Column="2" Spacing="10">
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Command="{Binding OpenFileCommand}" CommandParameter="{x:Static common:FileType.Video}" Content="{DynamicResource App.Strings.ManualRuleSelectVideoFile}"></Button>
<TextBlock TextWrapping="Wrap" LineSpacing="5" Text="{DynamicResource App.Strings.ManualRuleInstruction}"></TextBlock>
<TextBox IsReadOnly="True" Watermark="{DynamicResource App.Strings.ManualRuleNoMatch}" Text="{Binding VideoMatchResult}" />
<TextBox IsReadOnly="True" PlaceholderText="{DynamicResource App.Strings.ManualRuleNoMatch}" Text="{Binding VideoMatchResult}" />
</StackPanel>
</Grid>
</StackPanel>
Expand All @@ -42,7 +43,7 @@
<StackPanel Grid.Column="2" Spacing="10">
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Command="{Binding OpenFileCommand}" CommandParameter="{x:Static common:FileType.Subtitle}" Content="{DynamicResource App.Strings.ManualRuleSelectSubtitleFile}"></Button>
<TextBlock TextWrapping="Wrap" LineSpacing="5" Text="{DynamicResource App.Strings.ManualRuleInstruction}"></TextBlock>
<TextBox IsReadOnly="True" Watermark="{DynamicResource App.Strings.ManualRuleNoMatch}" Text="{Binding SubtitleMatchResult}" />
<TextBox IsReadOnly="True" PlaceholderText="{DynamicResource App.Strings.ManualRuleNoMatch}" Text="{Binding SubtitleMatchResult}" />
</StackPanel>
</Grid>
</StackPanel>
Expand Down
17 changes: 9 additions & 8 deletions SubRenamer/Views/RegexRuleWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
mc:Ignorable="d"
x:Name="Window"
x:Class="SubRenamer.Views.RegexRuleWindow"
xmlns:vm="clr-namespace:SubRenamer.ViewModels"
xmlns:vm="using:SubRenamer.ViewModels"
xmlns:common="clr-namespace:SubRenamer.Common"
Title="{DynamicResource App.Strings.RegexRuleTitle}"
WindowStartupLocation="CenterOwner"
Width="500"
SizeToContent="Height">
SizeToContent="Height"
x:DataType="vm:RegexRuleViewModel">

<Design.DataContext>
<vm:RegexRuleViewModel />
Expand All @@ -37,13 +38,13 @@
<StackPanel Margin="10">
<Label Content="{DynamicResource App.Strings.RegexRuleVideoLabel}" />
<Border Height="5" />
<TextBox Height="90" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding VideoRegexStr}" Watermark="{DynamicResource App.Strings.RegexRuleVideoRegexWatermark}" />
<TextBox Height="90" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding VideoRegexStr}" PlaceholderText="{DynamicResource App.Strings.RegexRuleVideoRegexWatermark}" />

<Border Height="10" />

<Label Content="{DynamicResource App.Strings.RegexRuleSubtitleLabel}" />
<Border Height="5" />
<TextBox Height="90" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding SubtitleRegexStr}" Watermark="{DynamicResource App.Strings.RegexRuleSubtitleRegexWatermark}" />
<TextBox Height="90" Margin="5" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding SubtitleRegexStr}" PlaceholderText="{DynamicResource App.Strings.RegexRuleSubtitleRegexWatermark}" />

<Border BorderThickness=".5" BorderBrush="#D2D4D5" Margin="0 20"></Border>

Expand All @@ -52,18 +53,18 @@
<Border Height="5" />
<Grid ColumnDefinitions="Auto,10,*,10,50,10,80">
<Label Grid.Column="0" VerticalAlignment="Center" Content="{DynamicResource App.Strings.RegexRuleVideoTestLabel}" />
<TextBox Grid.Column="2" Watermark="{DynamicResource App.Strings.RegexRuleInputOrOpenFileWatermark}" Text="{Binding VideoTestStr}" />
<TextBox Grid.Column="2" PlaceholderText="{DynamicResource App.Strings.RegexRuleInputOrOpenFileWatermark}" Text="{Binding VideoTestStr}" />
<Button Grid.Column="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Command="{Binding OpenFileCommand}" CommandParameter="{x:Static common:FileType.Video}">...</Button>
<TextBox Grid.Column="6" IsReadOnly="True" Watermark="{DynamicResource App.Strings.RegexRuleNoMatchWatermark}" Text="{Binding VideoTestResult}" />
<TextBox Grid.Column="6" IsReadOnly="True" PlaceholderText="{DynamicResource App.Strings.RegexRuleNoMatchWatermark}" Text="{Binding VideoTestResult}" />
</Grid>

<Border Height="10" />

<Grid ColumnDefinitions="Auto,10,*,10,50,10,80">
<Label Grid.Column="0" VerticalAlignment="Center" Content="{DynamicResource App.Strings.RegexRuleSubtitleTestLabel}" />
<TextBox Grid.Column="2" Watermark="{DynamicResource App.Strings.RegexRuleInputOrOpenFileWatermark}" Text="{Binding SubtitleTestStr}" />
<TextBox Grid.Column="2" PlaceholderText="{DynamicResource App.Strings.RegexRuleInputOrOpenFileWatermark}" Text="{Binding SubtitleTestStr}" />
<Button Grid.Column="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Command="{Binding OpenFileCommand}" CommandParameter="{x:Static common:FileType.Subtitle}">...</Button>
<TextBox Grid.Column="6" IsReadOnly="True" Watermark="{DynamicResource App.Strings.RegexRuleNoMatchWatermark}" Text="{Binding SubtitleTestResult}" />
<TextBox Grid.Column="6" IsReadOnly="True" PlaceholderText="{DynamicResource App.Strings.RegexRuleNoMatchWatermark}" Text="{Binding SubtitleTestResult}" />
</Grid>
</StackPanel>

Expand Down
3 changes: 2 additions & 1 deletion SubRenamer/Views/RulesWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
Title="{DynamicResource App.Strings.RulesTitle}"
WindowStartupLocation="CenterOwner"
Width="500"
SizeToContent="Height">
SizeToContent="Height"
x:DataType="vm:RulesViewModel">

<Design.DataContext>
<vm:RulesViewModel/>
Expand Down
6 changes: 3 additions & 3 deletions SubRenamer/Views/SettingsWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<CheckBox IsChecked="{Binding CustomLangExtEnabled}" Content="{DynamicResource App.Strings.SettingsAddCustomSuffix}" />
<StackPanel Margin="30 0 0 0">
<TextBlock Text="{DynamicResource App.Strings.SettingsAddCustomSuffixHint}" Foreground="Gray" FontSize="13" Padding="0" Margin="0 0 0 10" TextWrapping="Wrap" />
<TextBox IsEnabled="{Binding CustomLangExtEnabled}" Watermark="{DynamicResource App.Strings.SettingsCustomSuffixWatermark}" Text="{Binding CustomLangExt}" />
<TextBox IsEnabled="{Binding CustomLangExtEnabled}" PlaceholderText="{DynamicResource App.Strings.SettingsCustomSuffixWatermark}" Text="{Binding CustomLangExt}" />
</StackPanel>
</StackPanel>

Expand All @@ -108,11 +108,11 @@
<Grid IsEnabled="{Binding FileClsExtAppendEnabled}" Margin="30 0 0 0" HorizontalAlignment="Stretch" ColumnDefinitions="*,10,*">
<StackPanel Grid.Column="0">
<TextBlock Margin="0 5 0 10" FontSize="13" Text="{DynamicResource App.Strings.SettingsSubtitleFormatExtension}" />
<TextBox Watermark="{DynamicResource App.Strings.SettingsSubtitleFormatWatermark}" Text="{Binding SubtitleExtAppend}" />
<TextBox PlaceholderText="{DynamicResource App.Strings.SettingsSubtitleFormatWatermark}" Text="{Binding SubtitleExtAppend}" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Margin="0 5 0 10" FontSize="13" Text="{DynamicResource App.Strings.SettingsVideoFormatExtension}" />
<TextBox Watermark="{DynamicResource App.Strings.SettingsVideoFormatWatermark}" Text="{Binding VideoExtAppend}" />
<TextBox PlaceholderText="{DynamicResource App.Strings.SettingsVideoFormatWatermark}" Text="{Binding VideoExtAppend}" />
</StackPanel>
</Grid>

Expand Down
6 changes: 3 additions & 3 deletions SubRenamer/Views/TerminalWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
<Setter Property="Background" Value="Black" />
</Style>

<Style Selector="^ /template/ TextBlock#PART_Watermark">
<Style Selector="^ /template/ TextBlock#PART_PlaceholderText">
<Setter Property="Foreground" Value="White" />
</Style>
</Style>

<Style Selector="^:focus">
<Setter Property="Foreground" Value="White" />

<Style Selector="^ /template/ TextBlock#PART_Watermark">
<Style Selector="^ /template/ TextBlock#PART_PlaceholderText">
<Setter Property="Foreground" Value="White" />
</Style>

Expand Down