diff --git a/OF DL.Core/Models/Config/Config.cs b/OF DL.Core/Models/Config/Config.cs index 7eeac51..c83e71b 100644 --- a/OF DL.Core/Models/Config/Config.cs +++ b/OF DL.Core/Models/Config/Config.cs @@ -105,8 +105,11 @@ public class Config : IFileNameFormatConfig [ToggleableConfig] public bool DisableTextSanitization { get; set; } public string? PaidPostFileNameFormat { get; set; } = ""; + public string? PostFileNameFormat { get; set; } = ""; + public string? PaidMessageFileNameFormat { get; set; } = ""; + public string? MessageFileNameFormat { get; set; } = ""; public IFileNameFormatConfig GetCreatorFileNameFormatConfig(string username) diff --git a/OF DL.Gui/ViewModels/ConfigFieldViewModel.cs b/OF DL.Gui/ViewModels/ConfigFieldViewModel.cs index cc8ea3c..59d5179 100644 --- a/OF DL.Gui/ViewModels/ConfigFieldViewModel.cs +++ b/OF DL.Gui/ViewModels/ConfigFieldViewModel.cs @@ -48,6 +48,18 @@ public partial class ConfigFieldViewModel : ViewModelBase ["dark"] = "Dark" }; + private static readonly Dictionary s_displayNameOverridesByProperty = + new(StringComparer.Ordinal) + { + [nameof(Config.PostFileNameFormat)] = "Free Post File Name Format", + [nameof(Config.MessageFileNameFormat)] = "Free Message File Name Format", + [nameof(Config.DownloadVideoResolution)] = "Video Resolution", + [nameof(Config.IgnoredUsersListName)] = "Ignored Users List", + [nameof(Config.RenameExistingFilesWhenCustomFormatIsSelected)] = + "Rename Existing Files with Custom Formats", + [nameof(Config.DownloadPath)] = "Download Folder" + }; + public ConfigFieldViewModel( PropertyInfo propertyInfo, object? initialValue, @@ -56,7 +68,7 @@ public partial class ConfigFieldViewModel : ViewModelBase { PropertyInfo = propertyInfo; PropertyName = propertyInfo.Name; - DisplayName = ToDisplayName(propertyInfo.Name); + DisplayName = GetDisplayName(propertyInfo.Name); PropertyType = propertyInfo.PropertyType; HelpText = helpText?.Trim() ?? string.Empty; @@ -86,7 +98,8 @@ public partial class ConfigFieldViewModel : ViewModelBase } SelectedFileNameVariable = AvailableFileNameVariables.FirstOrDefault(); - string availableVariables = string.Join(", ", AvailableFileNameVariables.Select(variable => $"{{{variable}}}")); + string availableVariables = + string.Join(", ", AvailableFileNameVariables.Select(variable => $"{{{variable}}}")); string fileNameHelpText = $"Available variables: {availableVariables}. Include {{mediaId}} or {{filename}} to avoid collisions."; HelpText = string.IsNullOrWhiteSpace(HelpText) @@ -165,13 +178,11 @@ public partial class ConfigFieldViewModel : ViewModelBase private string _actualTextValue = string.Empty; - [ObservableProperty] - private string _textValue = string.Empty; + [ObservableProperty] private string _textValue = string.Empty; private bool _isNormalizingFileNameFormatInput; - [ObservableProperty] - [NotifyCanExecuteChangedFor(nameof(InsertSelectedFileNameVariableCommand))] + [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(InsertSelectedFileNameVariableCommand))] private string? _selectedFileNameVariable; private bool IsPathField => @@ -180,16 +191,13 @@ public partial class ConfigFieldViewModel : ViewModelBase [ObservableProperty] private ConfigSelectOptionViewModel? _selectedIgnoredUsersListOption; - [ObservableProperty] - [NotifyPropertyChangedFor(nameof(HasHelpText))] + [ObservableProperty] [NotifyPropertyChangedFor(nameof(HasHelpText))] private string _helpText = string.Empty; - [ObservableProperty] - [NotifyPropertyChangedFor(nameof(HasUnknownFileNameVariables))] + [ObservableProperty] [NotifyPropertyChangedFor(nameof(HasUnknownFileNameVariables))] private string _unknownFileNameVariablesMessage = string.Empty; - [ObservableProperty] - [NotifyPropertyChangedFor(nameof(HasError))] + [ObservableProperty] [NotifyPropertyChangedFor(nameof(HasError))] private string _errorMessage = string.Empty; public bool HasError => !string.IsNullOrWhiteSpace(ErrorMessage); @@ -232,7 +240,7 @@ public partial class ConfigFieldViewModel : ViewModelBase if (PropertyType == typeof(string)) { // Use actual value for path fields when privacy mode is enabled - string textToUse = (Program.HidePrivateInfo && IsPathField) ? _actualTextValue : TextValue; + string textToUse = Program.HidePrivateInfo && IsPathField ? _actualTextValue : TextValue; value = textToUse.Trim(); return true; } @@ -311,15 +319,9 @@ public partial class ConfigFieldViewModel : ViewModelBase return false; } - public void ClearError() - { - ErrorMessage = string.Empty; - } + public void ClearError() => ErrorMessage = string.Empty; - public void SetError(string message) - { - ErrorMessage = message; - } + public void SetError(string message) => ErrorMessage = message; public void SetIgnoredUsersListOptions(IEnumerable listNames) { @@ -428,6 +430,7 @@ public partial class ConfigFieldViewModel : ViewModelBase { EnumValue = EnumOptions.FirstOrDefault(); } + return; } @@ -548,4 +551,9 @@ public partial class ConfigFieldViewModel : ViewModelBase ? $" {character}" : character.ToString())); } + + private static string GetDisplayName(string propertyName) => + s_displayNameOverridesByProperty.TryGetValue(propertyName, out string? displayName) + ? displayName + : ToDisplayName(propertyName); } diff --git a/OF DL.Gui/ViewModels/MainWindowViewModel.cs b/OF DL.Gui/ViewModels/MainWindowViewModel.cs index 2aafb5d..d00d400 100644 --- a/OF DL.Gui/ViewModels/MainWindowViewModel.cs +++ b/OF DL.Gui/ViewModels/MainWindowViewModel.cs @@ -43,15 +43,15 @@ public partial class MainWindowViewModel( private static readonly (string DisplayName, string PropertyName)[] s_mediaSourceOptions = [ - ("Avatar/Header Photo", nameof(Config.DownloadAvatarHeaderPhoto)), - ("Posts", nameof(Config.DownloadPosts)), + ("Free Posts", nameof(Config.DownloadPosts)), ("Paid Posts", nameof(Config.DownloadPaidPosts)), + ("Free Messages", nameof(Config.DownloadMessages)), + ("Paid Messages", nameof(Config.DownloadPaidMessages)), ("Archived", nameof(Config.DownloadArchived)), ("Streams", nameof(Config.DownloadStreams)), ("Stories", nameof(Config.DownloadStories)), ("Highlights", nameof(Config.DownloadHighlights)), - ("Messages", nameof(Config.DownloadMessages)), - ("Paid Messages", nameof(Config.DownloadPaidMessages)) + ("Avatar/Header Photo", nameof(Config.DownloadAvatarHeaderPhoto)) ]; private static readonly Dictionary s_configHelpTextByProperty = new(StringComparer.Ordinal) @@ -1247,10 +1247,10 @@ public partial class MainWindowViewModel( return propertyName switch { nameof(Config.RenameExistingFilesWhenCustomFormatIsSelected) => 0, - nameof(Config.PaidPostFileNameFormat) => 1, - nameof(Config.PostFileNameFormat) => 2, - nameof(Config.PaidMessageFileNameFormat) => 3, - nameof(Config.MessageFileNameFormat) => 4, + nameof(Config.PostFileNameFormat) => 1, + nameof(Config.PaidPostFileNameFormat) => 2, + nameof(Config.MessageFileNameFormat) => 3, + nameof(Config.PaidMessageFileNameFormat) => 4, nameof(Config.CreatorConfigs) => 5, _ => 100 }; diff --git a/OF DL.Gui/Views/MainWindow.axaml b/OF DL.Gui/Views/MainWindow.axaml index 95dcc60..3ce583c 100644 --- a/OF DL.Gui/Views/MainWindow.axaml +++ b/OF DL.Gui/Views/MainWindow.axaml @@ -48,7 +48,7 @@ - + @@ -530,14 +530,14 @@ ToolTip.Tip="{Binding FolderStructureHelpText}" /> - - + + @@ -1005,6 +1005,47 @@ Foreground="{DynamicResource TextSecondaryBrush}" Text="File Name Formats (leave blank to use global defaults)" /> + + + + + + + + +