Skip to content

Commit

Permalink
Added support for PreferSoftSubtitles to Config screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcclive committed Apr 19, 2021
1 parent f565ad1 commit 0e2eed1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Tricycle.UI.Tests/ViewModels/ConfigViewModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ public void LoadsPreferForcedSubtitlesFromConfig()
}

[TestMethod]
public void LoadsOverlaySubtitlesFromConfig()
public void LoadsPreferSoftSubtitlesFromConfig()
{
_tricycleConfig.PreferSoftSubtitles = true;
_viewModel.Initialize();

Assert.AreEqual(_tricycleConfig.PreferSoftSubtitles, _viewModel.OverlaySubtitles);
Assert.AreEqual(_tricycleConfig.PreferSoftSubtitles, _viewModel.PreferSoftSubtitles);
}

[TestMethod]
Expand Down Expand Up @@ -970,15 +970,15 @@ public void SavesPreferForcedSubtitlesToConfig()
}

[TestMethod]
public void SavesOverlaySubtitlesToConfig()
public void SavesPreferSoftSubtitlesToConfig()
{
bool overlaySubtitles = true;
bool preferSoftSubtitles = true;

_viewModel.Initialize();
_viewModel.OverlaySubtitles = overlaySubtitles;
_viewModel.PreferSoftSubtitles = preferSoftSubtitles;
_viewModel.Close();

Assert.AreEqual(overlaySubtitles, _tricycleConfigManager.Config?.PreferSoftSubtitles);
Assert.AreEqual(preferSoftSubtitles, _tricycleConfigManager.Config?.PreferSoftSubtitles);
}

[TestMethod]
Expand Down
12 changes: 6 additions & 6 deletions Tricycle.UI/ViewModels/ConfigViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ConfigViewModel : ViewModelBase
bool _alertOnCompletion;
bool _deleteIncompleteFiles;
bool _preferForcedSubtitles;
bool _overlaySubtitles;
bool _preferSoftSubtitles;
string _mp4FileExtension;
string _mkvFileExtension;
string _destinationDirectory;
Expand Down Expand Up @@ -166,10 +166,10 @@ public bool PreferForcedSubtitles
set => SetProperty(ref _preferForcedSubtitles, value);
}

public bool OverlaySubtitles
public bool PreferSoftSubtitles
{
get => _overlaySubtitles;
set => SetProperty(ref _overlaySubtitles, value);
get => _preferSoftSubtitles;
set => SetProperty(ref _preferSoftSubtitles, value);
}

public string Mp4FileExtension
Expand Down Expand Up @@ -406,7 +406,7 @@ void Load(TricycleConfig config)
AlertOnCompletion = config.CompletionAlert;
DeleteIncompleteFiles = config.DeleteIncompleteFiles;
PreferForcedSubtitles = config.ForcedSubtitlesOnly;
OverlaySubtitles = config.PreferSoftSubtitles;
PreferSoftSubtitles = config.PreferSoftSubtitles;
Mp4FileExtension = config.DefaultFileExtensions?.GetValueOrDefault(ContainerFormat.Mp4);
MkvFileExtension = config.DefaultFileExtensions?.GetValueOrDefault(ContainerFormat.Mkv);
SelectedDestinationDirectoryMode = new ListItem(config.DestinationDirectoryMode);
Expand Down Expand Up @@ -578,7 +578,7 @@ TricycleConfig GenerateTricycleConfig()
CompletionAlert = AlertOnCompletion,
DeleteIncompleteFiles = DeleteIncompleteFiles,
ForcedSubtitlesOnly = PreferForcedSubtitles,
PreferSoftSubtitles = OverlaySubtitles,
PreferSoftSubtitles = PreferSoftSubtitles,
Audio = GenerateTricycleAudioConfig(),
Video = GenerateTricycleVideoConfig(),
DefaultFileExtensions = new Dictionary<ContainerFormat, string>()
Expand Down
4 changes: 2 additions & 2 deletions Tricycle.UI/Views/GeneralConfigSection.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<Switch IsToggled="{Binding DeleteIncompleteFiles}" VerticalOptions="Center" Grid.Column="1" Grid.Row="1" />
<Label Text="Prefer forced subtitles" VerticalOptions="Center" Grid.Column="0" Grid.Row="2" />
<Switch IsToggled="{Binding PreferForcedSubtitles}" VerticalOptions="Center" Grid.Column="1" Grid.Row="2" />
<Label Text="Overlay subtitles" VerticalOptions="Center" Grid.Column="0" Grid.Row="3" />
<Switch IsToggled="{Binding OverlaySubtitles}" VerticalOptions="Center" Grid.Column="1" Grid.Row="3" />
<Label Text="Use soft subtitles when supported" VerticalOptions="Center" Grid.Column="0" Grid.Row="3" />
<Switch IsToggled="{Binding PreferSoftSubtitles}" VerticalOptions="Center" Grid.Column="1" Grid.Row="3" />
<Label Text="MP4 file extension" VerticalOptions="Center" Grid.Column="0" Grid.Row="4" />
<Entry Text="{Binding Mp4FileExtension}" Grid.Column="1" Grid.Row="4" />
<Label Text="MKV file extension" VerticalOptions="Center" Grid.Column="0" Grid.Row="5" />
Expand Down

0 comments on commit 0e2eed1

Please sign in to comment.