mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #740, GUI settings in own component
* used in client/mapping tool * reset font possible
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6037ce85ed
commit
4e381a048f
@@ -21,6 +21,7 @@ namespace BlackGui
|
||||
ui(new Ui::CDataSettingsComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->comp_GuiSettings->hideOpacity(true);
|
||||
}
|
||||
|
||||
CDataSettingsComponent::~CDataSettingsComponent()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>497</height>
|
||||
<height>401</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -32,45 +32,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QGroupBox" name="gb_SwiftDb">
|
||||
<property name="title">
|
||||
<string>swift DB</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="BlackGui::Components::CDbDebugDatabaseSetup" name="comp_DebugDb">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Components::CDbLoginComponent" name="comp_LoginComponent">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<zorder>comp_DebugDb</zorder>
|
||||
<zorder>comp_DebugDb</zorder>
|
||||
<zorder>comp_DebugDb</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="1" column="4">
|
||||
<widget class="QGroupBox" name="gb_DistributorPreferences">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@@ -108,6 +70,19 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QGroupBox" name="gb_Simulator">
|
||||
<property name="title">
|
||||
<string>Simulator</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_Simulator">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsSimulatorBasicsComponent" name="comp_SimulatorComponent">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@@ -119,14 +94,50 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QGroupBox" name="gb_Simulator">
|
||||
<property name="title">
|
||||
<string>Simulator</string>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="gb_GuiSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="title">
|
||||
<string>GUI</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_GuiSettings">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsSimulatorBasicsComponent" name="comp_SimulatorComponent">
|
||||
<widget class="BlackGui::Components::CSettingsGuiComponent" name="comp_GuiSettings"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="gb_SwiftDb">
|
||||
<property name="title">
|
||||
<string>swift DB</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SwiftDB">
|
||||
<item row="1" column="0">
|
||||
<widget class="BlackGui::Components::CDbDebugDatabaseSetup" name="comp_DebugDb">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@@ -135,6 +146,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="BlackGui::Components::CDbLoginComponent" name="comp_LoginComponent">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -165,6 +186,12 @@
|
||||
<header>blackgui/components/settingssimulatorbasicscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsGuiComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingsguicomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -14,14 +14,10 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "ui_settingscomponent.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QComboBox>
|
||||
#include <QFont>
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QSlider>
|
||||
#include <QString>
|
||||
#include <QStyleFactory>
|
||||
#include <QTabBar>
|
||||
#include <QToolButton>
|
||||
#include <QtGlobal>
|
||||
@@ -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<void(QComboBox::*)(const QString &)>(&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<int>(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
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/settings/guisettings.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
@@ -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::CSettingsComponent> ui;
|
||||
QColor m_fontColor;
|
||||
BlackMisc::CSetting<BlackGui::Settings::TWidgetStyle> m_settingsWidgetStyle { this, &CSettingsComponent::reloadWidgetStyleFromSettings };
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tb_SettingsTrafficNetworkServers">
|
||||
<attribute name="title">
|
||||
@@ -281,222 +281,7 @@
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="fl_SettingsGui">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gb_GuiGeneral">
|
||||
<property name="title">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="fl_GuiGeneral">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiOpacity">
|
||||
<property name="text">
|
||||
<string>Opacity (0-100%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="hs_SettingsGuiOpacity">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiWidgetStyle"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiWidgetStyle">
|
||||
<property name="text">
|
||||
<string>Widget Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gb_Font">
|
||||
<property name="title">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="fl_GuiFont">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFont">
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QFontComboBox" name="cb_SettingsGuiFont">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontSize">
|
||||
<property name="text">
|
||||
<string>Font size (pt)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontSize">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontStyle">
|
||||
<property name="text">
|
||||
<string>Font style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontStyle">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>italic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold italic</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontColor">
|
||||
<property name="text">
|
||||
<string>Font color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QWidget" name="wi_FontColor" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_FontColor">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_SettingsGuiFontColor">
|
||||
<property name="maxLength">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tb_SettingsGuiFontColor">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gb_ViewRefreshTimes">
|
||||
<property name="title">
|
||||
<string>View refresh times</string>
|
||||
@@ -628,7 +413,7 @@
|
||||
<zorder>hs_SettingsGuiAircraftRefreshTime</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="qw_SettingsGuiFont" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_SettingsGuiFontColor">
|
||||
<property name="spacing">
|
||||
@@ -649,6 +434,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="BlackGui::Components::CSettingsGuiComponent" name="comp_SettingsGuiGeneral">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -716,6 +511,18 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsSimulatorBasicsComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingssimulatorbasicscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsGuiComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingsguicomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CAudioSetupComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
@@ -752,12 +559,6 @@
|
||||
<header>blackgui/components/settingshotkeycomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsSimulatorBasicsComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingssimulatorbasicscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsSimulatorMessagesComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
|
||||
124
src/blackgui/components/settingsguicomponent.cpp
Normal file
124
src/blackgui/components/settingsguicomponent.cpp
Normal file
@@ -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 <QColorDialog>
|
||||
#include <QFont>
|
||||
#include <QFontComboBox>
|
||||
#include <QStyleFactory>
|
||||
|
||||
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<void(QComboBox::*)(const QString &)>(&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
|
||||
69
src/blackgui/components/settingsguicomponent.h
Normal file
69
src/blackgui/components/settingsguicomponent.h
Normal file
@@ -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 <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
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::CSettingsGuiComponent> ui;
|
||||
QColor m_fontColor;
|
||||
|
||||
void reloadWidgetStyleFromSettings();
|
||||
void widgetStyleChanged(const QString &widgetStyle);
|
||||
BlackMisc::CSetting<BlackGui::Settings::TWidgetStyle> m_settingsWidgetStyle { this, &CSettingsGuiComponent::reloadWidgetStyleFromSettings };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
261
src/blackgui/components/settingsguicomponent.ui
Normal file
261
src/blackgui/components/settingsguicomponent.ui
Normal file
@@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSettingsGuiComponent</class>
|
||||
<widget class="QFrame" name="CSettingsGuiComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>223</width>
|
||||
<height>245</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_SettingsGuiComponent">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_Font">
|
||||
<property name="title">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SettingsGuiComponent">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontSize">
|
||||
<property name="text">
|
||||
<string>Font size (pt)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontSize">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontStyle">
|
||||
<property name="text">
|
||||
<string>Font style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontColor">
|
||||
<property name="text">
|
||||
<string>Font color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFont">
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="tb_SettingsGuiFontColor">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="le_SettingsGuiFontColor">
|
||||
<property name="maxLength">
|
||||
<number>200</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QFontComboBox" name="cb_SettingsGuiFont">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontStyle">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>italic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold italic</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="tb_ResetFont">
|
||||
<property name="toolTip">
|
||||
<string>reset font attributes</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/pastel/icons/pastel/16/cancel.png</normaloff>:/pastel/icons/pastel/16/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_GuiGeneral">
|
||||
<property name="title">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="fl_GuiGeneral">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiOpacity">
|
||||
<property name="text">
|
||||
<string>Opacity (0-100%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="hs_SettingsGuiOpacity">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiWidgetStyle">
|
||||
<property name="text">
|
||||
<string>Widget Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiWidgetStyle"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user