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
committed by Mat Sutcliffe
parent 70f9420da5
commit 7c2a3e4142
4 changed files with 89 additions and 29 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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()

View File

@@ -88,12 +88,12 @@
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>2</number>
<number>4</number>
</property>
<property name="tabSpacing">
<number>6</number>
</property>
<widget class="QWidget" name="pg_LatestNews">
<widget class="QWidget" name="pg_LatestNewsAndAbout">
<property name="geometry">
<rect>
<x>0</x>
@@ -103,23 +103,47 @@
</rect>
</property>
<attribute name="label">
<string>Latest &amp;news</string>
<string>Latest &amp;news and &amp;about</string>
</attribute>
<layout class="QVBoxLayout" name="vl_LatestNews">
<layout class="QVBoxLayout" name="vl_LatestNewsAndAbout">
<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>
<widget class="QTabWidget" name="tw_LatestNewsAbout">
<property name="currentIndex">
<number>0</number>
</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>
</item>
</layout>
@@ -488,7 +512,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_About">
<widget class="QWidget" name="pg_Tools">
<property name="geometry">
<rect>
<x>0</x>
@@ -498,9 +522,9 @@
</rect>
</property>
<attribute name="label">
<string>&amp;About (credits and license)</string>
<string>&amp;Tools</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Credits">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>3</number>
</property>
@@ -513,8 +537,32 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="BlackGui::Components::CAboutHtmlComponent" name="comp_AboutHTML"/>
<item row="3" column="0">
<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>
</layout>
</widget>
@@ -812,7 +860,6 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tbr_LatestNews</tabstop>
<tabstop>rb_WindowNormal</tabstop>
<tabstop>rb_WindowFrameless</tabstop>
<tabstop>rb_SwiftStandalone</tabstop>