From 849db78809f9fe48a0cf97a0c56d185ced1393aa Mon Sep 17 00:00:00 2001 From: Mateusz Skoczek Date: Tue, 5 Mar 2024 15:51:21 +0100 Subject: [PATCH] notifications settings fix, processing settings added, settings restore button added --- .../Strings/en-US/CommonResources.resw | 27 ++++++ .../Strings/en-US/SettingsViewResources.resw | 23 ++++- .../Settings/SettingsViewModel.cs | 45 ++++++++++ .../Settings/SettingsView.xaml | 81 +++++++++++++++++- .../ProcessingFFmpegLocationDark.png | Bin 0 -> 18860 bytes .../ProcessingFFmpegLocationLight.png | Bin 0 -> 24198 bytes .../SettingsView/ProcessingSpeedDark.png | Bin 0 -> 21903 bytes .../SettingsView/ProcessingSpeedLight.png | Bin 0 -> 51812 bytes .../ProcessingUseHardwareAccelerationDark.png | Bin 0 -> 28079 bytes ...ProcessingUseHardwareAccelerationLight.png | Bin 0 -> 16554 bytes .../ProcessingUseMultithreadingDark.png | Bin 0 -> 16547 bytes .../ProcessingUseMultithreadingLight.png | Bin 0 -> 35344 bytes .../Images/ImagesSettingsView.xaml | 8 ++ VDownload/VDownload.csproj | 26 ++++++ 14 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 VDownload/Assets/SettingsView/ProcessingFFmpegLocationDark.png create mode 100644 VDownload/Assets/SettingsView/ProcessingFFmpegLocationLight.png create mode 100644 VDownload/Assets/SettingsView/ProcessingSpeedDark.png create mode 100644 VDownload/Assets/SettingsView/ProcessingSpeedLight.png create mode 100644 VDownload/Assets/SettingsView/ProcessingUseHardwareAccelerationDark.png create mode 100644 VDownload/Assets/SettingsView/ProcessingUseHardwareAccelerationLight.png create mode 100644 VDownload/Assets/SettingsView/ProcessingUseMultithreadingDark.png create mode 100644 VDownload/Assets/SettingsView/ProcessingUseMultithreadingLight.png diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw index 08fb142..9632010 100644 --- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw @@ -126,6 +126,33 @@ Original + + Fast + + + Faster + + + Medium + + + Slow + + + Slower + + + Super fast + + + Ultra fast + + + Very fast + + + Very slow + You are trying to download a video using a metered connection. Do you want to continue? diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw index 9ebfef6..afeb536 100644 --- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw @@ -129,6 +129,27 @@ Show notifications when task ended unsuccessfully + + FFmpeg location + + + Browse + + + Processing + + + Speed + + + Use hardware acceleration + + + Use multithreading + + + Restore settings to default + Searching @@ -163,7 +184,7 @@ Maximum number of tasks running in parallel - Otherwise, default directory defined below will be used + Otherwise, default directory defined below (after expanding) will be used Save last output directory diff --git a/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs index fb98fa7..9ea848e 100644 --- a/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs +++ b/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs @@ -3,6 +3,7 @@ using CommunityToolkit.Mvvm.Input; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using VDownload.Models; @@ -76,6 +77,30 @@ namespace VDownload.Core.ViewModels.Settings set => SetProperty(_settingsService.Data.Common.Tasks.DefaultOutputDirectory, value, _settingsService.Data.Common.Tasks, (u, n) => u.DefaultOutputDirectory = n); } + public string ProcessingFFmpegLocation + { + get => _settingsService.Data.Common.Processing.FFmpegLocation; + set => SetProperty(_settingsService.Data.Common.Processing.FFmpegLocation, value, _settingsService.Data.Common.Processing, (u, n) => u.FFmpegLocation = n); + } + + public bool ProcessingUseHardwareAcceleration + { + get => _settingsService.Data.Common.Processing.UseHardwareAcceleration; + set => SetProperty(_settingsService.Data.Common.Processing.UseHardwareAcceleration, value, _settingsService.Data.Common.Processing, (u, n) => u.UseHardwareAcceleration = n); + } + + public bool ProcessingUseMultithreading + { + get => _settingsService.Data.Common.Processing.UseMultithreading; + set => SetProperty(_settingsService.Data.Common.Processing.UseMultithreading, value, _settingsService.Data.Common.Processing, (u, n) => u.UseMultithreading = n); + } + + public ProcessingSpeed ProcessingSpeed + { + get => _settingsService.Data.Common.Processing.Speed; + set => SetProperty(_settingsService.Data.Common.Processing.Speed, value, _settingsService.Data.Common.Processing, (u, n) => u.Speed = n); + } + public bool NotificationsOnSuccessful { get => _settingsService.Data.Common.Notifications.OnSuccessful; @@ -177,6 +202,26 @@ namespace VDownload.Core.ViewModels.Settings } } + [RelayCommand] + public async Task BrowseProcessingFFmpegLocation() + { + string? newDirectory = await _storagePickerService.OpenDirectory(); + if (newDirectory is not null) + { + this.ProcessingFFmpegLocation = newDirectory; + } + } + + [RelayCommand] + public async Task RestoreToDefault() + { + await _settingsService.Restore(); + foreach (PropertyInfo property in this.GetType().GetProperties()) + { + base.OnPropertyChanged(property.Name); + } + } + #endregion diff --git a/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml b/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml index 97a3bdf..8fcb718 100644 --- a/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml +++ b/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml @@ -122,6 +122,78 @@ + + + + + + + +