Added SettingsDialog
This commit is contained in:
parent
10359aa5e8
commit
0c98ce000b
11 changed files with 655 additions and 260 deletions
|
|
@ -2,7 +2,7 @@
|
|||
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"
|
||||
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="600"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="620"
|
||||
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.SettingsDialog"
|
||||
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
||||
Title="Edit Settings"
|
||||
|
|
@ -19,16 +19,139 @@
|
|||
Content="Save"
|
||||
Click="SaveButton_Clicked" />
|
||||
|
||||
<TabControl Grid.Column="0">
|
||||
<TabControl Grid.Column="0">
|
||||
<TabControl.Styles>
|
||||
<Style Selector="ItemsPresenter#PART_ItemsPresenter">
|
||||
<Setter Property="Height" Value="33"/>
|
||||
<Setter Property="Height" Value="18"/>
|
||||
</Style>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Style Selector="TabItem">
|
||||
<Setter Property="MinHeight" Value="30"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Padding" Value="8,2,8,0"/>
|
||||
</Style>
|
||||
<Style Selector="TabItem#Header TextBlock">
|
||||
<Setter Property="MinHeight" Value="5"/>
|
||||
</Style>
|
||||
</TabControl.Styles>
|
||||
|
||||
|
||||
<TabItem Margin="0" Name="tabItem1">
|
||||
|
||||
<TabItem.Header>
|
||||
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Text="Important Settings"/>
|
||||
|
||||
</TabItem.Header>
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
<Grid RowDefinitions="Auto,Auto,*">
|
||||
|
||||
<controls:GroupBox
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
BorderWidth="1"
|
||||
Label="Books Location">
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="5"
|
||||
Text="{Binding ImportantSettings.BooksText}" />
|
||||
|
||||
<controls:DirectoryOrCustomSelectControl Margin="0,10,0,10"
|
||||
SubDirectory="Books"
|
||||
Directory="{Binding ImportantSettings.BooksDirectory, Mode=TwoWay}"
|
||||
KnownDirectories="{Binding ImportantSettings.KnownDirectories}" />
|
||||
|
||||
|
||||
<CheckBox IsChecked="{Binding ImportantSettings.SavePodcastsToParentFolder, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding ImportantSettings.SavePodcastsToParentFolderText}" />
|
||||
</CheckBox>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</controls:GroupBox>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1" Margin="5"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center" Text="Logging level" />
|
||||
|
||||
<controls:WheelComboBox
|
||||
Width="150"
|
||||
Height="25"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
SelectedItem="{Binding ImportantSettings.LoggingLevel, Mode=TwoWay}"
|
||||
Items="{Binding ImportantSettings.LoggingLevels}" />
|
||||
|
||||
<Button
|
||||
Margin="50,0,0,0"
|
||||
Padding="20,3,20,3"
|
||||
Content="Open Log Folder"
|
||||
Click="OpenLogFolderButton_Click" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox
|
||||
Grid.Row="2"
|
||||
Margin="5"
|
||||
VerticalAlignment="Bottom"
|
||||
IsChecked="{Binding ImportantSettings.BetaOptIn, Mode=TwoWay}">
|
||||
|
||||
<TextBlock Text="{Binding ImportantSettings.BetaOptInText}" />
|
||||
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem>
|
||||
|
||||
<TabItem.Header>
|
||||
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Text="Import Library"/>
|
||||
|
||||
</TabItem.Header>
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
|
||||
<StackPanel Margin="5">
|
||||
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.AutoScan, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.AutoScanText}" />
|
||||
</CheckBox>
|
||||
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.ShowImportedStats, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.ShowImportedStatsText}" />
|
||||
</CheckBox>
|
||||
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.ImportEpisodes, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.ImportEpisodesText}" />
|
||||
</CheckBox>
|
||||
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.DownloadEpisodes, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.DownloadEpisodesText}" />
|
||||
</CheckBox>
|
||||
<CheckBox Margin="0,0,0,10" IsChecked="{Binding ImportSettings.AutoDownloadEpisodes, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding ImportSettings.AutoDownloadEpisodesText}" />
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem>
|
||||
|
||||
<TabItem.Header>
|
||||
|
|
@ -43,11 +166,14 @@
|
|||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
Background="WhiteSmoke"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,*">
|
||||
<controls:GroupBox Grid.Row="0" BorderWidth="1" Label="{Binding DownloadDecryptSettings.BadBookGroupboxText}">
|
||||
<controls:GroupBox
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
BorderWidth="1"
|
||||
Label="{Binding DownloadDecryptSettings.BadBookGroupboxText}">
|
||||
|
||||
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
|
||||
|
||||
|
|
@ -56,37 +182,41 @@
|
|||
Grid.Row="0"
|
||||
Margin="0,5,0,5"
|
||||
IsChecked="{Binding DownloadDecryptSettings.BadBookAsk, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookAskText}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookAskText}" />
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Margin="0,5,0,5"
|
||||
IsChecked="{Binding DownloadDecryptSettings.BadBookAbort, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookAbortText}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookAbortText}" />
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Margin="0,5,0,5"
|
||||
IsChecked="{Binding DownloadDecryptSettings.BadBookRetry, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookRetryText}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookRetryText}" />
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Margin="0,5,0,5"
|
||||
IsChecked="{Binding DownloadDecryptSettings.BadBookIgnore, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding DownloadDecryptSettings.BadBookIgnoreText}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding DownloadDecryptSettings.BadBookIgnoreText}" />
|
||||
</RadioButton>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</controls:GroupBox>
|
||||
|
||||
<controls:GroupBox Grid.Row="1" BorderWidth="1" Label="Custom File Naming">
|
||||
|
||||
|
||||
<controls:GroupBox
|
||||
Margin="5"
|
||||
Grid.Row="1"
|
||||
BorderWidth="1"
|
||||
Label="Custom File Naming">
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*,Auto">
|
||||
|
||||
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
|
|
@ -102,7 +232,7 @@
|
|||
Height="30"
|
||||
Padding="30,3,30,3"
|
||||
Click="EditFolderTemplateButton_Click" />
|
||||
|
||||
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
|
|
@ -118,7 +248,7 @@
|
|||
Height="30"
|
||||
Padding="30,3,30,3"
|
||||
Click="EditFileTemplateButton_Click" />
|
||||
|
||||
|
||||
<TextBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
|
|
@ -141,18 +271,23 @@
|
|||
Content="{Binding DownloadDecryptSettings.EditCharReplacementText}"
|
||||
Height="30"
|
||||
Padding="30,3,30,3"
|
||||
Click="EditChapterTitleTemplateButton_Click" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</controls:GroupBox>
|
||||
|
||||
<controls:DirectorySelectControl
|
||||
Grid.Row="2"
|
||||
Subdirectory="{Binding DownloadDecryptSettings.EditCharReplacementText}"
|
||||
KnownDirectories="{Binding DownloadDecryptSettings.KnownDirectories}"
|
||||
Selectedirectory="{Binding DownloadDecryptSettings.SelectedDirectory, Mode=TwoWay}" />
|
||||
Click="EditCharReplacementButton_Click" />
|
||||
|
||||
</Grid>
|
||||
|
||||
</controls:GroupBox>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Margin="5" >
|
||||
<TextBlock Margin="0,0,0,10" Text="{Binding DownloadDecryptSettings.InProgressDescriptionText}" />
|
||||
|
||||
<controls:DirectorySelectControl
|
||||
SubDirectory="Libation\DecryptInProgress"
|
||||
SelectedDirectory="{Binding DownloadDecryptSettings.InProgressDirectory, Mode=TwoWay}" />
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
|
@ -173,7 +308,6 @@
|
|||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
Background="WhiteSmoke"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
|
||||
<Grid
|
||||
|
|
@ -184,42 +318,42 @@
|
|||
Grid.Row="0"
|
||||
Grid.Column="0">
|
||||
|
||||
<CheckBox IsChecked="{Binding AudioSettings.CreateCueSheet, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.CreateCueSheetText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.CreateCueSheet, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.CreateCueSheetText}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding AudioSettings.DownloadCoverArt, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.DownloadCoverArtText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.DownloadCoverArt, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.DownloadCoverArtText}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding AudioSettings.RetainAaxFile, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.RetainAaxFileText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.RetainAaxFile, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.RetainAaxFileText}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding AudioSettings.MergeOpeningAndEndCredits, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.MergeOpeningEndCreditsText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.MergeOpeningAndEndCredits, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.MergeOpeningEndCreditsText}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding AudioSettings.AllowLibationFixup, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.AllowLibationFixupText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.AllowLibationFixup, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.AllowLibationFixupText}" />
|
||||
</CheckBox>
|
||||
|
||||
<controls:GroupBox BorderWidth="1" Label="Audiobook Fix-ups" IsEnabled="{Binding AudioSettings.AllowLibationFixup}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<CheckBox IsChecked="{Binding AudioSettings.SplitFilesByChapter, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.SplitFilesByChapterText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.SplitFilesByChapter, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.SplitFilesByChapterText}" />
|
||||
</CheckBox>
|
||||
|
||||
<CheckBox IsChecked="{Binding AudioSettings.StripAudibleBrandAudio, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.StripAudibleBrandingText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.StripAudibleBrandAudio, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.StripAudibleBrandingText}" />
|
||||
</CheckBox>
|
||||
|
||||
<CheckBox IsChecked="{Binding AudioSettings.StripUnabridged, Mode=TwoWay}">
|
||||
<TextBlock Text="{Binding AudioSettings.StripUnabridgedText}" />
|
||||
<CheckBox Margin="0,0,0,5" IsChecked="{Binding AudioSettings.StripUnabridged, Mode=TwoWay}">
|
||||
<TextBlock TextWrapping="Wrap" Text="{Binding AudioSettings.StripUnabridgedText}" />
|
||||
</CheckBox>
|
||||
|
||||
<RadioButton Margin="0,5,0,5" IsChecked="{Binding !AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
||||
<TextBlock Text="Download my books in the original audio format (Lossless)" />
|
||||
<TextBlock TextWrapping="Wrap" Text="Download my books in the original audio format (Lossless)" />
|
||||
</RadioButton>
|
||||
|
||||
<RadioButton Margin="0,5,0,5" IsChecked="{Binding AudioSettings.DecryptToLossy, Mode=TwoWay}">
|
||||
<TextBlock Text="Download my books as .MP3 files (transcode if necessary)" />
|
||||
<TextBlock TextWrapping="Wrap" Text="Download my books as .MP3 files (transcode if necessary)" />
|
||||
</RadioButton>
|
||||
|
||||
</StackPanel>
|
||||
|
|
@ -253,7 +387,7 @@
|
|||
</controls:GroupBox>
|
||||
|
||||
<CheckBox HorizontalAlignment="Right" Grid.Column="1" IsChecked="{Binding AudioSettings.LameDownsampleMono, Mode=TwoWay}">
|
||||
<TextBlock Text="Downsample to mono?
(Recommended)" />
|
||||
<TextBlock TextWrapping="Wrap" Text="Downsample to mono? (Recommended)" />
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
<controls:GroupBox Margin="5,5,5,0" BorderWidth="1" Label="Bitrate" IsEnabled="{Binding AudioSettings.LameTargetBitrate}" >
|
||||
|
|
@ -280,18 +414,18 @@
|
|||
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding AudioSettings.LameBitrate}" />
|
||||
<TextBlock Grid.Column="2" Text=" Kbps" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
|
||||
<CheckBox Grid.Column="0" IsChecked="{Binding AudioSettings.LameConstantBitrate, Mode=TwoWay}">
|
||||
<TextBlock Text="Restrict Encoder to Constant Bitrate?" />
|
||||
<TextBlock TextWrapping="Wrap" Text="Restrict Encoder to Constant Bitrate?" />
|
||||
</CheckBox>
|
||||
<CheckBox Grid.Column="1" IsChecked="{Binding AudioSettings.LameMatchSource, Mode=TwoWay}" HorizontalAlignment="Right">
|
||||
<TextBlock Text="Match Source Bitrate?" />
|
||||
<TextBlock TextWrapping="Wrap" Text="Match Source Bitrate?" />
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</controls:GroupBox>
|
||||
|
||||
|
||||
<controls:GroupBox Margin="5,5,5,0" BorderWidth="1" Label="Quality" IsEnabled="{Binding !AudioSettings.LameTargetBitrate}" >
|
||||
<Grid ColumnDefinitions="*,*,25" RowDefinitions="*,Auto">
|
||||
<Slider
|
||||
|
|
@ -343,7 +477,7 @@
|
|||
FontSize="14"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding AudioSettings.ChapterTitleTemplate}" />
|
||||
|
||||
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Content="Edit"
|
||||
|
|
@ -358,48 +492,6 @@
|
|||
|
||||
</TabItem>
|
||||
|
||||
<TabItem>
|
||||
|
||||
<TabItem.Header>
|
||||
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Text="Important Settings"/>
|
||||
|
||||
</TabItem.Header>
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
Background="WhiteSmoke"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
|
||||
</Border>
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem>
|
||||
|
||||
<TabItem.Header>
|
||||
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Text="Import Library"/>
|
||||
|
||||
</TabItem.Header>
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
BorderThickness="2"
|
||||
Background="WhiteSmoke"
|
||||
BorderBrush="{DynamicResource DataGridGridLinesBrush}">
|
||||
|
||||
</Border>
|
||||
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -7,19 +7,31 @@ using System.Collections.Generic;
|
|||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Dinah.Core;
|
||||
using System.Linq;
|
||||
using FileManager;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
||||
{
|
||||
public partial class SettingsDialog : DialogWindow
|
||||
{
|
||||
private SettingsPages settingsDisp;
|
||||
|
||||
private readonly Configuration config = Configuration.Instance;
|
||||
public SettingsDialog()
|
||||
{
|
||||
if (Design.IsDesignMode)
|
||||
AudibleUtilities.AudibleApiStorage.EnsureAccountsSettingsFileExists();
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = settingsDisp = new(Configuration.Instance);
|
||||
DataContext = settingsDisp = new(config);
|
||||
|
||||
tabItem1 = this.Find<TabItem>("tabItem1");
|
||||
tabItem1.GotFocus += TabItem1_GotFocus;
|
||||
}
|
||||
|
||||
private void TabItem1_GotFocus(object sender, Avalonia.Input.GotFocusEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
|
@ -28,8 +40,8 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
}
|
||||
protected override async Task SaveAndCloseAsync()
|
||||
{
|
||||
|
||||
|
||||
settingsDisp.SaveSettings(config);
|
||||
await MessageBox.VerboseLoggingWarning_ShowIfTrue();
|
||||
await base.SaveAndCloseAsync();
|
||||
}
|
||||
public async void SaveButton_Clicked(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
|
|
@ -37,29 +49,42 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
|
||||
|
||||
|
||||
public void OpenLogFolderButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName);
|
||||
}
|
||||
|
||||
|
||||
public void EditFolderTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.FolderTemplate);
|
||||
if (newTemplate is not null)
|
||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
||||
settingsDisp.DownloadDecryptSettings.FolderTemplate = newTemplate;
|
||||
}
|
||||
|
||||
|
||||
public void EditFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.FileTemplate);
|
||||
if (newTemplate is not null)
|
||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
||||
settingsDisp.DownloadDecryptSettings.FileTemplate = newTemplate;
|
||||
}
|
||||
|
||||
|
||||
public void EditChapterFileTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.AudioSettings.ChapterTitleTemplate);
|
||||
var newTemplate = editTemplate(Templates.ChapterTitle, settingsDisp.DownloadDecryptSettings.ChapterFileTemplate);
|
||||
if (newTemplate is not null)
|
||||
settingsDisp.AudioSettings.ChapterTitleTemplate = newTemplate;
|
||||
settingsDisp.DownloadDecryptSettings.ChapterFileTemplate = newTemplate;
|
||||
}
|
||||
|
||||
|
||||
public void EditCharReplacementButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
var form = new LibationWinForms.Dialogs.EditReplacementChars(config);
|
||||
form.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
public void EditChapterTitleTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
|
|
@ -84,19 +109,120 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
void SaveSettings(Configuration config);
|
||||
}
|
||||
|
||||
public class SettingsPages
|
||||
public class SettingsPages : ISettingsTab
|
||||
{
|
||||
public Configuration config { get; }
|
||||
public SettingsPages(Configuration config)
|
||||
{
|
||||
this.config = config;
|
||||
AudioSettings = new(config);
|
||||
DownloadDecryptSettings = new(config);
|
||||
LoadSettings(config);
|
||||
}
|
||||
|
||||
public ImportantSettings ImportantSettings { get; private set; }
|
||||
public ImportSettings ImportSettings { get; private set; }
|
||||
public DownloadDecryptSettings DownloadDecryptSettings { get; private set; }
|
||||
public AudioSettings AudioSettings { get; private set; }
|
||||
|
||||
public void LoadSettings(Configuration config)
|
||||
{
|
||||
ImportantSettings = new(config);
|
||||
ImportSettings = new(config);
|
||||
DownloadDecryptSettings = new(config);
|
||||
AudioSettings = new(config);
|
||||
}
|
||||
|
||||
public void SaveSettings(Configuration config)
|
||||
{
|
||||
ImportantSettings.SaveSettings(config);
|
||||
ImportSettings.SaveSettings(config);
|
||||
DownloadDecryptSettings.SaveSettings(config);
|
||||
AudioSettings.SaveSettings(config);
|
||||
}
|
||||
public AudioSettings AudioSettings { get;}
|
||||
public DownloadDecryptSettings DownloadDecryptSettings { get;}
|
||||
}
|
||||
|
||||
public class ImportantSettings : ISettingsTab
|
||||
{
|
||||
private static Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||
|
||||
public ImportantSettings(Configuration config)
|
||||
{
|
||||
LoadSettings(config);
|
||||
}
|
||||
|
||||
public void LoadSettings(Configuration config)
|
||||
{
|
||||
BooksDirectory = config.Books;
|
||||
SavePodcastsToParentFolder = config.SavePodcastsToParentFolder;
|
||||
LoggingLevel = config.LogLevel;
|
||||
BetaOptIn = config.BetaOptIn;
|
||||
}
|
||||
|
||||
public void SaveSettings(Configuration config)
|
||||
{
|
||||
config.Books = BooksDirectory;
|
||||
config.SavePodcastsToParentFolder = SavePodcastsToParentFolder;
|
||||
config.LogLevel = LoggingLevel;
|
||||
config.BetaOptIn = BetaOptIn;
|
||||
}
|
||||
|
||||
|
||||
public List<Configuration.KnownDirectories> KnownDirectories { get; } = new()
|
||||
{
|
||||
Configuration.KnownDirectories.UserProfile,
|
||||
Configuration.KnownDirectories.AppDir,
|
||||
Configuration.KnownDirectories.MyDocs
|
||||
};
|
||||
|
||||
public string BooksText => desc(nameof(Configuration.Books));
|
||||
public string SavePodcastsToParentFolderText => desc(nameof(Configuration.SavePodcastsToParentFolder));
|
||||
public Serilog.Events.LogEventLevel[] LoggingLevels { get; } = Enum.GetValues<Serilog.Events.LogEventLevel>();
|
||||
public string BetaOptInText => desc(nameof(Configuration.BetaOptIn));
|
||||
|
||||
public string BooksDirectory { get; set; }
|
||||
public bool SavePodcastsToParentFolder { get; set; }
|
||||
public Serilog.Events.LogEventLevel LoggingLevel { get; set; }
|
||||
public bool BetaOptIn { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ImportSettings : ISettingsTab
|
||||
{
|
||||
private static Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||
|
||||
public ImportSettings(Configuration config)
|
||||
{
|
||||
LoadSettings(config);
|
||||
}
|
||||
|
||||
public void LoadSettings(Configuration config)
|
||||
{
|
||||
AutoScan = config.AutoScan;
|
||||
ShowImportedStats = config.ShowImportedStats;
|
||||
ImportEpisodes = config.ImportEpisodes;
|
||||
DownloadEpisodes = config.DownloadEpisodes;
|
||||
AutoDownloadEpisodes = config.AutoDownloadEpisodes;
|
||||
}
|
||||
|
||||
public void SaveSettings(Configuration config)
|
||||
{
|
||||
config.AutoScan = AutoScan;
|
||||
config.ShowImportedStats = ShowImportedStats;
|
||||
config.ImportEpisodes = ImportEpisodes;
|
||||
config.DownloadEpisodes = DownloadEpisodes;
|
||||
config.AutoDownloadEpisodes = AutoDownloadEpisodes;
|
||||
}
|
||||
|
||||
public string AutoScanText => desc(nameof(Configuration.AutoScan));
|
||||
public string ShowImportedStatsText => desc(nameof(Configuration.ShowImportedStats));
|
||||
public string ImportEpisodesText => desc(nameof(Configuration.ImportEpisodes));
|
||||
public string DownloadEpisodesText => desc(nameof(Configuration.DownloadEpisodes));
|
||||
public string AutoDownloadEpisodesText => desc(nameof(Configuration.AutoDownloadEpisodes));
|
||||
|
||||
public bool AutoScan { get; set; }
|
||||
public bool ShowImportedStats { get; set; }
|
||||
public bool ImportEpisodes { get; set; }
|
||||
public bool DownloadEpisodes { get; set; }
|
||||
public bool AutoDownloadEpisodes { get; set; }
|
||||
}
|
||||
|
||||
public class DownloadDecryptSettings : ViewModels.ViewModelBase, ISettingsTab
|
||||
{
|
||||
private static Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||
|
|
@ -115,6 +241,7 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
LoadSettings(config);
|
||||
}
|
||||
|
||||
public Configuration.KnownDirectories InProgressDirectory { get; set; }
|
||||
public void LoadSettings(Configuration config)
|
||||
{
|
||||
BadBookAsk = config.BadBook is Configuration.BadBookAction.Ask;
|
||||
|
|
@ -124,6 +251,9 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
FolderTemplate = config.FolderTemplate;
|
||||
FileTemplate = config.FileTemplate;
|
||||
ChapterFileTemplate = config.ChapterFileTemplate;
|
||||
InProgressDirectory
|
||||
= config.InProgress == Configuration.AppDir_Absolute ? Configuration.KnownDirectories.AppDir
|
||||
: Configuration.GetKnownDirectory(config.InProgress);
|
||||
}
|
||||
|
||||
public void SaveSettings(Configuration config)
|
||||
|
|
@ -137,6 +267,9 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
config.FolderTemplate = FolderTemplate;
|
||||
config.FileTemplate = FileTemplate;
|
||||
config.ChapterFileTemplate = ChapterFileTemplate;
|
||||
config.InProgress
|
||||
= InProgressDirectory is Configuration.KnownDirectories.AppDir ? Configuration.AppDir_Absolute
|
||||
: Configuration.GetKnownDirectoryPath(InProgressDirectory);
|
||||
}
|
||||
|
||||
public string BadBookGroupboxText => desc(nameof(Configuration.BadBook));
|
||||
|
|
@ -144,11 +277,11 @@ namespace LibationWinForms.AvaloniaUI.Views.Dialogs
|
|||
public string BadBookAbortText { get; } = Configuration.BadBookAction.Abort.GetDescription();
|
||||
public string BadBookRetryText { get; } = Configuration.BadBookAction.Retry.GetDescription();
|
||||
public string BadBookIgnoreText { get; } = Configuration.BadBookAction.Ignore.GetDescription();
|
||||
|
||||
public string FolderTemplateText => desc(nameof(Configuration.FolderTemplate));
|
||||
public string FileTemplateText => desc(nameof(Configuration.FileTemplate));
|
||||
public string ChapterFileTemplateText => desc(nameof(Configuration.ChapterFileTemplate));
|
||||
public string? EditCharReplacementText => desc(nameof(Configuration.ReplacementCharacters));
|
||||
public string EditCharReplacementText => desc(nameof(Configuration.ReplacementCharacters));
|
||||
public string InProgressDescriptionText => desc(nameof(Configuration.InProgress));
|
||||
|
||||
public string FolderTemplate { get => _folderTemplate; set { this.RaiseAndSetIfChanged(ref _folderTemplate, value); } }
|
||||
public string FileTemplate { get => _fileTemplate; set { this.RaiseAndSetIfChanged(ref _fileTemplate, value); } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue