Skip to content

Commit

Permalink
All - Select All/Deselect All Buttons in AddDownloadDialog (#899)
Browse files Browse the repository at this point in the history
* Qt - Select All/Deselect All Buttons in AddDownloadDialog

* GNOME - Select All/Deselect All Buttons in AddDownloadDialog

* Update Translations
  • Loading branch information
nlogozzo authored Oct 15, 2024
1 parent d30ee03 commit ca3bac1
Show file tree
Hide file tree
Showing 46 changed files with 2,403 additions and 1,761 deletions.
2 changes: 1 addition & 1 deletion libparabolic/src/controllers/mainwindowcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Nickvision::TubeConverter::Shared::Controllers
m_appInfo.setVersion({ "2024.10.2-next" });
m_appInfo.setShortName(_("Parabolic"));
m_appInfo.setDescription(_("Download web video and audio"));
m_appInfo.setChangelog("- The user's preferred video codec will now be used in playlist downloads where individual quality/format selection is not available\n- Partially downloaded media will now correctly resume when retrying the failed download instead of restarting the download from scratch\n- Fixed an issue where some websites failed in a 403 forbidden error\n- Fixed an issue where some videos would download as audio only after selecting an audio language\n- Fixed an issue where the incorrect audio language was downloaded");
m_appInfo.setChangelog("- Added Select All and Deselect All buttons to the Subtitles and Playlist Items pages\n- The user's preferred video codec will now be used in playlist downloads where individual quality/format selection is not available\n- Partially downloaded media will now correctly resume when retrying the failed download instead of restarting the download from scratch\n- Fixed an issue where some websites failed in a 403 forbidden error\n- Fixed an issue where some videos would download as audio only after selecting an audio language\n- Fixed an issue where the incorrect audio language was downloaded");
m_appInfo.setSourceRepo("https://github.com/NickvisionApps/Parabolic");
m_appInfo.setIssueTracker("https://github.com/NickvisionApps/Parabolic/issues/new");
m_appInfo.setSupportUrl("https://github.com/NickvisionApps/Parabolic/discussions");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,32 @@ Adw.Dialog root {
name: "download-single-subtitles";
child: Gtk.Box {
orientation: vertical;
spacing: 16;
spacing: 12;
margin-start: 16;
margin-end: 16;
margin-bottom: 16;

Gtk.Box {
orientation: horizontal;
halign: center;

Gtk.Button selectAllSubtitlesSingleButton {
Adw.ButtonContent {
icon-name: "edit-select-all-symbolic";
label: _("Select All");
}
}

Gtk.Button deselectAllSubtitlesSingleButton {
Adw.ButtonContent {
icon-name: "edit-select-none-symbolic";
label: _("Deselect All");
}
}

styles [ "linked" ]
}

Gtk.ScrolledWindow {
hexpand: true;
vexpand: true;
Expand Down Expand Up @@ -295,7 +316,7 @@ Adw.Dialog root {
name: "download-playlist-items";
child: Gtk.Box {
orientation: vertical;
spacing: 16;
spacing: 12;
margin-start: 16;
margin-end: 16;
margin-bottom: 16;
Expand All @@ -306,6 +327,27 @@ Adw.Dialog root {
}
}

Gtk.Box {
orientation: horizontal;
halign: center;

Gtk.Button selectAllPlaylistButton {
Adw.ButtonContent {
icon-name: "edit-select-all-symbolic";
label: _("Select All");
}
}

Gtk.Button deselectAllPlaylistButton {
Adw.ButtonContent {
icon-name: "edit-select-none-symbolic";
label: _("Deselect All");
}
}

styles [ "linked" ]
}

Gtk.ScrolledWindow {
hexpand: true;
vexpand: true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ namespace Nickvision::TubeConverter::GNOME::Views
* @brief Reverts the filename for a single download to its original title.
*/
void revertFilenameSingle();
/**
* @brief Selects all subtitles for a single download.
*/
void selectAllSubtitlesSingle();
/**
* @brief Deselects all subtitles for a single download.
*/
void deselectAllSubtitlesSingle();
/**
* @brief Reverts the start time for a single download to its original value.
*/
Expand All @@ -88,6 +96,14 @@ namespace Nickvision::TubeConverter::GNOME::Views
* @brief Handles when the number titles switch is changed.
*/
void onNumberTitlesPlaylistChanged();
/**
* @brief Selects all items for a playlist download.
*/
void selectAllPlaylist();
/**
* @brief Deselects all items for a playlist download.
*/
void deselectAllPlaylist();
/**
* @brief Adds the playlist downloads to the download queue.
*/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -16,6 +16,8 @@
<file preprocess="xml-stripblanks">container-terminal-symbolic.svg</file>
<file preprocess="xml-stripblanks">dark-mode-symbolic.svg</file>
<file preprocess="xml-stripblanks">dotted-box-symbolic.svg</file>
<file preprocess="xml-stripblanks">edit-select-all-symbolic.svg</file>
<file preprocess="xml-stripblanks">edit-select-none-symbolic.svg</file>
<file preprocess="xml-stripblanks">encode-symbolic.svg</file>
<file preprocess="xml-stripblanks">firefox-symbolic.svg</file>
<file preprocess="xml-stripblanks">globe-symbolic.svg</file>
Expand Down
36 changes: 36 additions & 0 deletions org.nickvision.tubeconverter.gnome/src/views/adddownloaddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ namespace Nickvision::TubeConverter::GNOME::Views
g_signal_connect(m_builder.get<GObject>("advancedOptionsSingleRow"), "activated", G_CALLBACK(+[](AdwActionRow*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->advancedOptionsSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("selectSaveFolderSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->selectSaveFolderSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("revertFilenameSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->revertFilenameSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("selectAllSubtitlesSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->selectAllSubtitlesSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("deselectAllSubtitlesSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->deselectAllSubtitlesSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("revertStartTimeSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->revertStartTimeSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("revertEndTimeSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->revertEndTimeSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("downloadSingleButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->downloadSingle(); }), this);
g_signal_connect(m_builder.get<GObject>("selectSaveFolderPlaylistButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->selectSaveFolderPlaylist(); }), this);
g_signal_connect(m_builder.get<GObject>("itemsPlaylistRow"), "activated", G_CALLBACK(+[](AdwActionRow*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->itemsPlaylist(); }), this);
g_signal_connect(m_builder.get<GObject>("numberTitlesPlaylistRow"), "notify::active", G_CALLBACK(+[](GObject*, GParamSpec* pspec, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->onNumberTitlesPlaylistChanged(); }), this);
g_signal_connect(m_builder.get<GObject>("selectAllPlaylistButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->selectAllPlaylist(); }), this);
g_signal_connect(m_builder.get<GObject>("deselectAllPlaylistButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->deselectAllPlaylist(); }), this);
g_signal_connect(m_builder.get<GObject>("downloadPlaylistButton"), "clicked", G_CALLBACK(+[](GtkButton*, gpointer data){ reinterpret_cast<AddDownloadDialog*>(data)->downloadPlaylist(); }), this);
m_controller->urlValidated() += [this](const EventArgs& args){ GtkHelpers::dispatchToMainThread([this]{ onUrlValidated(); }); };
}
Expand Down Expand Up @@ -256,6 +260,22 @@ namespace Nickvision::TubeConverter::GNOME::Views
gtk_editable_set_text(m_builder.get<GtkEditable>("filenameSingleRow"), m_controller->getMediaTitle(0).c_str());
}

void AddDownloadDialog::selectAllSubtitlesSingle()
{
for(GtkCheckButton* chk : m_singleSubtitleCheckButtons)
{
gtk_check_button_set_active(chk, true);
}
}

void AddDownloadDialog::deselectAllSubtitlesSingle()
{
for(GtkCheckButton* chk : m_singleSubtitleCheckButtons)
{
gtk_check_button_set_active(chk, false);
}
}

void AddDownloadDialog::revertStartTimeSingle()
{
gtk_editable_set_text(m_builder.get<GtkEditable>("startTimeSingleRow"), m_controller->getMediaTimeFrame(0).startStr().c_str());
Expand Down Expand Up @@ -310,6 +330,22 @@ namespace Nickvision::TubeConverter::GNOME::Views
}
}

void AddDownloadDialog::selectAllPlaylist()
{
for(GtkCheckButton* chk : m_playlistItemCheckButtons)
{
gtk_check_button_set_active(chk, true);
}
}

void AddDownloadDialog::deselectAllPlaylist()
{
for(GtkCheckButton* chk : m_playlistItemCheckButtons)
{
gtk_check_button_set_active(chk, false);
}
}

void AddDownloadDialog::downloadPlaylist()
{
std::unordered_map<size_t, std::string> filenames;
Expand Down
16 changes: 16 additions & 0 deletions org.nickvision.tubeconverter.qt/include/views/adddownloaddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ namespace Nickvision::TubeConverter::QT::Views
* @brief Reverts the filename of a single download to its original title.
*/
void revertFilenameSingle();
/**
* @brief Selects all subtitles for a single download.
*/
void selectAllSubtitlesSingle();
/**
* @brief Deselects all subtitles for a single download.
*/
void deselectAllSubtitlesSingle();
/**
* @brief Downloads a single media.
*/
Expand All @@ -70,6 +78,14 @@ namespace Nickvision::TubeConverter::QT::Views
* @param state The new state
*/
void onNumberTitlesPlaylistChanged(int state);
/**
* @brief Selects all items for a playlist download.
*/
void selectAllPlaylist();
/**
* @brief Deselects all items for a playlist download.
*/
void deselectAllPlaylist();
/**
* @brief Downloads a playlist.
*/
Expand Down
44 changes: 44 additions & 0 deletions org.nickvision.tubeconverter.qt/src/views/adddownloaddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace Nickvision::TubeConverter::QT::Views
m_ui->btnRevertFilenameSingle->setText(_("Revert"));
m_ui->btnRevertFilenameSingle->setToolTip(_("Revert to Title"));
m_ui->lblNoSubtitlesSingle->setText(_("No Subtitles Available"));
m_ui->btnSelectAllSubtitlesSingle->setText(_("Select All"));
m_ui->btnDeselectAllSubtitlesSingle->setText(_("Deselect All"));
m_ui->tblSubtitlesSingle->setHorizontalHeaderLabels({ _("Download"), _("Language") });
m_ui->btnDownloadSingle->setText(_("Download"));
m_ui->tabsPlaylist->setTabText(0, _("General"));
Expand All @@ -65,6 +67,8 @@ namespace Nickvision::TubeConverter::QT::Views
m_ui->btnSelectSaveFolderPlaylist->setText(_("Select"));
m_ui->btnSelectSaveFolderPlaylist->setToolTip(_("Select Save Folder"));
m_ui->lblNumberTitlesPlaylist->setText(_("Number Titles"));
m_ui->btnSelectAllPlaylist->setText(_("Select All"));
m_ui->btnDeselectAllPlaylist->setText(_("Deselect All"));
m_ui->tblItemsPlaylist->setHorizontalHeaderLabels({ _("Download"), _("File Name"), "" });
m_ui->btnDownloadPlaylist->setText(_("Download"));
//Load Validate Page
Expand Down Expand Up @@ -95,9 +99,13 @@ namespace Nickvision::TubeConverter::QT::Views
connect(m_ui->cmbAudioLanguageSingle, &QComboBox::currentIndexChanged, this, &AddDownloadDialog::onCmbQualitySingleChanged);
connect(m_ui->btnSelectSaveFolderSingle, &QPushButton::clicked, this, &AddDownloadDialog::selectSaveFolderSingle);
connect(m_ui->btnRevertFilenameSingle, &QPushButton::clicked, this, &AddDownloadDialog::revertFilenameSingle);
connect(m_ui->btnSelectAllSubtitlesSingle, &QPushButton::clicked, this, &AddDownloadDialog::selectAllSubtitlesSingle);
connect(m_ui->btnDeselectAllSubtitlesSingle, &QPushButton::clicked, this, &AddDownloadDialog::deselectAllSubtitlesSingle);
connect(m_ui->btnDownloadSingle, &QPushButton::clicked, this, &AddDownloadDialog::downloadSingle);
connect(m_ui->btnSelectSaveFolderPlaylist, &QPushButton::clicked, this, &AddDownloadDialog::selectSaveFolderPlaylist);
connect(m_ui->chkNumberTitlesPlaylist, &QCheckBox::stateChanged, this, &AddDownloadDialog::onNumberTitlesPlaylistChanged);
connect(m_ui->btnSelectAllPlaylist, &QPushButton::clicked, this, &AddDownloadDialog::selectAllPlaylist);
connect(m_ui->btnDeselectAllPlaylist, &QPushButton::clicked, this, &AddDownloadDialog::deselectAllPlaylist);
connect(m_ui->btnDownloadPlaylist, &QPushButton::clicked, this, &AddDownloadDialog::downloadPlaylist);
m_controller->urlValidated() += [this](const ParamEventArgs<bool>& args){ QTHelpers::dispatchToMainThread([this]() { onUrlValidated(); }); };
}
Expand Down Expand Up @@ -260,6 +268,24 @@ namespace Nickvision::TubeConverter::QT::Views
{
m_ui->txtFilenameSingle->setText(QString::fromStdString(m_controller->getMediaTitle(0)));
}

void AddDownloadDialog::selectAllSubtitlesSingle()
{
for(int i = 0; i < m_ui->tblSubtitlesSingle->rowCount(); i++)
{
QCheckBox* chk{ static_cast<QCheckBox*>(m_ui->tblSubtitlesSingle->cellWidget(i, 0)) };
chk->setChecked(true);
}
}

void AddDownloadDialog::deselectAllSubtitlesSingle()
{
for(int i = 0; i < m_ui->tblSubtitlesSingle->rowCount(); i++)
{
QCheckBox* chk{ static_cast<QCheckBox*>(m_ui->tblSubtitlesSingle->cellWidget(i, 0)) };
chk->setChecked(false);
}
}

void AddDownloadDialog::downloadSingle()
{
Expand Down Expand Up @@ -293,6 +319,24 @@ namespace Nickvision::TubeConverter::QT::Views
}
}

void AddDownloadDialog::selectAllPlaylist()
{
for(int i = 0; i < m_ui->tblItemsPlaylist->rowCount(); i++)
{
QCheckBox* chk{ static_cast<QCheckBox*>(m_ui->tblItemsPlaylist->cellWidget(i, 0)) };
chk->setChecked(true);
}
}

void AddDownloadDialog::deselectAllPlaylist()
{
for(int i = 0; i < m_ui->tblItemsPlaylist->rowCount(); i++)
{
QCheckBox* chk{ static_cast<QCheckBox*>(m_ui->tblItemsPlaylist->cellWidget(i, 0)) };
chk->setChecked(false);
}
}

void AddDownloadDialog::downloadPlaylist()
{
std::unordered_map<size_t, std::string> filenames;
Expand Down
38 changes: 37 additions & 1 deletion org.nickvision.tubeconverter.qt/src/views/adddownloaddialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<item>
<widget class="QStackedWidget" name="viewStack">
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="pageValidate">
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -273,6 +273,24 @@
</widget>
<widget class="QWidget" name="pageSubtitlesSingle">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btnSelectAllSubtitlesSingle">
<property name="icon">
<iconset theme="edit-select-all"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDeselectAllSubtitlesSingle">
<property name="icon">
<iconset theme="edit-clear"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tblSubtitlesSingle">
<property name="columnCount">
Expand Down Expand Up @@ -384,6 +402,24 @@
<item>
<widget class="QCheckBox" name="chkNumberTitlesPlaylist"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnSelectAllPlaylist">
<property name="icon">
<iconset theme="edit-select-all"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDeselectAllPlaylist">
<property name="icon">
<iconset theme="edit-clear"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tblItemsPlaylist">
<property name="columnCount">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<releases>
<release version="2024.10.2-next" date="2024-10-13">
<description translate="no">
<p>- Added Select All and Deselect All buttons to the Subtitles and Playlist Items pages</p>
<p>- The user's preferred video codec will now be used in playlist downloads where individual quality/format selection is not available</p>
<p>- Partially downloaded media will now correctly resume when retrying the failed download instead of restarting the download from scratch</p>
<p>- Fixed an issue where some websites failed in a 403 forbidden error</p>
Expand Down
Loading

0 comments on commit ca3bac1

Please sign in to comment.