Merge pull request #3030 from typpos/FontSelectForIniEdit
Ability to select font for ini editor panels.
This commit is contained in:
commit
70073e5d32
|
@ -48,7 +48,7 @@
|
|||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabGeneral">
|
||||
<attribute name="title">
|
||||
|
@ -85,6 +85,7 @@
|
|||
<widget class="QLabel" name="lblGeneral">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -127,6 +128,7 @@
|
|||
<widget class="QLabel" name="lblRecovery">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -257,6 +259,7 @@
|
|||
<widget class="QLabel" name="lblMessages">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -289,6 +292,7 @@
|
|||
<widget class="QLabel" name="lblNotify">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -422,6 +426,7 @@
|
|||
<widget class="QLabel" name="lblStartMenu">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -478,6 +483,7 @@
|
|||
<widget class="QLabel" name="lblSysTray">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -498,6 +504,7 @@
|
|||
<widget class="QLabel" name="lblRunBoxed">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -561,6 +568,7 @@
|
|||
<widget class="QLabel" name="lblStartUp">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -834,6 +842,7 @@
|
|||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -948,43 +957,17 @@
|
|||
<layout class="QGridLayout" name="gridLayout_32">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_31">
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cmbDPI"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>High DPI Scaling</string>
|
||||
<string>Ini Editor Font</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Font Scaling</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<item row="4" column="4">
|
||||
<spacer name="horizontalSpacer_19">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -997,7 +980,111 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Font Scaling</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>High DPI Scaling</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDisplay">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Graphic Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cmbFontScale">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelectIniFont">
|
||||
<property name="toolTip">
|
||||
<string>Select font</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnResetIniFont">
|
||||
<property name="toolTip">
|
||||
<string>Reset font</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<spacer name="horizontalSpacer_20">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -1010,28 +1097,14 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>(Restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="cmbFontScale">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="2" column="4">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -1044,31 +1117,22 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDisplay">
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cmbDPI"/>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Graphic Options</string>
|
||||
<string>(Restart required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QLabel" name="lblIniEditFont">
|
||||
<property name="text">
|
||||
<string>#</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -1086,7 +1150,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabsAddons">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabAddonList">
|
||||
<attribute name="title">
|
||||
|
@ -1226,6 +1290,7 @@
|
|||
<widget class="QLabel" name="lblCertExp">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -1351,6 +1416,7 @@
|
|||
<widget class="QLabel" name="lblUpdates">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -1582,6 +1648,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
<widget class="QLabel" name="lblBoxRoot">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -1694,6 +1761,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
<widget class="QLabel" name="lblBoxFeatures">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -1785,6 +1853,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
<widget class="QLabel" name="lblProtection">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
|
@ -2145,16 +2214,6 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btnEditIni">
|
||||
<property name="text">
|
||||
<string>Edit ini</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
|
@ -2168,6 +2227,16 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btnEditIni">
|
||||
<property name="text">
|
||||
<string>Edit ini</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="btnCancelEdit">
|
||||
<property name="enabled">
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
|
@ -175,6 +175,8 @@
|
|||
<file>Actions/AntiVir.png</file>
|
||||
<file>Actions/SourceCode.png</file>
|
||||
<file>Actions/Qube.png</file>
|
||||
<file>Actions/Font.png</file>
|
||||
<file>Actions/ResetFont.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Boxes">
|
||||
<file alias="Empty3">Boxes/sandbox-b-empty.png</file>
|
||||
|
|
|
@ -532,6 +532,8 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
|
|||
connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab()));
|
||||
|
||||
// edit
|
||||
ApplyIniEditFont();
|
||||
|
||||
connect(ui.btnEditIni, SIGNAL(clicked(bool)), this, SLOT(OnEditIni()));
|
||||
connect(ui.btnSaveIni, SIGNAL(clicked(bool)), this, SLOT(OnSaveIni()));
|
||||
connect(ui.btnCancelEdit, SIGNAL(clicked(bool)), this, SLOT(OnCancelEdit()));
|
||||
|
@ -625,6 +627,14 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& pBox, const QStri
|
|||
m_pSearch->setPlaceholderText(tr("Search for options"));
|
||||
}
|
||||
|
||||
void COptionsWindow::ApplyIniEditFont()
|
||||
{
|
||||
QFont font; // defaults to application font
|
||||
auto fontName = theConf->GetString("UIConfig/IniFont", "").trimmed();
|
||||
if (!fontName.isEmpty()) bool dummy = font.fromString(fontName); // ignore fromString() fail
|
||||
ui.txtIniSection->setFont(font);
|
||||
}
|
||||
|
||||
void COptionsWindow::OnSetTree()
|
||||
{
|
||||
if (!ui.tabs) return;
|
||||
|
|
|
@ -481,6 +481,8 @@ protected:
|
|||
void LoadIniSection();
|
||||
void SaveIniSection();
|
||||
|
||||
void ApplyIniEditFont();
|
||||
|
||||
QString GetCategoryName(const QString& Category);
|
||||
|
||||
bool m_HoldChange;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QJsonDocument>
|
||||
#include "../Wizards/TemplateWizard.h"
|
||||
#include "../AddonManager.h"
|
||||
#include <qfontdialog.h>
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -493,6 +494,15 @@ CSettingsWindow::CSettingsWindow(QWidget* parent)
|
|||
connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab()));
|
||||
|
||||
// Ini Edit
|
||||
|
||||
ui.btnSelectIniFont->setIcon(CSandMan::GetIcon("Font"));
|
||||
ui.btnSelectIniFont->setToolTip(tr("Select font"));
|
||||
ui.btnResetIniFont->setIcon(CSandMan::GetIcon("ResetFont"));
|
||||
ui.btnResetIniFont->setToolTip(tr("Reset font"));
|
||||
ApplyIniEditFont();
|
||||
|
||||
connect(ui.btnSelectIniFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont()));
|
||||
connect(ui.btnResetIniFont, SIGNAL(clicked(bool)), this, SLOT(OnResetIniEditFont()));
|
||||
connect(ui.btnEditIni, SIGNAL(clicked(bool)), this, SLOT(OnEditIni()));
|
||||
connect(ui.btnSaveIni, SIGNAL(clicked(bool)), this, SLOT(OnSaveIni()));
|
||||
connect(ui.btnCancelEdit, SIGNAL(clicked(bool)), this, SLOT(OnCancelEdit()));
|
||||
|
@ -538,6 +548,30 @@ CSettingsWindow::CSettingsWindow(QWidget* parent)
|
|||
m_pSearch->setPlaceholderText(tr("Search for settings"));
|
||||
}
|
||||
|
||||
void CSettingsWindow::ApplyIniEditFont()
|
||||
{
|
||||
QFont font; // defaults to application font
|
||||
auto fontName = theConf->GetString("UIConfig/IniFont", "").trimmed();
|
||||
if (!fontName.isEmpty()) bool dummy = font.fromString(fontName); // ignore fromString() fail
|
||||
ui.txtIniSection->setFont(font);
|
||||
ui.lblIniEditFont->setText(tr("%0, %1 pt").arg(font.family()).arg(font.pointSizeF())); // tr: example: "Calibri, 9.5 pt"
|
||||
}
|
||||
|
||||
void CSettingsWindow::OnSelectIniEditFont()
|
||||
{
|
||||
bool ok;
|
||||
auto newFont = QFontDialog::getFont(&ok, ui.txtIniSection->font(), this);
|
||||
if (!ok) return;
|
||||
theConf->SetValue("UIConfig/IniFont", newFont.toString());
|
||||
ApplyIniEditFont();
|
||||
}
|
||||
|
||||
void CSettingsWindow::OnResetIniEditFont()
|
||||
{
|
||||
theConf->DelValue("UIConfig/IniFont");
|
||||
ApplyIniEditFont();
|
||||
}
|
||||
|
||||
void CSettingsWindow::OnSetTree()
|
||||
{
|
||||
if (!ui.tabs) return;
|
||||
|
|
|
@ -151,6 +151,9 @@ private slots:
|
|||
|
||||
void OnSetTree();
|
||||
|
||||
void OnSelectIniEditFont();
|
||||
void OnResetIniEditFont();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
|
||||
|
@ -171,6 +174,7 @@ protected:
|
|||
|
||||
void LoadIniSection();
|
||||
void SaveIniSection();
|
||||
void ApplyIniEditFont();
|
||||
|
||||
bool m_bRebuildUI;
|
||||
bool m_HoldChange;
|
||||
|
|
Loading…
Reference in New Issue