tasks settings added, app icon added
This commit is contained in:
@@ -117,6 +117,15 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MediaTypeOnlyAudio.Text" xml:space="preserve">
|
||||
<value>Only audio</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyVideo.Text" xml:space="preserve">
|
||||
<value>Only video</value>
|
||||
</data>
|
||||
<data name="MediaTypeOriginal.Text" xml:space="preserve">
|
||||
<value>Original</value>
|
||||
</data>
|
||||
<data name="StartAtMeteredConnectionDialogMessage" xml:space="preserve">
|
||||
<value>You are trying to download a video using a metered connection. Do you want to continue?</value>
|
||||
</data>
|
||||
|
||||
@@ -117,15 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="MediaTypeOnlyAudio.Text" xml:space="preserve">
|
||||
<value>Only audio</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyVideo.Text" xml:space="preserve">
|
||||
<value>Only video</value>
|
||||
</data>
|
||||
<data name="MediaTypeOriginal.Text" xml:space="preserve">
|
||||
<value>Original</value>
|
||||
</data>
|
||||
<data name="StatusCancelled.Text" xml:space="preserve">
|
||||
<value>Cancelled</value>
|
||||
</data>
|
||||
|
||||
@@ -180,15 +180,6 @@
|
||||
<data name="MediaOptionsHeader.Text" xml:space="preserve">
|
||||
<value>Media options</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyAudio.Text" xml:space="preserve">
|
||||
<value>Only audio</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyVideo.Text" xml:space="preserve">
|
||||
<value>Only video</value>
|
||||
</data>
|
||||
<data name="MediaTypeOriginal.Text" xml:space="preserve">
|
||||
<value>Original</value>
|
||||
</data>
|
||||
<data name="MediaTypeSettingsCard.Header" xml:space="preserve">
|
||||
<value>Media type</value>
|
||||
</data>
|
||||
|
||||
@@ -144,15 +144,6 @@
|
||||
<data name="MediaOptionsHeader.Text" xml:space="preserve">
|
||||
<value>Media options</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyAudio.Text" xml:space="preserve">
|
||||
<value>Only audio</value>
|
||||
</data>
|
||||
<data name="MediaTypeOnlyVideo.Text" xml:space="preserve">
|
||||
<value>Only video</value>
|
||||
</data>
|
||||
<data name="MediaTypeOriginal.Text" xml:space="preserve">
|
||||
<value>Original</value>
|
||||
</data>
|
||||
<data name="MediaTypeSettingsCard.Header" xml:space="preserve">
|
||||
<value>Media type</value>
|
||||
</data>
|
||||
|
||||
@@ -129,6 +129,39 @@
|
||||
<data name="SearchingPlaylistCount.Header" xml:space="preserve">
|
||||
<value>Default number of videos fetched from playlist</value>
|
||||
</data>
|
||||
<data name="TasksAudioExtension.Header" xml:space="preserve">
|
||||
<value>Audio extension</value>
|
||||
</data>
|
||||
<data name="TasksDefaultMediaOptions.Header" xml:space="preserve">
|
||||
<value>Default media options</value>
|
||||
</data>
|
||||
<data name="TasksDefaultOutputDirectory.Header" xml:space="preserve">
|
||||
<value>Default output directory</value>
|
||||
</data>
|
||||
<data name="TasksDefaultOutputDirectoryButton.Content" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="TasksFilenameTemplate.Header" xml:space="preserve">
|
||||
<value>Filename template</value>
|
||||
</data>
|
||||
<data name="TasksHeader.Text" xml:space="preserve">
|
||||
<value>Tasks</value>
|
||||
</data>
|
||||
<data name="TasksMediaType.Header" xml:space="preserve">
|
||||
<value>Media type</value>
|
||||
</data>
|
||||
<data name="TasksRunningTasks.Header" xml:space="preserve">
|
||||
<value>Maximum number of tasks running in parallel</value>
|
||||
</data>
|
||||
<data name="TasksSaveLastOutputDirectory.Description" xml:space="preserve">
|
||||
<value>Otherwise, default directory defined below will be used</value>
|
||||
</data>
|
||||
<data name="TasksSaveLastOutputDirectory.Header" xml:space="preserve">
|
||||
<value>Save last output directory</value>
|
||||
</data>
|
||||
<data name="TasksVideoExtension.Header" xml:space="preserve">
|
||||
<value>Video extension</value>
|
||||
</data>
|
||||
<data name="TwitchHeader.Text" xml:space="preserve">
|
||||
<value>Twitch</value>
|
||||
</data>
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VDownload.Models;
|
||||
using VDownload.Services.Data.Configuration;
|
||||
using VDownload.Services.Data.Settings;
|
||||
using VDownload.Services.UI.StoragePicker;
|
||||
using VDownload.Services.UI.StringResources;
|
||||
|
||||
namespace VDownload.Core.ViewModels.Settings
|
||||
{
|
||||
public class SettingsViewModel : ObservableObject
|
||||
public partial class SettingsViewModel : ObservableObject
|
||||
{
|
||||
#region SERVICES
|
||||
|
||||
protected readonly ISettingsService _settingsService;
|
||||
protected readonly IConfigurationService _configurationService;
|
||||
protected readonly IStringResourcesService _stringResourcesService;
|
||||
protected readonly IStoragePickerService _storagePickerService;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -26,6 +34,48 @@ namespace VDownload.Core.ViewModels.Settings
|
||||
set => SetProperty(_settingsService.Data.Common.Searching.MaxNumberOfVideosToGetFromPlaylist, value, _settingsService.Data.Common.Searching, (u, n) => u.MaxNumberOfVideosToGetFromPlaylist = n);
|
||||
}
|
||||
|
||||
public int TasksRunningTasks
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.MaxNumberOfRunningTasks;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.MaxNumberOfRunningTasks, value, _settingsService.Data.Common.Tasks, (u, n) => u.MaxNumberOfRunningTasks = n);
|
||||
}
|
||||
|
||||
public MediaType TasksMediaType
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.DefaultMediaType;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.DefaultMediaType, value, _settingsService.Data.Common.Tasks, (u, n) => u.DefaultMediaType = n);
|
||||
}
|
||||
|
||||
public VideoExtension TasksVideoExtension
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.DefaultVideoExtension;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.DefaultVideoExtension, value, _settingsService.Data.Common.Tasks, (u, n) => u.DefaultVideoExtension = n);
|
||||
}
|
||||
|
||||
public AudioExtension TasksAudioExtension
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.DefaultAudioExtension;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.DefaultAudioExtension, value, _settingsService.Data.Common.Tasks, (u, n) => u.DefaultAudioExtension = n);
|
||||
}
|
||||
|
||||
public string TasksFilenameTemplate
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.FilenameTemplate;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.FilenameTemplate, value, _settingsService.Data.Common.Tasks, (u, n) => u.FilenameTemplate = n);
|
||||
}
|
||||
|
||||
public bool TasksSaveLastOutputDirectory
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.SaveLastOutputDirectory;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.SaveLastOutputDirectory, value, _settingsService.Data.Common.Tasks, (u, n) => u.SaveLastOutputDirectory = n);
|
||||
}
|
||||
|
||||
public string TasksDefaultOutputDirectory
|
||||
{
|
||||
get => _settingsService.Data.Common.Tasks.DefaultOutputDirectory;
|
||||
set => SetProperty(_settingsService.Data.Common.Tasks.DefaultOutputDirectory, value, _settingsService.Data.Common.Tasks, (u, n) => u.DefaultOutputDirectory = n);
|
||||
}
|
||||
|
||||
public bool TwitchVodPassiveTrimming
|
||||
{
|
||||
get => _settingsService.Data.Twitch.Vod.PassiveTrimming;
|
||||
@@ -56,17 +106,41 @@ namespace VDownload.Core.ViewModels.Settings
|
||||
set => SetProperty(_settingsService.Data.Twitch.Vod.ChunkDownloadingError.RetryDelay, value, _settingsService.Data.Twitch.Vod.ChunkDownloadingError, (u, n) => u.RetryDelay = n);
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
protected string _tasksFilenameTemplateTooltip;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public SettingsViewModel(ISettingsService settingsService)
|
||||
public SettingsViewModel(ISettingsService settingsService, IConfigurationService configurationService, IStringResourcesService stringResourcesService, IStoragePickerService storagePickerService)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
_configurationService = configurationService;
|
||||
_stringResourcesService = stringResourcesService;
|
||||
_storagePickerService = storagePickerService;
|
||||
|
||||
base.PropertyChanged += PropertyChangedEventHandler;
|
||||
|
||||
_tasksFilenameTemplateTooltip = string.Join('\n', _configurationService.Common.FilenameTemplates.Select(x => _stringResourcesService.FilenameTemplateResources.Get(x.Name)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region COMMANDS
|
||||
|
||||
[RelayCommand]
|
||||
public async Task BrowseTasksDefaultOutputDirectory()
|
||||
{
|
||||
string? newDirectory = await _storagePickerService.OpenDirectory();
|
||||
if (newDirectory is not null)
|
||||
{
|
||||
this.TasksDefaultOutputDirectory = newDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
@@ -39,6 +41,7 @@ namespace VDownload.Core.Views
|
||||
public BaseWindow(BaseViewModel viewModel)
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Activated += BaseWindow_Activated;
|
||||
|
||||
this.ExtendsContentIntoTitleBar = true;
|
||||
this.SetTitleBar(this.AppTitleBar);
|
||||
@@ -54,6 +57,14 @@ namespace VDownload.Core.Views
|
||||
|
||||
private void Root_Loaded(object sender, RoutedEventArgs e) => RootLoaded?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
private void BaseWindow_Activated(object sender, WindowActivatedEventArgs args)
|
||||
{
|
||||
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(this);
|
||||
WindowId windowId = Win32Interop.GetWindowIdFromWindow(windowHandle);
|
||||
AppWindow appWindow = AppWindow.GetFromWindowId(windowId);
|
||||
appWindow.SetIcon(@"Assets\Logo\Logo.ico");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,15 +98,15 @@
|
||||
Orientation="Horizontal">
|
||||
<ctuc:SwitchPresenter Value="{Binding DownloadOptions.MediaType, Converter={StaticResource ObjectToStringConverter}}">
|
||||
<ctuc:Case Value="Original">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeDownloadsViewResources/MediaTypeOriginal"
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOriginal"
|
||||
FontSize="{StaticResource TextSize}"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyVideo">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeDownloadsViewResources/MediaTypeOnlyVideo"
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyVideo"
|
||||
FontSize="{StaticResource TextSize}"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyAudio">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeDownloadsViewResources/MediaTypeOnlyAudio"
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyAudio"
|
||||
FontSize="{StaticResource TextSize}"/>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
|
||||
@@ -311,13 +311,13 @@
|
||||
<DataTemplate>
|
||||
<ctuc:SwitchPresenter Value="{Binding Converter={StaticResource ObjectToStringConverter}}">
|
||||
<ctuc:Case Value="Original">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomePlaylistViewResources/MediaTypeOriginal"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOriginal"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyVideo">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomePlaylistViewResources/MediaTypeOnlyVideo"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyVideo"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyAudio">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomePlaylistViewResources/MediaTypeOnlyAudio"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyAudio"/>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -111,13 +111,13 @@
|
||||
<DataTemplate>
|
||||
<ctuc:SwitchPresenter Value="{Binding Converter={StaticResource ObjectToStringConverter}}">
|
||||
<ctuc:Case Value="Original">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeVideoViewResources/MediaTypeOriginal"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOriginal"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyVideo">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeVideoViewResources/MediaTypeOnlyVideo"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyVideo"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyAudio">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/HomeVideoViewResources/MediaTypeOnlyAudio"/>
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyAudio"/>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
xmlns:ct="using:CommunityToolkit.WinUI"
|
||||
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:m="using:VDownload.Models"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ViewBackgroundColor}">
|
||||
|
||||
@@ -42,6 +43,81 @@
|
||||
SpinButtonPlacementMode="Compact"/>
|
||||
</ctc:SettingsCard>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksHeader"
|
||||
FontWeight="Bold"
|
||||
FontSize="15"/>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksRunningTasks">
|
||||
<ctc:SettingsCard.HeaderIcon>
|
||||
<BitmapIcon ShowAsMonochrome="False"
|
||||
UriSource="{ThemeResource ImageSettingsViewTasksRunningTasks}"/>
|
||||
</ctc:SettingsCard.HeaderIcon>
|
||||
<NumberBox Value="{Binding TasksRunningTasks, Mode=TwoWay}"
|
||||
Minimum="1"
|
||||
SmallChange="1"
|
||||
LargeChange="10"
|
||||
SpinButtonPlacementMode="Compact"/>
|
||||
</ctc:SettingsCard>
|
||||
<ctc:SettingsExpander x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksDefaultMediaOptions">
|
||||
<ctc:SettingsExpander.HeaderIcon>
|
||||
<BitmapIcon ShowAsMonochrome="False"
|
||||
UriSource="{ThemeResource ImageSettingsViewTasksDefaultMediaOptions}"/>
|
||||
</ctc:SettingsExpander.HeaderIcon>
|
||||
<ctc:SettingsExpander.Items>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksMediaType">
|
||||
<ComboBox ItemsSource="{ct:EnumValues Type=m:MediaType}"
|
||||
SelectedItem="{Binding TasksMediaType, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ctuc:SwitchPresenter Value="{Binding Converter={StaticResource ObjectToStringConverter}}">
|
||||
<ctuc:Case Value="Original">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOriginal"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyVideo">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyVideo"/>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="OnlyAudio">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/CommonResources/MediaTypeOnlyAudio"/>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</ctc:SettingsCard>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksVideoExtension">
|
||||
<ComboBox ItemsSource="{ct:EnumValues Type=m:VideoExtension}"
|
||||
SelectedItem="{Binding TasksVideoExtension, Mode=TwoWay}"/>
|
||||
</ctc:SettingsCard>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksAudioExtension">
|
||||
<ComboBox ItemsSource="{ct:EnumValues Type=m:AudioExtension}"
|
||||
SelectedItem="{Binding TasksAudioExtension, Mode=TwoWay}"/>
|
||||
</ctc:SettingsCard>
|
||||
</ctc:SettingsExpander.Items>
|
||||
</ctc:SettingsExpander>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksFilenameTemplate">
|
||||
<ctc:SettingsCard.HeaderIcon>
|
||||
<BitmapIcon ShowAsMonochrome="False"
|
||||
UriSource="{ThemeResource ImageSettingsViewTasksFilenameTemplate}"/>
|
||||
</ctc:SettingsCard.HeaderIcon>
|
||||
<TextBox Text="{Binding TasksFilenameTemplate, Mode=TwoWay}"
|
||||
ToolTipService.ToolTip="{Binding TasksFilenameTemplateTooltip}"/>
|
||||
</ctc:SettingsCard>
|
||||
<ctc:SettingsExpander x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksSaveLastOutputDirectory">
|
||||
<ctc:SettingsExpander.HeaderIcon>
|
||||
<BitmapIcon ShowAsMonochrome="False"
|
||||
UriSource="{ThemeResource ImageSettingsViewTasksOutputDirectory}"/>
|
||||
</ctc:SettingsExpander.HeaderIcon>
|
||||
<ToggleSwitch IsOn="{Binding TasksSaveLastOutputDirectory, Mode=TwoWay}"/>
|
||||
<ctc:SettingsExpander.Items>
|
||||
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksDefaultOutputDirectory"
|
||||
IsEnabled="{Binding TasksSaveLastOutputDirectory, Converter={StaticResource BoolNegationConverter}}"
|
||||
Description="{Binding TasksDefaultOutputDirectory}">
|
||||
<Button x:Uid="/VDownload.Core.Strings/SettingsViewResources/TasksDefaultOutputDirectoryButton"
|
||||
Command="{Binding BrowseTasksDefaultOutputDirectoryCommand}"/>
|
||||
</ctc:SettingsCard>
|
||||
</ctc:SettingsExpander.Items>
|
||||
</ctc:SettingsExpander>
|
||||
</StackPanel>
|
||||
<StackPanel Spacing="5">
|
||||
<TextBlock x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchHeader"
|
||||
FontWeight="Bold"
|
||||
|
||||
Reference in New Issue
Block a user