From e3aa84bca797c6d1a8b9a131ce6bd27de653122c Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Sat, 13 Aug 2022 14:00:40 -0400 Subject: [PATCH] V2022.8.1 - Introduced ribbon interface for commands - Fixed an issue where the application would not exit correctly when updating --- Installer.iss | 2 +- .../Helpers/ThemeHelpers.cpp | 12 + .../Helpers/ThemeHelpers.h | 5 + .../UI/Views/BrowsePage.cpp | 5 +- .../UI/Views/BrowsePage.ui | 361 ++++++++++-------- .../UI/Views/DownloadsPage.cpp | 4 +- .../UI/Views/DownloadsPage.ui | 149 ++++---- .../UI/Views/MainWindow.cpp | 2 +- NickvisionTubeConverter/Update/Updater.cpp | 5 +- NickvisionTubeConverter/Update/Updater.h | 4 +- NickvisionTubeConverter/main.cpp | 4 +- UpdateConfig.json | 2 +- 12 files changed, 309 insertions(+), 246 deletions(-) diff --git a/Installer.iss b/Installer.iss index 9605a59f2..b63d0f4d9 100644 --- a/Installer.iss +++ b/Installer.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Nickvision Tube Converter" -#define MyAppVersion "2022.8.0" +#define MyAppVersion "2022.8.1" #define MyAppPublisher "Nickvision" #define MyAppURL "http://nickvision.org/" #define MyAppExeName "NickvisionTubeConverter.exe" diff --git a/NickvisionTubeConverter/Helpers/ThemeHelpers.cpp b/NickvisionTubeConverter/Helpers/ThemeHelpers.cpp index 2050ab61e..8182ef809 100644 --- a/NickvisionTubeConverter/Helpers/ThemeHelpers.cpp +++ b/NickvisionTubeConverter/Helpers/ThemeHelpers.cpp @@ -68,6 +68,18 @@ namespace NickvisionTubeConverter::Helpers } } + QString ThemeHelpers::getThemedRibbonStyle() + { + if (Configuration::getInstance().getTheme() == Theme::Light) + { + return "QTabWidget::pane { background: transparent; border: 1px solid #c4c2c2; }"; + } + else + { + return "QTabWidget::pane { background: transparent; border: 1px solid #2b2b2b; }"; + } + } + void ThemeHelpers::applyWin32Theme(QWidget* widget) { BOOL isDarkMode{ Configuration::getInstance().getTheme() == Theme::Light ? FALSE : TRUE }; diff --git a/NickvisionTubeConverter/Helpers/ThemeHelpers.h b/NickvisionTubeConverter/Helpers/ThemeHelpers.h index 71b8310d4..b75faba33 100644 --- a/NickvisionTubeConverter/Helpers/ThemeHelpers.h +++ b/NickvisionTubeConverter/Helpers/ThemeHelpers.h @@ -20,6 +20,11 @@ namespace NickvisionTubeConverter::Helpers::ThemeHelpers /// Separator stylesheet themed for Configuration::getTheme() QString getThemedSeparatorStyle(); /// + /// Gets a themed stylesheet for a ribbon (QTabWidget) + /// + /// Ribbon stylesheet themed for Configuration::getTheme() + QString getThemedRibbonStyle(); + /// /// Applys Win32 theming to QWidget's Title Bar /// /// The QWidget object diff --git a/NickvisionTubeConverter/UI/Views/BrowsePage.cpp b/NickvisionTubeConverter/UI/Views/BrowsePage.cpp index 5b0d4949b..47ec48598 100644 --- a/NickvisionTubeConverter/UI/Views/BrowsePage.cpp +++ b/NickvisionTubeConverter/UI/Views/BrowsePage.cpp @@ -22,6 +22,8 @@ namespace NickvisionTubeConverter::UI::Views } //Setup UI m_ui.setupUi(this); + //Ribbon + m_ui.ribbon->setCurrentIndex(0); //Download Button m_ui.btnDownload->setVisible(false); //==Theme==// @@ -30,7 +32,7 @@ namespace NickvisionTubeConverter::UI::Views void BrowsePage::refreshTheme() { - m_ui.separator1->setStyleSheet(ThemeHelpers::getThemedSeparatorStyle()); + m_ui.ribbon->setStyleSheet(ThemeHelpers::getThemedRibbonStyle()); } void BrowsePage::showEvent(QShowEvent* event) @@ -82,5 +84,6 @@ namespace NickvisionTubeConverter::UI::Views { m_ui.txtUrl->setText(url.toString()); m_ui.btnDownload->setVisible(url.toString().startsWith("https://www.youtube.com/watch?v=")); + m_ui.ribbon->setCurrentIndex(url.toString().startsWith("https://www.youtube.com/watch?v=") ? 1 : 0); } } diff --git a/NickvisionTubeConverter/UI/Views/BrowsePage.ui b/NickvisionTubeConverter/UI/Views/BrowsePage.ui index 31c88fcff..88f0df1b2 100644 --- a/NickvisionTubeConverter/UI/Views/BrowsePage.ui +++ b/NickvisionTubeConverter/UI/Views/BrowsePage.ui @@ -6,8 +6,8 @@ 0 0 - 433 - 95 + 909 + 540 @@ -24,165 +24,206 @@ 0 - - - - - - 34 - 16777215 - - - - Back (Alt+Left) - - - - :/Resources/Back.png:/Resources/Back.png - - - Alt+Left - - - - - - - - 34 - 16777215 - - - - Forward (Alt+Right) - - - - :/Resources/Forward.png:/Resources/Forward.png - - - Alt+Right - - - - - - - - 34 - 16777215 - - - - Refresh (F5) - - - - :/Resources/Refresh.png:/Resources/Refresh.png - - - F5 - - - - - - - - 34 - 16777215 - - - - Home (Alt+Home) - - - - :/Resources/Home.png:/Resources/Home.png - - - Alt+Home - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 30 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 34 - 16777215 - - - - Download (Ctrl+D) - - - Download - - - - :/Resources/Download.png:/Resources/Download.png - - - Ctrl+D - - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - + + + + 0 + 0 + + + + Browser + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + 34 + 16777215 + + + + Back (Alt+Left) + + + + :/Resources/Back.png:/Resources/Back.png + + + Alt+Left + + + + + + + + 34 + 16777215 + + + + Forward (Alt+Right) + + + + :/Resources/Forward.png:/Resources/Forward.png + + + Alt+Right + + + + + + + + 34 + 16777215 + + + + Refresh (F5) + + + + :/Resources/Refresh.png:/Resources/Refresh.png + + + F5 + + + + + + + + 34 + 16777215 + + + + Home (Alt+Home) + + + + :/Resources/Home.png:/Resources/Home.png + + + Alt+Home + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 30 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Video + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + 34 + 16777215 + + + + Download (Ctrl+D) + + + Download + + + + :/Resources/Download.png:/Resources/Download.png + + + Ctrl+D + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/NickvisionTubeConverter/UI/Views/DownloadsPage.cpp b/NickvisionTubeConverter/UI/Views/DownloadsPage.cpp index 4101b2dc6..3fd39d49f 100644 --- a/NickvisionTubeConverter/UI/Views/DownloadsPage.cpp +++ b/NickvisionTubeConverter/UI/Views/DownloadsPage.cpp @@ -15,6 +15,8 @@ namespace NickvisionTubeConverter::UI::Views { //==UI==// m_ui.setupUi(this); + //Ribbon + m_ui.ribbon->setCurrentIndex(0); //==Theme==// refreshTheme(); //==Messages==// @@ -31,7 +33,7 @@ namespace NickvisionTubeConverter::UI::Views void DownloadsPage::refreshTheme() { - m_ui.separator1->setStyleSheet(ThemeHelpers::getThemedSeparatorStyle()); + m_ui.ribbon->setStyleSheet(ThemeHelpers::getThemedRibbonStyle()); } void DownloadsPage::on_btnAddDownload_clicked() diff --git a/NickvisionTubeConverter/UI/Views/DownloadsPage.ui b/NickvisionTubeConverter/UI/Views/DownloadsPage.ui index 451403a49..a9c9985a8 100644 --- a/NickvisionTubeConverter/UI/Views/DownloadsPage.ui +++ b/NickvisionTubeConverter/UI/Views/DownloadsPage.ui @@ -2,14 +2,6 @@ DownloadsPage - - - 0 - 0 - 600 - 400 - - 6 @@ -24,76 +16,85 @@ 0 - - - - - - 34 - 16777215 - - - - Add Download (Ctrl+N) - - - - :/Resources/Add.png:/Resources/Add.png - - - Ctrl+N - - - - - - - - 34 - 16777215 - - - - Clear Downloads (Ctrl+Delete) - - - - :/Resources/Delete.png:/Resources/Delete.png + + + + 0 + 0 + + + + + Download + + + + 4 - - Ctrl+Del + + 4 - - - - - - Qt::Horizontal + + 4 - - - 40 - 20 - + + 4 - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - + + + + + 34 + 16777215 + + + + Add Download (Ctrl+N) + + + + :/Resources/Add.png:/Resources/Add.png + + + Ctrl+N + + + + + + + + 34 + 16777215 + + + + Clear Downloads (Ctrl+Delete) + + + + :/Resources/Delete.png:/Resources/Delete.png + + + Ctrl+Del + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/NickvisionTubeConverter/UI/Views/MainWindow.cpp b/NickvisionTubeConverter/UI/Views/MainWindow.cpp index dce40892f..77cb507f3 100644 --- a/NickvisionTubeConverter/UI/Views/MainWindow.cpp +++ b/NickvisionTubeConverter/UI/Views/MainWindow.cpp @@ -101,7 +101,7 @@ namespace NickvisionTubeConverter::UI::Views int result{ msgUpdate.exec() }; if (result == QMessageBox::StandardButton::Yes) { - ProgressDialog updateDialog{ this, "Downloading and installing the update...", [&]() { m_updater.windowsUpdate(this); } }; + ProgressDialog updateDialog{ this, "Downloading and installing the update...", [&]() { m_updater.windowsUpdate(); } }; updateDialog.exec(); if (!m_updater.getUpdateSuccessful()) { diff --git a/NickvisionTubeConverter/Update/Updater.cpp b/NickvisionTubeConverter/Update/Updater.cpp index 45ce25c4f..1665bcfe5 100644 --- a/NickvisionTubeConverter/Update/Updater.cpp +++ b/NickvisionTubeConverter/Update/Updater.cpp @@ -1,6 +1,7 @@ #include "Updater.h" #include #include +#include #include #include #include "../Helpers/CurlHelpers.h" @@ -41,7 +42,7 @@ namespace NickvisionTubeConverter::Update return m_updateAvailable; } - bool Updater::windowsUpdate(QMainWindow* window) + bool Updater::windowsUpdate() { if (!m_updateAvailable) { @@ -58,7 +59,7 @@ namespace NickvisionTubeConverter::Update if (m_updateSuccessful) { QProcess::execute(QString::fromStdString(exePath)); - window->close(); + qApp->exit(); } return m_updateSuccessful; } diff --git a/NickvisionTubeConverter/Update/Updater.h b/NickvisionTubeConverter/Update/Updater.h index 2451cfeb1..87187ea49 100644 --- a/NickvisionTubeConverter/Update/Updater.h +++ b/NickvisionTubeConverter/Update/Updater.h @@ -2,7 +2,6 @@ #include #include -#include #include "Version.h" #include "UpdateConfig.h" @@ -48,9 +47,8 @@ namespace NickvisionTubeConverter::Update /// /// Preforms an application update on a windows system. /// - /// The wxWindow object to close when updating /// True if the update was successful, else false. (Also returns false if system is not running Windows or if no update is available) - bool windowsUpdate(QMainWindow* window); + bool windowsUpdate(); private: std::string m_linkToConfig; diff --git a/NickvisionTubeConverter/main.cpp b/NickvisionTubeConverter/main.cpp index 2a4ad253a..bb4451074 100644 --- a/NickvisionTubeConverter/main.cpp +++ b/NickvisionTubeConverter/main.cpp @@ -12,8 +12,8 @@ int main(int argc, char *argv[]) AppInfo& appInfo = AppInfo::getInstance(); appInfo.setName("Nickvision Tube Converter"); appInfo.setDescription("An easy-to-use YouTube video downloader."); - appInfo.setVersion("2022.8.0"); - appInfo.setChangelog("- Application rewrite with C++ and Qt\n- New workflow design"); + appInfo.setVersion("2022.8.1"); + appInfo.setChangelog("- Introduced ribbon interface for commands\n- Fixed an issue where the application would not exit correctly when updating"); appInfo.setGitHubRepo("https://github.com/nlogozzo/NickvisionTubeConverter"); appInfo.setIssueTracker("https://github.com/nlogozzo/NickvisionTubeConverter/issues/new"); //==App Settings==// diff --git a/UpdateConfig.json b/UpdateConfig.json index a29f68ea3..87af53f30 100644 --- a/UpdateConfig.json +++ b/UpdateConfig.json @@ -1 +1 @@ -{"LatestVersion":"2022.8.0","Changelog":"- Application rewrite with C++ and Qt\n- New workflow design","LinkToSetupExe":"https://github.com/nlogozzo/NickvisionTubeConverter/releases/download/2022.8.0/NickvisionTubeConverterSetup.exe"} +{"LatestVersion":"2022.8.1","Changelog":"- Introduced ribbon interface for commands\n- Fixed an issue where the application would not exit correctly when updating","LinkToSetupExe":"https://github.com/nlogozzo/NickvisionTubeConverter/releases/download/2022.8.1/NickvisionTubeConverterSetup.exe"}