Skip to content

Commit

Permalink
Shared - Remember Generic File Type
Browse files Browse the repository at this point in the history
Fixes #705
  • Loading branch information
nlogozzo committed Dec 24, 2023
1 parent f4b9e21 commit f2a902d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions NickvisionTubeConverter.GNOME/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public Program(string[] args)
_mainWindowController.AppInfo.Changelog =
@"* Fixed an issue where split chapters were not renamed correctly
* Fixed an issue where videos would not download greater than 1080p resolution
* Parabolic will now remember the chosen file type for generic downloads
* Updated translations (Thanks everyone on Weblate!)";
_application.OnActivate += OnActivate;
g_signal_connect_data(_application.Handle, "open", _openCallback, IntPtr.Zero, IntPtr.Zero, 0);
Expand Down
6 changes: 5 additions & 1 deletion NickvisionTubeConverter.GNOME/Views/AddDownloadDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ await Task.Run(async () =>
if (_controller.DisallowConversions)
{
_fileTypeRow.SetModel(Gtk.StringList.New(new string[] { _("Video"), _("Audio") }));
_fileTypeRow.SetSelected(0);
_fileTypeRow.SetSelected(_controller.PreviousGenericMediaFileType switch
{
MediaFileType.Audio => 1,
_ => 0
});
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public class AddDownloadDialogController
/// </summary>
public MediaFileType PreviousMediaFileType => Configuration.Current.PreviousMediaFileType;
/// <summary>
/// The previously used generic MediaFileType
/// </summary>
public MediaFileType PreviousGenericMediaFileType => Configuration.Current.PreviousGenericMediaFileType;
/// <summary>
/// The previously used subtitle downloading state
/// </summary>
public bool PreviousSubtitleState => Configuration.Current.PreviousSubtitleState;
Expand Down Expand Up @@ -271,7 +275,11 @@ public void PopulateDownloads(MediaFileType mediaFileType, Quality quality, int?
}
}
Configuration.Current.PreviousSaveFolder = saveFolder;
if (!mediaFileType.GetIsGeneric())
if (mediaFileType.GetIsGeneric())
{
Configuration.Current.PreviousGenericMediaFileType = mediaFileType;
}
else
{
Configuration.Current.PreviousMediaFileType = mediaFileType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<description translatable="no">
<p>- Fixed an issue where split chapters were not renamed correctly</p>
<p>- Fixed an issue where videos would not download greater than 1080p resolution</p>
<p>- Parabolic will now remember the chosen file type for generic downloads</p>
<p>- Updated translations (Thanks everyone on Weblate!)</p>
</description>
</release>
Expand Down
5 changes: 5 additions & 0 deletions NickvisionTubeConverter.Shared/Models/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public class Configuration : ConfigurationBase
/// </summary>
public MediaFileType PreviousMediaFileType { get; set; }
/// <summary>
/// The previously used generic media file type
/// </summary>
public MediaFileType PreviousGenericMediaFileType { get; set; }
/// <summary>
/// The previously used video resolution
/// </summary>
public string PreviousVideoResolution { get; set; }
Expand Down Expand Up @@ -193,6 +197,7 @@ public Configuration()
//Remember
PreviousSaveFolder = "";
PreviousMediaFileType = MediaFileType.MP4;
PreviousGenericMediaFileType = MediaFileType.Video;
PreviousVideoResolution = "";
PreviousSubtitleState = false;
PreviousPreferAV1State = false;
Expand Down
1 change: 1 addition & 0 deletions NickvisionTubeConverter.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public App()
_controller = new MainWindowController(Array.Empty<string>());
_controller.AppInfo.Changelog = @"- Fixed an issue where split chapters were not renamed correctly
- Fixed an issue where videos would not download greater than 1080p resolution
- Parabolic will now remember the chosen file type for generic downloads
- Redesigned the app's UI
- Updated translations (Thanks everyone on Weblate!)";
if (_controller.Theme != Theme.System)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ private async Task SearchUrlAsync(string url)
if (_controller.DisallowConversions)
{
CmbFileType.ItemsSource = new string[] { _("Video"), _("Audio") };
CmbFileType.SelectedIndex = 0;
CmbFileType.SelectedIndex = _controller.PreviousGenericMediaFileType switch
{
MediaFileType.Audio => 1,
_ => 0
};
}
else
{
Expand Down

0 comments on commit f2a902d

Please sign in to comment.