diff --git a/src/blackgui/components/datasettingscomponent.cpp b/src/blackgui/components/datasettingscomponent.cpp
index 7eb38e0bb..f7d64fbed 100644
--- a/src/blackgui/components/datasettingscomponent.cpp
+++ b/src/blackgui/components/datasettingscomponent.cpp
@@ -21,6 +21,7 @@ namespace BlackGui
ui(new Ui::CDataSettingsComponent)
{
ui->setupUi(this);
+ ui->comp_GuiSettings->hideOpacity(true);
}
CDataSettingsComponent::~CDataSettingsComponent()
diff --git a/src/blackgui/components/datasettingscomponent.ui b/src/blackgui/components/datasettingscomponent.ui
index 12c2750c6..69969aaa6 100644
--- a/src/blackgui/components/datasettingscomponent.ui
+++ b/src/blackgui/components/datasettingscomponent.ui
@@ -7,7 +7,7 @@
0
0
400
- 497
+ 401
@@ -32,45 +32,7 @@
4
- -
-
-
- swift DB
-
-
-
-
-
-
-
- 0
- 40
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
- -
-
-
-
- 0
- 150
-
-
- comp_DebugDb
- comp_DebugDb
- comp_DebugDb
-
-
-
-
-
- -
+
-
@@ -108,6 +70,19 @@
0
+
+
+
+
+
+ -
+
+
+ Simulator
+
+
+
-
+
QFrame::StyledPanel
@@ -119,14 +94,50 @@
- -
-
-
- Simulator
+
-
+
+
+
+ 150
+ 150
+
-
+
+ GUI
+
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
-
-
+
+
+
+
+
+ -
+
+
+ swift DB
+
+
+
-
+
+
+
+ 0
+ 40
+
+
QFrame::StyledPanel
@@ -135,6 +146,16 @@
+ -
+
+
+
+ 0
+ 150
+
+
+
+
@@ -165,6 +186,12 @@
blackgui/components/settingssimulatorbasicscomponent.h
1
+
+ BlackGui::Components::CSettingsGuiComponent
+ QFrame
+ blackgui/components/settingsguicomponent.h
+ 1
+
diff --git a/src/blackgui/components/settingscomponent.cpp b/src/blackgui/components/settingscomponent.cpp
index 4c2e8d57b..35439a788 100644
--- a/src/blackgui/components/settingscomponent.cpp
+++ b/src/blackgui/components/settingscomponent.cpp
@@ -14,14 +14,10 @@
#include "blackmisc/logmessage.h"
#include "ui_settingscomponent.h"
-#include
#include
-#include
-#include
#include
#include
#include
-#include
#include
#include
#include
@@ -44,37 +40,14 @@ namespace BlackGui
ui(new Ui::CSettingsComponent)
{
ui->setupUi(this);
- ui->cb_SettingsGuiWidgetStyle->clear();
- ui->cb_SettingsGuiWidgetStyle->insertItems(0, QStyleFactory::keys());
this->tabBar()->setExpanding(false);
this->tabBar()->setUsesScrollButtons(true);
- // Opacity, intervals
- this->connect(this->ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &CSettingsComponent::changedWindowsOpacity);
- this->connect(this->ui->hs_SettingsGuiAircraftRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAircraftUpdateInterval);
- this->connect(this->ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
- this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedUsersUpdateInterval);
-
- // Font
- const QFont font = this->font();
- this->ui->cb_SettingsGuiFontStyle->setCurrentText(CStyleSheetUtility::fontAsCombinedWeightStyle(font));
- this->ui->cb_SettingsGuiFont->setCurrentFont(font);
- this->ui->cb_SettingsGuiFontSize->setCurrentText(QString::number(font.pointSize()));
- this->m_fontColor = QColor(sGui->getStyleSheetUtility().fontColor());
- this->ui->le_SettingsGuiFontColor->setText(this->m_fontColor.name());
- bool connected = this->connect(this->ui->cb_SettingsGuiFont, SIGNAL(currentFontChanged(QFont)), this, SLOT(ps_fontChanged()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->cb_SettingsGuiFontSize, SIGNAL(currentIndexChanged(QString)), this, SLOT(ps_fontChanged()));
- Q_ASSERT(connected);
- connected = this->connect(this->ui->cb_SettingsGuiFontStyle, SIGNAL(currentIndexChanged(QString)), this, SLOT(ps_fontChanged()));
- Q_ASSERT(connected);
- this->connect(this->ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsComponent::ps_fontColorDialog);
- this->connect(this->ui->cb_SettingsGuiWidgetStyle, static_cast(&QComboBox::currentIndexChanged),
- this, &CSettingsComponent::widgetStyleChanged);
- Q_UNUSED(connected);
-
- reloadWidgetStyleFromSettings();
+ this->connect(ui->hs_SettingsGuiAircraftRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAircraftUpdateInterval);
+ this->connect(ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
+ this->connect(ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedUsersUpdateInterval);
+ this->connect(ui->comp_SettingsGuiGeneral, &CSettingsGuiComponent::changedWindowsOpacity, this, &CSettingsComponent::changedWindowsOpacity);
}
CSettingsComponent::~CSettingsComponent()
@@ -85,24 +58,19 @@ namespace BlackGui
return ui->comp_AudioSetup->playNotificationSounds();
}
- void CSettingsComponent::setGuiOpacity(double value)
- {
- this->ui->hs_SettingsGuiOpacity->setValue(value);
- }
-
int CSettingsComponent::getAtcUpdateIntervalSeconds() const
{
- return this->ui->hs_SettingsGuiAtcRefreshTime->value();
+ return ui->hs_SettingsGuiAtcRefreshTime->value();
}
int CSettingsComponent::getAircraftUpdateIntervalSeconds() const
{
- return this->ui->hs_SettingsGuiAircraftRefreshTime->value();
+ return ui->hs_SettingsGuiAircraftRefreshTime->value();
}
int CSettingsComponent::getUsersUpdateIntervalSeconds() const
{
- return this->ui->hs_SettingsGuiUserRefreshTime->value();
+ return ui->hs_SettingsGuiUserRefreshTime->value();
}
void CSettingsComponent::setSettingsTab(CSettingsComponent::SettingTab tab)
@@ -110,51 +78,9 @@ namespace BlackGui
this->setCurrentIndex(static_cast(tab));
}
- void CSettingsComponent::ps_fontChanged()
+ void CSettingsComponent::setGuiOpacity(double value)
{
- QString fontSize = this->ui->cb_SettingsGuiFontSize->currentText().append("pt");
- QString fontFamily = this->ui->cb_SettingsGuiFont->currentFont().family();
- QString fontStyleCombined = this->ui->cb_SettingsGuiFontStyle->currentText();
- QString fontColor = this->m_fontColor.name();
- if (!this->m_fontColor.isValid() || this->m_fontColor.name().isEmpty())
- {
- fontColor = sGui->getStyleSheetUtility().fontColor();
- }
- this->ui->le_SettingsGuiFontColor->setText(fontColor);
- bool ok = sGui->updateFonts(fontFamily, fontSize, CStyleSheetUtility::fontStyle(fontStyleCombined), CStyleSheetUtility::fontWeight(fontStyleCombined), fontColor);
- if (ok)
- {
- CLogMessage(this).info("Updated font style");
- }
- else
- {
- CLogMessage(this).info("Updating style failed");
- }
- }
-
- void CSettingsComponent::ps_fontColorDialog()
- {
- QColor c = QColorDialog::getColor(this->m_fontColor, this, "Font color");
- if (c == this->m_fontColor) return;
- this->m_fontColor = c;
- this->ui->le_SettingsGuiFontColor->setText(this->m_fontColor.name());
- this->ps_fontChanged();
- }
-
- void CSettingsComponent::reloadWidgetStyleFromSettings()
- {
- int index = ui->cb_SettingsGuiWidgetStyle->findText(m_settingsWidgetStyle.get());
- ui->cb_SettingsGuiWidgetStyle->setCurrentIndex(index);
- }
-
- void CSettingsComponent::widgetStyleChanged(const QString &widgetStyle)
- {
- if (widgetStyle == m_settingsWidgetStyle.get()) { return; }
- auto availableStyles = QStyleFactory::keys();
- if (availableStyles.contains(widgetStyle))
- {
- m_settingsWidgetStyle.set(widgetStyle);
- }
+ ui->comp_SettingsGuiGeneral->setGuiOpacity(value);
}
}
} // namespace
diff --git a/src/blackgui/components/settingscomponent.h b/src/blackgui/components/settingscomponent.h
index 09eecb5b8..8fcb9a074 100644
--- a/src/blackgui/components/settingscomponent.h
+++ b/src/blackgui/components/settingscomponent.h
@@ -13,8 +13,6 @@
#define BLACKGUI_COMPONENTS_SETTINGSCOMPONENT_H
#include "blackgui/blackguiexport.h"
-#include "blackgui/settings/guisettings.h"
-
#include
#include
#include
@@ -28,8 +26,7 @@ namespace BlackGui
namespace Components
{
//! Settings component
- class BLACKGUI_EXPORT CSettingsComponent :
- public QTabWidget
+ class BLACKGUI_EXPORT CSettingsComponent : public QTabWidget
{
Q_OBJECT
@@ -56,9 +53,6 @@ namespace BlackGui
//! \copydoc CAudioSetupComponent::playNotificationSounds
bool playNotificationSounds() const;
- //! GUI Opacity 0-100%
- void setGuiOpacity(double value);
-
//! ATC refresh time
int getAtcUpdateIntervalSeconds() const;
@@ -85,20 +79,11 @@ namespace BlackGui
//! Set the tab
void setSettingsTab(SettingTab tab);
- private slots:
- //! Font has been changed
- void ps_fontChanged();
-
- //! Font color dialof
- void ps_fontColorDialog();
+ //! GUI Opacity 0-100%
+ void setGuiOpacity(double value);
private:
- void reloadWidgetStyleFromSettings();
- void widgetStyleChanged(const QString &widgetStyle);
-
QScopedPointer ui;
- QColor m_fontColor;
- BlackMisc::CSetting m_settingsWidgetStyle { this, &CSettingsComponent::reloadWidgetStyleFromSettings };
};
}
} // namespace
diff --git a/src/blackgui/components/settingscomponent.ui b/src/blackgui/components/settingscomponent.ui
index 9b43c359c..bbf6ea417 100644
--- a/src/blackgui/components/settingscomponent.ui
+++ b/src/blackgui/components/settingscomponent.ui
@@ -20,7 +20,7 @@
Settings
- 0
+ 6
@@ -281,222 +281,7 @@
-
-
- QFormLayout::AllNonFixedFieldsGrow
-
-
-
-
-
- General
-
-
-
-
-
-
- Opacity (0-100%)
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 100
-
-
- 10
-
-
- 100
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- -
-
-
- Widget Style
-
-
-
-
-
-
-
-
-
- Font
-
-
-
-
-
-
- Font
-
-
-
- -
-
-
- QComboBox::AdjustToMinimumContentsLength
-
-
-
- -
-
-
- Font size (pt)
-
-
-
- -
-
-
-
- 150
- 16777215
-
-
-
-
-
- 6
-
-
- -
-
- 7
-
-
- -
-
- 8
-
-
- -
-
- 9
-
-
- -
-
- 10
-
-
- -
-
- 11
-
-
- -
-
- 12
-
-
- -
-
- 14
-
-
- -
-
- 16
-
-
-
-
- -
-
-
- Font style
-
-
-
- -
-
-
-
- 150
- 16777215
-
-
-
-
-
- normal
-
-
- -
-
- bold
-
-
- -
-
- italic
-
-
- -
-
- bold italic
-
-
-
-
- -
-
-
- Font color
-
-
-
- -
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- 200
-
-
- true
-
-
-
- -
-
-
- ...
-
-
-
-
-
-
-
-
-
- -
View refresh times
@@ -628,7 +413,7 @@
hs_SettingsGuiAircraftRefreshTime
- -
+
-
@@ -649,6 +434,16 @@
+ -
+
+
+
+ 0
+ 100
+
+
+
+
@@ -716,6 +511,18 @@
+
+ BlackGui::Components::CSettingsSimulatorBasicsComponent
+ QFrame
+ blackgui/components/settingssimulatorbasicscomponent.h
+ 1
+
+
+ BlackGui::Components::CSettingsGuiComponent
+ QFrame
+ blackgui/components/settingsguicomponent.h
+ 1
+
BlackGui::Components::CAudioSetupComponent
QFrame
@@ -752,12 +559,6 @@
blackgui/components/settingshotkeycomponent.h
1
-
- BlackGui::Components::CSettingsSimulatorBasicsComponent
- QFrame
- blackgui/components/settingssimulatorbasicscomponent.h
- 1
-
BlackGui::Components::CSettingsSimulatorMessagesComponent
QFrame
diff --git a/src/blackgui/components/settingsguicomponent.cpp b/src/blackgui/components/settingsguicomponent.cpp
new file mode 100644
index 000000000..a7119a421
--- /dev/null
+++ b/src/blackgui/components/settingsguicomponent.cpp
@@ -0,0 +1,124 @@
+/* Copyright (C) 2016
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "settingsguicomponent.h"
+#include "blackgui/guiapplication.h"
+#include "blackmisc/logmessage.h"
+#include "ui_settingsguicomponent.h"
+#include
+#include
+#include
+#include
+
+using namespace BlackMisc;
+
+namespace BlackGui
+{
+ namespace Components
+ {
+ CSettingsGuiComponent::CSettingsGuiComponent(QWidget *parent) :
+ QFrame(parent),
+ ui(new Ui::CSettingsGuiComponent)
+ {
+ ui->setupUi(this);
+
+ ui->cb_SettingsGuiWidgetStyle->clear();
+ ui->cb_SettingsGuiWidgetStyle->insertItems(0, QStyleFactory::keys());
+
+ // Font
+ const QFont font = this->font();
+ this->m_fontColor = QColor(sGui->getStyleSheetUtility().fontColor());
+ ui->cb_SettingsGuiFontStyle->setCurrentText(CStyleSheetUtility::fontAsCombinedWeightStyle(font));
+ ui->cb_SettingsGuiFont->setCurrentFont(font);
+ ui->cb_SettingsGuiFontSize->setCurrentText(QString::number(font.pointSize()));
+ ui->le_SettingsGuiFontColor->setText(this->m_fontColor.name());
+ bool connected = this->connect(ui->cb_SettingsGuiFont, SIGNAL(currentFontChanged(QFont)), this, SLOT(ps_fontChanged()));
+ Q_ASSERT(connected);
+ this->connect(ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsGuiComponent::ps_fontColorDialog);
+ connected = this->connect(ui->cb_SettingsGuiFontSize, SIGNAL(currentIndexChanged(QString)), this, SLOT(ps_fontChanged()));
+ Q_ASSERT(connected);
+ connected = this->connect(ui->cb_SettingsGuiFontStyle, SIGNAL(currentIndexChanged(QString)), this, SLOT(ps_fontChanged()));
+ Q_ASSERT(connected);
+
+ // Widget style and rest
+ this->connect(ui->hs_SettingsGuiOpacity, &QSlider::valueChanged, this, &CSettingsGuiComponent::changedWindowsOpacity);
+ this->connect(ui->cb_SettingsGuiWidgetStyle, static_cast(&QComboBox::currentIndexChanged),
+ this, &CSettingsGuiComponent::widgetStyleChanged);
+ this->connect(ui->tb_ResetFont, &QToolButton::pressed, this, &CSettingsGuiComponent::ps_resetFont);
+ Q_UNUSED(connected);
+ this->reloadWidgetStyleFromSettings();
+ }
+
+ CSettingsGuiComponent::~CSettingsGuiComponent()
+ { }
+
+ void CSettingsGuiComponent::hideOpacity(bool hide)
+ {
+ ui->hs_SettingsGuiOpacity->setVisible(!hide);
+ ui->lbl_SettingsGuiOpacity->setVisible(!hide);
+ }
+
+ void CSettingsGuiComponent::setGuiOpacity(double value)
+ {
+ ui->hs_SettingsGuiOpacity->setValue(value);
+ }
+
+ void CSettingsGuiComponent::ps_fontChanged()
+ {
+ QString fontSize = ui->cb_SettingsGuiFontSize->currentText().append("pt");
+ QString fontFamily = ui->cb_SettingsGuiFont->currentFont().family();
+ QString fontStyleCombined = ui->cb_SettingsGuiFontStyle->currentText();
+ QString fontColor = this->m_fontColor.name();
+ if (!this->m_fontColor.isValid() || this->m_fontColor.name().isEmpty())
+ {
+ fontColor = sGui->getStyleSheetUtility().fontColor();
+ }
+ ui->le_SettingsGuiFontColor->setText(fontColor);
+ bool ok = sGui->updateFont(fontFamily, fontSize, CStyleSheetUtility::fontStyle(fontStyleCombined), CStyleSheetUtility::fontWeight(fontStyleCombined), fontColor);
+ if (ok)
+ {
+ CLogMessage(this).info("Updated font style");
+ }
+ else
+ {
+ CLogMessage(this).info("Updating style failed");
+ }
+ }
+
+ void CSettingsGuiComponent::ps_fontColorDialog()
+ {
+ const QColor c = QColorDialog::getColor(this->m_fontColor, this, "Font color");
+ if (c == this->m_fontColor) return;
+ this->m_fontColor = c;
+ ui->le_SettingsGuiFontColor->setText(this->m_fontColor.name());
+ this->ps_fontChanged();
+ }
+
+ void CSettingsGuiComponent::ps_resetFont()
+ {
+ sGui->resetFont();
+ }
+
+ void CSettingsGuiComponent::reloadWidgetStyleFromSettings()
+ {
+ int index = ui->cb_SettingsGuiWidgetStyle->findText(m_settingsWidgetStyle.get());
+ ui->cb_SettingsGuiWidgetStyle->setCurrentIndex(index);
+ }
+
+ void CSettingsGuiComponent::widgetStyleChanged(const QString &widgetStyle)
+ {
+ if (widgetStyle == m_settingsWidgetStyle.get()) { return; }
+ auto availableStyles = QStyleFactory::keys();
+ if (availableStyles.contains(widgetStyle))
+ {
+ m_settingsWidgetStyle.set(widgetStyle);
+ }
+ }
+ } // ns
+} // ns
diff --git a/src/blackgui/components/settingsguicomponent.h b/src/blackgui/components/settingsguicomponent.h
new file mode 100644
index 000000000..e1008dcdd
--- /dev/null
+++ b/src/blackgui/components/settingsguicomponent.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_COMPONENTS_SETTINGSGUICOMPONENT_H
+#define BLACKGUI_COMPONENTS_SETTINGSGUICOMPONENT_H
+
+#include "blackgui/settings/guisettings.h"
+#include
+#include
+
+namespace Ui { class CSettingsGuiComponent; }
+namespace BlackGui
+{
+ namespace Components
+ {
+ /*!
+ * General GUI settings
+ */
+ class CSettingsGuiComponent : public QFrame
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ explicit CSettingsGuiComponent(QWidget *parent = nullptr);
+
+ //! Destructor
+ ~CSettingsGuiComponent();
+
+ //! Hide opacity elements
+ void hideOpacity(bool hide);
+
+ public slots:
+ //! GUI Opacity 0-100%
+ void setGuiOpacity(double value);
+
+ signals:
+ //! Change the windows opacity 0..100
+ void changedWindowsOpacity(int opacity);
+
+ private slots:
+ //! Font has been changed
+ void ps_fontChanged();
+
+ //! Font color dialof
+ void ps_fontColorDialog();
+
+ //! Reset font
+ void ps_resetFont();
+
+ private:
+ QScopedPointer ui;
+ QColor m_fontColor;
+
+ void reloadWidgetStyleFromSettings();
+ void widgetStyleChanged(const QString &widgetStyle);
+ BlackMisc::CSetting m_settingsWidgetStyle { this, &CSettingsGuiComponent::reloadWidgetStyleFromSettings };
+ };
+ } // ns
+} // ns
+#endif // guard
diff --git a/src/blackgui/components/settingsguicomponent.ui b/src/blackgui/components/settingsguicomponent.ui
new file mode 100644
index 000000000..ba29ecb62
--- /dev/null
+++ b/src/blackgui/components/settingsguicomponent.ui
@@ -0,0 +1,261 @@
+
+
+ CSettingsGuiComponent
+
+
+
+ 0
+ 0
+ 223
+ 245
+
+
+
+ Frame
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Font
+
+
+
+ 3
+
+
+ 3
+
+
+ 3
+
+
+ 3
+
+
+ 6
+
+
-
+
+
+ Font size (pt)
+
+
+
+ -
+
+
+
+ 150
+ 16777215
+
+
+
-
+
+ 6
+
+
+ -
+
+ 7
+
+
+ -
+
+ 8
+
+
+ -
+
+ 9
+
+
+ -
+
+ 10
+
+
+ -
+
+ 11
+
+
+ -
+
+ 12
+
+
+ -
+
+ 14
+
+
+ -
+
+ 16
+
+
+
+
+ -
+
+
+ Font style
+
+
+
+ -
+
+
+ Font color
+
+
+
+ -
+
+
+ Font
+
+
+
+ -
+
+
+ ...
+
+
+
+ -
+
+
+ 200
+
+
+ true
+
+
+
+ -
+
+
+ QComboBox::AdjustToMinimumContentsLength
+
+
+
+ -
+
+
+
+ 150
+ 16777215
+
+
+
-
+
+ normal
+
+
+ -
+
+ bold
+
+
+ -
+
+ italic
+
+
+ -
+
+ bold italic
+
+
+
+
+ -
+
+
+ reset font attributes
+
+
+
+ :/pastel/icons/pastel/16/cancel.png:/pastel/icons/pastel/16/cancel.png
+
+
+
+
+
+
+ -
+
+
+ General
+
+
+
-
+
+
+ Opacity (0-100%)
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 100
+
+
+ 10
+
+
+ 100
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Widget Style
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp
index 29578c59e..3335edcfa 100644
--- a/src/blackgui/guiapplication.cpp
+++ b/src/blackgui/guiapplication.cpp
@@ -487,9 +487,14 @@ namespace BlackGui
return m_styleSheetUtility.read();
}
- bool CGuiApplication::updateFonts(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.updateFonts(fontFamily, fontSize, fontStyle, fontWeight, fontColor);
+ return m_styleSheetUtility.updateFont(fontFamily, fontSize, fontStyle, fontWeight, fontColor);
+ }
+
+ bool CGuiApplication::resetFont()
+ {
+ return m_styleSheetUtility.resetFont();
}
QDialog::DialogCode CGuiApplication::showCloseDialog(QMainWindow *mainWindow, QCloseEvent *closeEvent)
diff --git a/src/blackgui/guiapplication.h b/src/blackgui/guiapplication.h
index b8458f0f7..36e89b271 100644
--- a/src/blackgui/guiapplication.h
+++ b/src/blackgui/guiapplication.h
@@ -139,7 +139,10 @@ namespace BlackGui
bool reloadStyleSheets();
//! Update the fonts
- bool updateFonts(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);
+
+ //! Reset the font to default
+ bool resetFont();
//! Show close dialog
QDialog::DialogCode showCloseDialog(QMainWindow *mainWindow, QCloseEvent *closeEvent);
diff --git a/src/blackgui/stylesheetutility.cpp b/src/blackgui/stylesheetutility.cpp
index 234f0c548..ea8a916b3 100644
--- a/src/blackgui/stylesheetutility.cpp
+++ b/src/blackgui/stylesheetutility.cpp
@@ -190,7 +190,7 @@ namespace BlackGui
return this->m_styleSheets.contains(fileName.toLower().trimmed());
}
- bool CStyleSheetUtility::updateFonts(const QFont &font)
+ bool CStyleSheetUtility::updateFont(const QFont &font)
{
QString fs;
if (font.pixelSize() >= 0)
@@ -201,10 +201,10 @@ namespace BlackGui
{
fs.append(QString::number(font.pointSizeF())).append("pt");
}
- return updateFonts(font.family(), fs, fontStyleAsString(font), fontWeightAsString(font), "white");
+ return updateFont(font.family(), fs, fontStyleAsString(font), fontWeightAsString(font), "white");
}
- bool CStyleSheetUtility::updateFonts(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor)
+ bool CStyleSheetUtility::updateFont(const QString &fontFamily, const QString &fontSize, const QString &fontStyle, const QString &fontWeight, const QString &fontColor)
{
const QString indent(" ");
QString fontStyleSheet;
@@ -230,6 +230,12 @@ namespace BlackGui
return ok;
}
+ bool CStyleSheetUtility::resetFont()
+ {
+ QFile fontFile(CBuildConfig::getStylesheetsDir() + "/" + fileNameFontsModified());
+ return fontFile.remove();
+ }
+
QString CStyleSheetUtility::fontStyle(const QString &combinedStyleAndWeight)
{
static const QString n("normal");
diff --git a/src/blackgui/stylesheetutility.h b/src/blackgui/stylesheetutility.h
index 5457710c1..5f2cfff60 100644
--- a/src/blackgui/stylesheetutility.h
+++ b/src/blackgui/stylesheetutility.h
@@ -51,10 +51,13 @@ namespace BlackGui
bool containsStyle(const QString &fileName) const;
//! Update the fonts
- bool updateFonts(const QFont &font);
+ bool updateFont(const QFont &font);
//! Update the fonts
- bool updateFonts(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);
+
+ //! Reset font
+ bool resetFont();
//! Current font color from style sheet
QString fontColor() const;