Skip to content

Commit

Permalink
Merge pull request #645 from NickvisionApps/subtitle
Browse files Browse the repository at this point in the history
Subtitle Enhancements + Code Cleanup
  • Loading branch information
nlogozzo authored Nov 11, 2023
2 parents b4cb5d5 + d5f70a1 commit 6d104b5
Show file tree
Hide file tree
Showing 59 changed files with 5,351 additions and 4,646 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Adw.Window _root {
}

Adw.ActionRow _subtitleRow {
title: _("Download Subtitle");
title: _("Download Subtitles");
activatable-widget: _subtitleSwitch;

[suffix]
Expand Down
173 changes: 96 additions & 77 deletions NickvisionTubeConverter.GNOME/Blueprints/preferences_dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,22 @@ Adw.PreferencesWindow _root {
}

Adw.PreferencesGroup {
title: _("Downloader");
title: _("Downloads");

Adw.ActionRow _overwriteRow {
title: _("Overwrite Existing Files");
activatable-widget: _overwriteSwitch;

[prefix]
Gtk.Image {
icon-name: "document-new-symbolic";
}

[suffix]
Gtk.Switch _overwriteSwitch {
valign: center;
}
}

Adw.ActionRow {
title: _("Max Number of Active Downloads");
Expand All @@ -96,58 +111,78 @@ Adw.PreferencesWindow _root {
}
}

Adw.ActionRow _overwriteRow {
title: _("Overwrite Existing Files");
activatable-widget: _overwriteSwitch;
Adw.ActionRow {
title: _("Limit Filename Characters");
subtitle: _("Restricts characters in filenames to only those supported by Windows.");
activatable-widget: _limitCharactersSwitch;

[prefix]
Gtk.Image {
icon-name: "document-new-symbolic";
icon-name: "insert-text-symbolic";
}

[suffix]
Gtk.Switch _overwriteSwitch {
Gtk.Switch _limitCharactersSwitch {
valign: center;
}
}

Adw.ActionRow {
title: _("Limit Filename Characters");
subtitle: _("Restricts characters in filenames to only those supported by Windows.");
activatable-widget: _limitCharactersSwitch;
Adw.EntryRow _subtitleLangsRow {
title: _("Subtitle Languages (Comma-Separated)");

[prefix]
Gtk.Image {
icon-name: "insert-text-symbolic";
icon-name: "subtitles-symbolic";
}

[suffix]
Gtk.Switch _limitCharactersSwitch {
Gtk.MenuButton {
valign: center;
direction: none;
icon-name: "dialog-question-symbolic";
tooltip-text: _("Language Code Information");

popover: Gtk.Popover {
child: Gtk.Box {
orientation: vertical;
spacing: 6;
margin-start: 6;
margin-top: 6;
margin-end: 6;
margin-bottom: 6;

Adw.Clamp {
maximum-size: 300;
child: Gtk.Label {
wrap: true;
label: _("Different sites can use different language code formats for the same language. You may encounter one of the following three types: two-letter, two-letter with region, or three-letter. For example, \"en\", \"en-US\" and \"eng\" are all used for English.\nPlease specify all valid codes for your languages for the best results. Auto-generated subtitles will also be downloaded if available.\n\nYou can specify \"all\" instead to download all subtitles, including auto-generated ones. To exclude auto-generated ones, turn off the option below.");
};
}
};
};

styles ["flat"]
}
}

Adw.ActionRow {
title: _("Speed Limit");
subtitle: _("This limit (in KiB/s) is applied to downloads that have speed limit enabled. Changing the value doesn't affect already running downloads.");
title: _("Include Auto-Generated Subtitles");
activatable-widget: _autoGeneratedSwitch;

[prefix]
Gtk.Image {
icon-name: "speedometer-symbolic";
icon-name: "brain-augemnted-symbolic";
}

[suffix]
Gtk.SpinButton _speedLimitSpin {
Gtk.Switch _autoGeneratedSwitch {
valign: center;
numeric: true;
adjustment: Gtk.Adjustment {
lower: 512.0;
upper: 10240.0;
step-increment: 512.0;
page-increment: 1024.0;
};
}
}
}

Adw.PreferencesGroup {
title: _("Downloader");

Adw.ExpanderRow _useAriaRow {
title: _("Use aria2");
Expand Down Expand Up @@ -216,69 +251,29 @@ Adw.PreferencesWindow _root {
}
}
}

Adw.ActionRow {
title: _("Use SponsorBlock for YouTube");
activatable-widget: _sponsorBlockSwitch;

[prefix]
Gtk.Image {
icon-name: "permissions-advertising-symbolic";
}

[suffix]
Gtk.Switch _sponsorBlockSwitch {
valign: center;
}

[suffix]
Gtk.Button _sponsorBlockInfoButton {
valign: center;
icon-name: "dialog-question-symbolic";
tooltip-text: _("SponsorBlock Information (opens in a web browser)");

styles ["flat"]
}
}

Adw.EntryRow _subtitleLangsRow {
title: _("Subtitle Languages (Comma-Separated)");
Adw.ActionRow {
title: _("Speed Limit");
subtitle: _("This limit (in KiB/s) is applied to downloads that have speed limit enabled. Changing the value doesn't affect already running downloads.");

[prefix]
Gtk.Image {
icon-name: "subtitles-symbolic";
icon-name: "speedometer-symbolic";
}

[suffix]
Gtk.MenuButton {
Gtk.SpinButton _speedLimitSpin {
valign: center;
direction: none;
icon-name: "dialog-question-symbolic";
tooltip-text: _("Language Code Information");

popover: Gtk.Popover {
child: Gtk.Box {
orientation: vertical;
spacing: 6;
margin-start: 6;
margin-top: 6;
margin-end: 6;
margin-bottom: 6;

Adw.Clamp {
maximum-size: 300;
child: Gtk.Label {
wrap: true;
label: _("Different sites can use different language code formats for the same language. You may encounter one of the following three types: two-letter, two-letter with region, or three-letter. For example, \"en\", \"en-US\" and \"eng\" are all used for English.\nPlease specify all valid codes for your languages for the best results. Auto-generated subtitles will also be downloaded if available.\n\nYou can specify \"all\" instead to download all subtitles, but without auto-generated ones.");
};
}
};
numeric: true;
adjustment: Gtk.Adjustment {
lower: 512.0;
upper: 10240.0;
step-increment: 512.0;
page-increment: 1024.0;
};

styles ["flat"]
}
}

Adw.EntryRow _proxyRow {
title: _("Proxy URL");

Expand Down Expand Up @@ -370,6 +365,30 @@ Adw.PreferencesWindow _root {
styles ["flat"]
}
}

Adw.ActionRow {
title: _("Use SponsorBlock for YouTube");
activatable-widget: _sponsorBlockSwitch;

[prefix]
Gtk.Image {
icon-name: "permissions-advertising-symbolic";
}

[suffix]
Gtk.Switch _sponsorBlockSwitch {
valign: center;
}

[suffix]
Gtk.Button _sponsorBlockInfoButton {
valign: center;
icon-name: "dialog-question-symbolic";
tooltip-text: _("SponsorBlock Information (opens in a web browser)");

styles ["flat"]
}
}
}

Adw.PreferencesGroup {
Expand Down Expand Up @@ -449,8 +468,8 @@ Adw.PreferencesWindow _root {
}

Adw.ActionRow {
title: _("Embed Subtitle");
subtitle: _("If disabled or if embedding fails, downloaded subtitle will be saved to a separate file instead");
title: _("Embed Subtitles");
subtitle: _("If disabled or if embedding fails, downloaded subtitles will be saved to a separate file instead");
activatable-widget: _embedSubtitleSwitch;

[prefix]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="GirCore.Adw-1" Version="0.4.0" />
<PackageReference Include="Nickvision.Aura" Version="2023.11.1" />
<PackageReference Include="Nickvision.Aura" Version="2023.11.2" />
<PackageReference Include="Nickvision.GirExt" Version="2023.7.3" />
</ItemGroup>

Expand Down
6 changes: 4 additions & 2 deletions NickvisionTubeConverter.GNOME/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.IO;
using System.Reflection;
using System.Threading;

namespace NickvisionTubeConverter.GNOME;

Expand Down Expand Up @@ -35,7 +34,10 @@ public Program(string[] args)
_mainWindow = null;
_mainWindowController = new MainWindowController(args);
_mainWindowController.AppInfo.Changelog =
@"* A URL can now be passed to Parabolic via the command-line or the freedesktop application open protocol to trigger its validation of startup
@"* Added support for auto-generated subtitles from English
* Added the ability to turn off downloading auto-generated subtitles
* A URL can now be passed to Parabolic via the command-line or the freedesktop application open protocol to trigger its validation of startup
* Improved the design of the Preferences dialog to allow for better searching of options
* Fixed an issue where aria's max connections per server preference was allowed to be greater than 16
* Fixed an issue where enabling the ""Download Specific Timeframe"" advanced option would cause a crash for certain media downloads
* Updated translations (Thanks everyone on Weblate!)";
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</gresource>
<gresource prefix="/org/nickvision/tubeconverter/icons/scalable/status/">
<file preprocess="xml-stripblanks">background-app-ghost-symbolic.svg</file>
<file preprocess="xml-stripblanks">brain-augemnted-symbolic.svg</file>
<file preprocess="xml-stripblanks">clipboard-symbolic.svg</file>
<file preprocess="xml-stripblanks">dark-mode-symbolic.svg</file>
<file preprocess="xml-stripblanks">dotted-box-symbolic.svg</file>
Expand Down
6 changes: 3 additions & 3 deletions NickvisionTubeConverter.GNOME/Views/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private MainWindow(Gtk.Builder builder, MainWindowController controller, Adw.App
application.SetAccelsForAction("win.stopAllDownloads", new string[] { "<Ctrl><Shift>c" });
//Retry Failed Downloads Action
var actRetryFailedDownloads = Gio.SimpleAction.New("retryFailedDownloads", null);
actRetryFailedDownloads.OnActivate += (sender, e) => _controller.DownloadManager.RetryFailedDownloads(_controller.DownloadOptions);
actRetryFailedDownloads.OnActivate += (sender, e) => _controller.DownloadManager.RetryFailedDownloads(DownloadOptions.Current);
AddAction(actRetryFailedDownloads);
application.SetAccelsForAction("win.retryFailedDownloads", new string[] { "<Ctrl><Shift>r" });
//Clear Queued Downloads Action
Expand Down Expand Up @@ -348,7 +348,7 @@ private async void Keyring(Gio.SimpleAction sender, EventArgs e)
/// <param name="e">EventArgs</param>
private void History(Gio.SimpleAction sender, EventArgs e)
{
var historyDialog = new HistoryDialog(this, _controller.AppInfo.ID, _controller.DownloadHistory);
var historyDialog = new HistoryDialog(this, _controller.AppInfo.ID, DownloadHistory.Current);
historyDialog.DownloadAgainRequested += async (s, ea) =>
{
await AddDownloadAsync(ea);
Expand Down Expand Up @@ -619,7 +619,7 @@ private bool DownloadAdded((Guid Id, string Filename, string SaveFolder, bool Is
{
var downloadRow = new DownloadRow(this, e.Id, e.Filename, e.SaveFolder, (ex) => NotificationSent(null, ex));
downloadRow.StopRequested += (s, ex) => _controller.DownloadManager.RequestStop(ex);
downloadRow.RetryRequested += (s, ex) => _controller.DownloadManager.RequestRetry(ex, _controller.DownloadOptions);
downloadRow.RetryRequested += (s, ex) => _controller.DownloadManager.RequestRetry(ex, DownloadOptions.Current);
var box = e.IsDownloading ? _downloadingBox : _queuedBox;
if (e.IsDownloading)
{
Expand Down
Loading

0 comments on commit 6d104b5

Please sign in to comment.