From 7c2a3e41425eb2d8e175d2e9cbd58c6c5de57b5c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 10 Jul 2019 18:43:46 +0200 Subject: [PATCH] Launcher Tools Page for utilities which may be helpful * merged about/news * tools page --- src/blackgui/guiapplication.cpp | 14 +++-- src/blackgui/guiapplication.h | 3 + src/swiftlauncher/swiftlauncher.cpp | 10 +++- src/swiftlauncher/swiftlauncher.ui | 91 ++++++++++++++++++++++------- 4 files changed, 89 insertions(+), 29 deletions(-) diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index bb0e183e9..39963540e 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -678,11 +678,8 @@ namespace BlackGui a = menu.addAction(CIcons::disk16(), "Log directory"); c = connect(a, &QAction::triggered, this, [ = ]() { - const QString path(QDir::toNativeSeparators(CDirectoryUtils::logDirectory())); - if (QDir(path).exists()) - { - QDesktopServices::openUrl(QUrl::fromLocalFile(path)); - } + if (!sGui || sGui->isShuttingDown()) { return; } + this->openStandardLogDirectory(); }); Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed"); @@ -960,6 +957,13 @@ namespace BlackGui return QDesktopServices::openUrl(QUrl::fromLocalFile(fn)); } + bool CGuiApplication::openStandardLogDirectory() + { + const QString path(QDir::toNativeSeparators(CDirectoryUtils::logDirectory())); + if (!QDir(path).exists()) { return false; } + return QDesktopServices::openUrl(QUrl::fromLocalFile(path)); + } + bool CGuiApplication::updateFont(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor) { return m_styleSheetUtility.updateFont(fontFamily, fontSize, fontStyle, fontWeight, fontColor); diff --git a/src/blackgui/guiapplication.h b/src/blackgui/guiapplication.h index 96cb58b67..3f8625970 100644 --- a/src/blackgui/guiapplication.h +++ b/src/blackgui/guiapplication.h @@ -190,6 +190,9 @@ namespace BlackGui //! Opens the standard stylesheet bool openStandardWidgetStyleSheet(); + //! Opens the standard log directory + bool openStandardLogDirectory(); + //! Update the fonts bool updateFont(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor); diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index f79860220..bc93996d6 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -61,7 +61,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) : connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed); connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::showMainPage); connect(ui->tb_ConfigurationWizard, &QToolButton::pressed, this, &CSwiftLauncher::startWizard); - connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::tabChanged); + connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::tabChanged); connect(ui->rb_SwiftCoreAudioOnCore, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased, Qt::QueuedConnection); connect(ui->rb_SwiftCoreAudioOnGui, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased, Qt::QueuedConnection); @@ -72,6 +72,10 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) : connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished, Qt::QueuedConnection); connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged, Qt::QueuedConnection); + connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection); + connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection); + connect(ui->pb_LogDir, &QPushButton::released, sGui, &CGuiApplication::openStandardLogDirectory, Qt::QueuedConnection); + const QShortcut *logPageShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage())); Q_UNUSED(logPageShortCut); @@ -151,7 +155,8 @@ void CSwiftLauncher::displayLatestNews(QNetworkReply *reply) const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data()); if (deltaT > 0 && deltaT < newNews) { - ui->tb_Launcher->setCurrentWidget(ui->pg_LatestNews); + ui->tb_Launcher->setCurrentWidget(ui->pg_LatestNewsAndAbout); + ui->tw_LatestNewsAbout->setCurrentWidget(ui->tb_LatestNews); } } else @@ -182,6 +187,7 @@ void CSwiftLauncher::init() ui->lbl_HeaderInfo->setVisible(false); ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain); ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode); + ui->tw_LatestNewsAbout->setCurrentWidget(ui->tb_LatestNews); } void CSwiftLauncher::initStyleSheet() diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 9c45ad057..7c7e39199 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -88,12 +88,12 @@ - 2 + 4 6 - + 0 @@ -103,23 +103,47 @@ - Latest &news + Latest &news and &about - + - - - Latest news - - - true - - - Latest news will go here - - - true + + + 0 + + + News + + + + + + Latest news + + + true + + + Latest news will go here + + + true + + + + + + + + About + + + + + + + @@ -488,7 +512,7 @@ - + 0 @@ -498,9 +522,9 @@ - &About (credits and license) + &Tools - + 3 @@ -513,8 +537,32 @@ 3 - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + log + + + + + + + log directory + + @@ -812,7 +860,6 @@ - tbr_LatestNews rb_WindowNormal rb_WindowFrameless rb_SwiftStandalone