Launcher Tools Page for utilities which may be helpful

* merged about/news
* tools page
This commit is contained in:
Klaus Basan
2019-07-10 18:43:46 +02:00
parent cba1d2b4ff
commit e764f34738
4 changed files with 89 additions and 29 deletions

View File

@@ -678,11 +678,8 @@ namespace BlackGui
a = menu.addAction(CIcons::disk16(), "Log directory"); a = menu.addAction(CIcons::disk16(), "Log directory");
c = connect(a, &QAction::triggered, this, [ = ]() c = connect(a, &QAction::triggered, this, [ = ]()
{ {
const QString path(QDir::toNativeSeparators(CDirectoryUtils::logDirectory())); if (!sGui || sGui->isShuttingDown()) { return; }
if (QDir(path).exists()) this->openStandardLogDirectory();
{
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
}); });
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed"); Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
@@ -960,6 +957,13 @@ namespace BlackGui
return QDesktopServices::openUrl(QUrl::fromLocalFile(fn)); 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) 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); return m_styleSheetUtility.updateFont(fontFamily, fontSize, fontStyle, fontWeight, fontColor);

View File

@@ -190,6 +190,9 @@ namespace BlackGui
//! Opens the standard stylesheet //! Opens the standard stylesheet
bool openStandardWidgetStyleSheet(); bool openStandardWidgetStyleSheet();
//! Opens the standard log directory
bool openStandardLogDirectory();
//! Update the fonts //! Update the fonts
bool updateFont(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor); bool updateFont(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor);

View File

@@ -61,7 +61,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed); connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::showMainPage); connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::showMainPage);
connect(ui->tb_ConfigurationWizard, &QToolButton::pressed, this, &CSwiftLauncher::startWizard); 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_SwiftCoreAudioOnCore, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased, Qt::QueuedConnection);
connect(ui->rb_SwiftCoreAudioOnGui, &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(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished, Qt::QueuedConnection);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged, 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())); const QShortcut *logPageShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage()));
Q_UNUSED(logPageShortCut); Q_UNUSED(logPageShortCut);
@@ -151,7 +155,8 @@ void CSwiftLauncher::displayLatestNews(QNetworkReply *reply)
const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data()); const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data());
if (deltaT > 0 && deltaT < newNews) 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 else
@@ -182,6 +187,7 @@ void CSwiftLauncher::init()
ui->lbl_HeaderInfo->setVisible(false); ui->lbl_HeaderInfo->setVisible(false);
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain); ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode); ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode);
ui->tw_LatestNewsAbout->setCurrentWidget(ui->tb_LatestNews);
} }
void CSwiftLauncher::initStyleSheet() void CSwiftLauncher::initStyleSheet()

View File

@@ -88,12 +88,12 @@
<item> <item>
<widget class="QToolBox" name="tb_Launcher"> <widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>4</number>
</property> </property>
<property name="tabSpacing"> <property name="tabSpacing">
<number>6</number> <number>6</number>
</property> </property>
<widget class="QWidget" name="pg_LatestNews"> <widget class="QWidget" name="pg_LatestNewsAndAbout">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -103,23 +103,47 @@
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
<string>Latest &amp;news</string> <string>Latest &amp;news and &amp;about</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="vl_LatestNews"> <layout class="QVBoxLayout" name="vl_LatestNewsAndAbout">
<item> <item>
<widget class="QTextBrowser" name="tbr_LatestNews"> <widget class="QTabWidget" name="tw_LatestNewsAbout">
<property name="documentTitle"> <property name="currentIndex">
<string>Latest news</string> <number>0</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Latest news will go here</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property> </property>
<widget class="QWidget" name="tb_LatestNews">
<attribute name="title">
<string>News</string>
</attribute>
<layout class="QVBoxLayout" name="vl_LatestNews">
<item>
<widget class="QTextBrowser" name="tbr_LatestNews">
<property name="documentTitle">
<string>Latest news</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Latest news will go here</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_About">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QVBoxLayout" name="vl_About">
<item>
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -488,7 +512,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="pg_About"> <widget class="QWidget" name="pg_Tools">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -498,9 +522,9 @@
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
<string>&amp;About (credits and license)</string> <string>&amp;Tools</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="vl_Credits"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>3</number> <number>3</number>
</property> </property>
@@ -513,8 +537,32 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>3</number> <number>3</number>
</property> </property>
<item> <item row="3" column="0">
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/> <spacer name="vs_Tools">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pb_Log">
<property name="text">
<string>log</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pb_LogDir">
<property name="text">
<string>log directory</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -812,7 +860,6 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>tbr_LatestNews</tabstop>
<tabstop>rb_WindowNormal</tabstop> <tabstop>rb_WindowNormal</tabstop>
<tabstop>rb_WindowFrameless</tabstop> <tabstop>rb_WindowFrameless</tabstop>
<tabstop>rb_SwiftStandalone</tabstop> <tabstop>rb_SwiftStandalone</tabstop>