diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index def57166..d85e164b 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -48,7 +48,7 @@ QTabWidget::North - 4 + 2 @@ -85,6 +85,7 @@ + 75 true true @@ -127,6 +128,7 @@ + 75 true true @@ -257,6 +259,7 @@ + 75 true true @@ -289,6 +292,7 @@ + 75 true true @@ -422,6 +426,7 @@ + 75 true true @@ -478,6 +483,7 @@ + 75 true true @@ -498,6 +504,7 @@ + 75 true true @@ -561,6 +568,7 @@ + 75 true true @@ -834,6 +842,7 @@ + 75 true true @@ -948,43 +957,17 @@ - - - - - + + - High DPI Scaling + Ini Editor Font Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Font Scaling - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + Qt::Horizontal @@ -997,7 +980,111 @@ + + + + Font Scaling + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + High DPI Scaling + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 75 + true + true + + + + Graphic Options + + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Select font + + + + + + + + + + Reset font + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + Qt::Horizontal @@ -1010,28 +1097,14 @@ - - - - (Restart required) - - - - - - - true - - - - + % - + Qt::Vertical @@ -1044,31 +1117,22 @@ - - - - - true - true - - + + + + + - Graphic Options + (Restart required) - - - Qt::Horizontal + + + # - - - 40 - 20 - - - + @@ -1086,7 +1150,7 @@ - 1 + 0 @@ -1226,6 +1290,7 @@ + 75 true true @@ -1351,6 +1416,7 @@ + 75 true true @@ -1582,6 +1648,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, + 75 true true @@ -1694,6 +1761,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, + 75 true true @@ -1785,6 +1853,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, + 75 true true @@ -2145,16 +2214,6 @@ Unlike the preview channel, it does not include untested, potentially breaking, - - - - Edit ini - - - false - - - @@ -2168,6 +2227,16 @@ Unlike the preview channel, it does not include untested, potentially breaking, + + + + Edit ini + + + false + + + diff --git a/SandboxiePlus/SandMan/Resources/Actions/Font.png b/SandboxiePlus/SandMan/Resources/Actions/Font.png new file mode 100644 index 00000000..c9e100a2 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Actions/Font.png differ diff --git a/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png b/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png new file mode 100644 index 00000000..104ada88 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png differ diff --git a/SandboxiePlus/SandMan/Resources/SandMan.qrc b/SandboxiePlus/SandMan/Resources/SandMan.qrc index ef0fde97..80d7f8e6 100644 --- a/SandboxiePlus/SandMan/Resources/SandMan.qrc +++ b/SandboxiePlus/SandMan/Resources/SandMan.qrc @@ -175,6 +175,8 @@ Actions/AntiVir.png Actions/SourceCode.png Actions/Qube.png + Actions/Font.png + Actions/ResetFont.png Boxes/sandbox-b-empty.png diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index ea14acfd..ced80740 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -532,6 +532,8 @@ COptionsWindow::COptionsWindow(const QSharedPointer& 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& 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; diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.h b/SandboxiePlus/SandMan/Windows/OptionsWindow.h index e2cb0e4f..63cf081d 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.h +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.h @@ -481,6 +481,8 @@ protected: void LoadIniSection(); void SaveIniSection(); + void ApplyIniEditFont(); + QString GetCategoryName(const QString& Category); bool m_HoldChange; diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index c0816b82..de2182cc 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -13,6 +13,7 @@ #include #include "../Wizards/TemplateWizard.h" #include "../AddonManager.h" +#include #include @@ -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; diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.h b/SandboxiePlus/SandMan/Windows/SettingsWindow.h index 2639c8fe..daa504c8 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.h +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.h @@ -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;