Skip to content

Commit

Permalink
fix(settings): add persistence for 'sub-sync' option
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Jan 10, 2025
1 parent 07ce976 commit 312f38e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions SubRenamer/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public partial class Config
public string VideoRegex { get; set; } = "";
public string SubtitleRegex { get; set; } = "";

public bool SubSyncEnabled { get; set; } = true;

// Manual Match Mode Configs
public string ManualVideoRegex { get; set; } = "";
public string ManualSubtitleRegex { get; set; } = "";
Expand Down
7 changes: 3 additions & 4 deletions SubRenamer/Helper/MatcherDataConverter.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System.Collections.Generic;
using System.Linq;
using SubRenamer.Core;

namespace SubRenamer.Helper;

public static class MatcherDataConverter
{
public static List<MatchItem> ConvertMatchItems(IReadOnlyList<Model.MatchItem> matchItems)
public static List<Core.MatchItem> ConvertMatchItems(IReadOnlyList<Model.MatchItem> matchItems)
{
return matchItems.Select(item => new MatchItem(item.Key, item.Video, item.Subtitle)).ToList();
return matchItems.Select(item => new Core.MatchItem(item.Key, item.Video, item.Subtitle)).ToList();
}

public static List<Model.MatchItem> ConvertMatchItems(IReadOnlyList<MatchItem> matchItems)
public static List<Model.MatchItem> ConvertMatchItems(IReadOnlyList<Core.MatchItem> matchItems)
{
return matchItems.Select(item => new Model.MatchItem(item.Key, item.Video, item.Subtitle)).ToList();
}
Expand Down
6 changes: 3 additions & 3 deletions SubRenamer/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ private void Run()

#region SubSync
[ObservableProperty] private bool _subSyncAvailable = true;
[ObservableProperty] private bool _subSyncEnabled = true;
[ObservableProperty] private bool _subSyncEnabled = Config.Get().SubSyncEnabled;

// partial void OnSubSyncEnabledChanged(bool value)
// => AllowExecute = !value || SubSyncServerLoaded;
partial void OnSubSyncEnabledChanged(bool value)
=> Config.Get().SubSyncEnabled = value;
#endregion

#region Match
Expand Down

0 comments on commit 312f38e

Please sign in to comment.