From b370aeed686a08b8319863c45718843ff1bfc03b Mon Sep 17 00:00:00 2001 From: typpos <28550406+typpos@users.noreply.github.com> Date: Fri, 9 Jun 2023 18:47:09 +1000 Subject: [PATCH 1/3] Ability to select font for ini editor panels. --- SandboxiePlus/SandMan/Forms/OptionsWindow.ui | 62 +++++++++++++----- SandboxiePlus/SandMan/Forms/SettingsWindow.ui | 38 +++++++++-- .../SandMan/Resources/Actions/Font.png | Bin 0 -> 2163 bytes .../SandMan/Resources/Actions/ResetFont.png | Bin 0 -> 4112 bytes SandboxiePlus/SandMan/Resources/SandMan.qrc | 2 + .../SandMan/Windows/OptionsWindow.cpp | 33 +++++++++- SandboxiePlus/SandMan/Windows/OptionsWindow.h | 5 ++ .../SandMan/Windows/SettingsWindow.cpp | 33 ++++++++++ .../SandMan/Windows/SettingsWindow.h | 4 ++ 9 files changed, 156 insertions(+), 21 deletions(-) create mode 100644 SandboxiePlus/SandMan/Resources/Actions/Font.png create mode 100644 SandboxiePlus/SandMan/Resources/Actions/ResetFont.png diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 4e70d414..4b31551c 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -4643,6 +4643,26 @@ Please note that this values are currently user specific and saved globally for Edit ini Section + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + + + @@ -4653,7 +4673,7 @@ Please note that this values are currently user specific and saved globally for - + false @@ -4663,20 +4683,7 @@ Please note that this values are currently user specific and saved globally for - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + false @@ -4686,13 +4693,36 @@ Please note that this values are currently user specific and saved globally for - + QPlainTextEdit::NoWrap + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + + + + diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index 3239b114..4925400e 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -1944,7 +1944,7 @@ Edit ini Section - + false @@ -1954,6 +1954,36 @@ + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 10 + 20 + + + + @@ -1964,7 +1994,7 @@ - + Qt::Horizontal @@ -1977,7 +2007,7 @@ - + false @@ -1987,7 +2017,7 @@ - + QPlainTextEdit::NoWrap diff --git a/SandboxiePlus/SandMan/Resources/Actions/Font.png b/SandboxiePlus/SandMan/Resources/Actions/Font.png new file mode 100644 index 0000000000000000000000000000000000000000..c9e100a264343f1a00ceb6529346a7bccf81d314 GIT binary patch literal 2163 zcmbVO4Qvxt9Ph^LSZ5IeBtQ(_Zm64hy^mhI-i5Mt>!1U=;a1o%!SH(b+Foey&bu4! zkT`H+#ujlT1_^PGv+nbivH(UcYlCxC2C-eZn2ckG_L~7p1pG{ z7HgLjYBSn`D|kUkIDn{xp(B-05!zx|RGm_RupSy%7)B-8i{CnS0>>oLi?_OhR8Xyh zF)6T7gDo2yL&C=O0w?0ti?Ky19uXv<0kBjeF6(^Ci>G;cG&ZM697{ut^Dgsc3!>RkT*}K! z8q)|8C@&yCU+H<1#GEG|U^&u%4^#BQv?a||m2rT)hl}af<^z(Bnyw=&*8*Rh5Keb9 z4+L|SdU3&QPZTqjnU*H0`S-abL9c;M2 z>krq28Pa^$CtXJW$MtMlgcy*c5bgQoL>V(hA^%&ibcype(($UJ-Ps)G&IR<4J6WKN zs5NwM47^o|4zGfp4SruJcIlTrKfXSKJ-XFdd!%ro(bcm0x^3X(fobPw57w?eV;kt3 z-L|Fl>DHdclA}fOYulIIYI^dS&QEU7KeX?UYpYAExvQsOb?y#2G#h#iUTCUV@9@u&#u-v}; z^19-Z-m0&gAG-nnzfm)d*j?>7QpdcPZeZ}IN3 n;>(xoM^6u*P}#mt>#z2i$70vkmX#bcKMNY_8~ulC*S+#DcfQ`g literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png b/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png new file mode 100644 index 0000000000000000000000000000000000000000..104ada88dfa0f046c5ee7d962b20160ed1c39ff6 GIT binary patch literal 4112 zcmcgv30xCr79T(XkyHh&AXdjvX;dbenOsaHHNF>RGBocyjK@d6A ziq@sngQ`HaRBS!4ibttZDvDOE3NCAHwH~;(v}gsj;!XlY>}qwlyPMxHnQvy^d;j001j4Ru<1(QQOzumH8bVTCknD3^K$fnE+t0x9#f$tXby^03H^N z;&t=u@+lI6)^Tx?R#Mz_oq>@CfRNC115Tt+W>85bYxGif`@YZFpoWyPX9?x7+z?5r zHL)2+Dj{R4g2+fAFp?emDj1S3VGQUfGY+Qfw0e^yUCOrGl`w1DV;&o{i~I?( z__};L7)cu`P{f5H0)|DP7~_(-5+{_(AP|L7ga-?Fhya3N2_KUP1Yqxn&A=H+l_Xvk z-3!LtN!e<%*&yNZEEWsb!spV)WFCTH7!O8yC<-wWkjbhyr!a%M-&GFC91V5H4(s$u39|4mraDqt*^i5C;Fn(IUr2ts5B;wUP7KIZBkeb6fd4K(F=?O z6_v)g8PFGv$sA8T;`2Gw8F9O^K@w@Ca5HUG(6qKM&C~nh1yPhM06DWXdXl!7#@o<( z6(|{Qrlf2p<$MShLMW<0V2OY)fdvzp1q}Cy%4t%gvi27hK`^F3Pzj7k5b=3 z8GoiQNk~+*QHL{ZX>@op#WU!W*`Ol_l1N%h8yR56JHFiuxm*&bH<@ugLB+|WY$gP* zMng)3s2D>~3Ws2nq##%zKp`9!sF>2lgoIEiMoF0H)0ff20$W+w^m|%_qzT5xBUA(z zDFrHiFhn3Q1rdA!0tJgG0wQsNQmi6_N%WDmX+{mxrMR}gRhw5NV-XG(3oulyghZGU zfk>qQgMu-U5)ukfQVfd`6bTmFTHz70f=V|}!L5|h)Z1ebcyjMbtLev!U1ln-V|c;) z^JRZ-Gh%zr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L$ELEX%mx?-&chrvp26ubG@ye6=C5;U6=HZ$gi&t>@N%vOLY# z=}=>~8F|Zp>#sF=9(RT=yXFfAED2o5I=PPu3%{g`KQSJv>CIh~_h*LC`oBX3_c z6i09udtmV?hunsRv|H#dq{QTJKaB;?{0U3uPp~~QU2EE-T6PRI5TV| z6}@>q?EFJ~HEZmJt~1%5^<8PB{PiWdo()o`fUx+Q(uqM|BnrXY)b?Qw7)QMN=l1#J z(oNWTH?Oi!#6uQTy6wBSHu~cuYa#aM-d$l}2@z!`+`@Hv*%Qw#d2< zOgI)a&gEp~^lh4-b`1~R9Qu=WbLa{0CJH=QdZS#Qg&KHGpTvgm&X#p2z8mgxbu%Yy z^vgpMy6)c#JH4}f8-F2v=1TG+pH1GU#vGc&(rMSe=lqLX&79_<+OLm%QChyuBrwi) z%Gk8~MPPsHi1LO5UOK1s-()U2;Wg~1#ckuPzMa!bI9YWe7p+TY1NTNN>hYAO2mHL^ z$Gq#)Qn8y@0x$5u*JfTh?&>H=WKT7hotrOzn literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/SandMan.qrc b/SandboxiePlus/SandMan/Resources/SandMan.qrc index b3e1540c..6f434811 100644 --- a/SandboxiePlus/SandMan/Resources/SandMan.qrc +++ b/SandboxiePlus/SandMan/Resources/SandMan.qrc @@ -154,6 +154,8 @@ Actions/PauseForce.png Actions/DisableMessagePopup.png Actions/DisableRecovery.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 81e320d2..fc8b018b 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -8,7 +8,7 @@ #include "../MiscHelpers/Common/SettingsWidgets.h" #include "Helpers/WinAdmin.h" #include "../Wizards/TemplateWizard.h" - +#include class NoEditDelegate : public QStyledItemDelegate { public: @@ -532,6 +532,13 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // edit + ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); + ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); + ui.btnResetIniEditFont->setToolTip(tr("Reset font")); + ApplyIniEditFont(); + + connect(ui.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); + connect(ui.btnResetIniEditFont, 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())); @@ -625,6 +632,30 @@ 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); + ui.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font +} + +void COptionsWindow::OnSelectIniEditFont() +{ + bool ok; + auto newFont = QFontDialog::getFont(&ok, ui.txtIniSection->font(), this); + if (!ok) return; + theConf->SetValue("UIConfig/IniFont", newFont.toString()); + ApplyIniEditFont(); +} + +void COptionsWindow::OnResetIniEditFont() +{ + theConf->DelValue("UIConfig/IniFont"); + ApplyIniEditFont(); +} + void COptionsWindow::OnSetTree() { if (!ui.tabs) return; diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.h b/SandboxiePlus/SandMan/Windows/OptionsWindow.h index e2cb0e4f..09c1059c 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.h +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.h @@ -228,6 +228,9 @@ private slots: void OnSetTree(); + void OnSelectIniEditFont(); + void OnResetIniEditFont(); + protected: void closeEvent(QCloseEvent *e); @@ -481,6 +484,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 432b310a..3a7b6403 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -12,6 +12,7 @@ #include "../MiscHelpers/Archive/ArchiveFS.h" #include #include "../Wizards/TemplateWizard.h" +#include #include @@ -454,6 +455,14 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // Ini Edit + + ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); + ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); + ui.btnResetIniEditFont->setToolTip(tr("Reset font")); + ApplyIniEditFont(); + + connect(ui.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); + connect(ui.btnResetIniEditFont, 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())); @@ -496,6 +505,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.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font +} + +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 2c19ce0f..093bb1b2 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.h +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.h @@ -141,6 +141,9 @@ private slots: void OnSetTree(); + void OnSelectIniEditFont(); + void OnResetIniEditFont(); + protected: void closeEvent(QCloseEvent *e); @@ -161,6 +164,7 @@ protected: void LoadIniSection(); void SaveIniSection(); + void ApplyIniEditFont(); bool m_bRebuildUI; bool m_HoldChange; From 849465ee40007075cf08497a840c10446a654330 Mon Sep 17 00:00:00 2001 From: typpos <28550406+typpos@users.noreply.github.com> Date: Fri, 9 Jun 2023 18:47:09 +1000 Subject: [PATCH 2/3] Ability to select font for ini editor panels. --- SandboxiePlus/SandMan/Forms/OptionsWindow.ui | 62 +++++++++++++----- SandboxiePlus/SandMan/Forms/SettingsWindow.ui | 38 +++++++++-- .../SandMan/Resources/Actions/Font.png | Bin 0 -> 2163 bytes .../SandMan/Resources/Actions/ResetFont.png | Bin 0 -> 4112 bytes SandboxiePlus/SandMan/Resources/SandMan.qrc | 2 + .../SandMan/Windows/OptionsWindow.cpp | 33 +++++++++- SandboxiePlus/SandMan/Windows/OptionsWindow.h | 5 ++ .../SandMan/Windows/SettingsWindow.cpp | 33 ++++++++++ .../SandMan/Windows/SettingsWindow.h | 4 ++ 9 files changed, 156 insertions(+), 21 deletions(-) create mode 100644 SandboxiePlus/SandMan/Resources/Actions/Font.png create mode 100644 SandboxiePlus/SandMan/Resources/Actions/ResetFont.png diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 4e70d414..4b31551c 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -4643,6 +4643,26 @@ Please note that this values are currently user specific and saved globally for Edit ini Section + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + + + @@ -4653,7 +4673,7 @@ Please note that this values are currently user specific and saved globally for - + false @@ -4663,20 +4683,7 @@ Please note that this values are currently user specific and saved globally for - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + false @@ -4686,13 +4693,36 @@ Please note that this values are currently user specific and saved globally for - + QPlainTextEdit::NoWrap + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + + + + diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index a041d84c..ca9e9cc3 100644 --- a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui @@ -2135,7 +2135,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, Edit ini Section - + false @@ -2145,6 +2145,36 @@ Unlike the preview channel, it does not include untested, potentially breaking, + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 10 + 20 + + + + @@ -2155,7 +2185,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, - + Qt::Horizontal @@ -2168,7 +2198,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, - + false @@ -2178,7 +2208,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, - + QPlainTextEdit::NoWrap diff --git a/SandboxiePlus/SandMan/Resources/Actions/Font.png b/SandboxiePlus/SandMan/Resources/Actions/Font.png new file mode 100644 index 0000000000000000000000000000000000000000..c9e100a264343f1a00ceb6529346a7bccf81d314 GIT binary patch literal 2163 zcmbVO4Qvxt9Ph^LSZ5IeBtQ(_Zm64hy^mhI-i5Mt>!1U=;a1o%!SH(b+Foey&bu4! zkT`H+#ujlT1_^PGv+nbivH(UcYlCxC2C-eZn2ckG_L~7p1pG{ z7HgLjYBSn`D|kUkIDn{xp(B-05!zx|RGm_RupSy%7)B-8i{CnS0>>oLi?_OhR8Xyh zF)6T7gDo2yL&C=O0w?0ti?Ky19uXv<0kBjeF6(^Ci>G;cG&ZM697{ut^Dgsc3!>RkT*}K! z8q)|8C@&yCU+H<1#GEG|U^&u%4^#BQv?a||m2rT)hl}af<^z(Bnyw=&*8*Rh5Keb9 z4+L|SdU3&QPZTqjnU*H0`S-abL9c;M2 z>krq28Pa^$CtXJW$MtMlgcy*c5bgQoL>V(hA^%&ibcype(($UJ-Ps)G&IR<4J6WKN zs5NwM47^o|4zGfp4SruJcIlTrKfXSKJ-XFdd!%ro(bcm0x^3X(fobPw57w?eV;kt3 z-L|Fl>DHdclA}fOYulIIYI^dS&QEU7KeX?UYpYAExvQsOb?y#2G#h#iUTCUV@9@u&#u-v}; z^19-Z-m0&gAG-nnzfm)d*j?>7QpdcPZeZ}IN3 n;>(xoM^6u*P}#mt>#z2i$70vkmX#bcKMNY_8~ulC*S+#DcfQ`g literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png b/SandboxiePlus/SandMan/Resources/Actions/ResetFont.png new file mode 100644 index 0000000000000000000000000000000000000000..104ada88dfa0f046c5ee7d962b20160ed1c39ff6 GIT binary patch literal 4112 zcmcgv30xCr79T(XkyHh&AXdjvX;dbenOsaHHNF>RGBocyjK@d6A ziq@sngQ`HaRBS!4ibttZDvDOE3NCAHwH~;(v}gsj;!XlY>}qwlyPMxHnQvy^d;j001j4Ru<1(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Qw#d2< zOgI)a&gEp~^lh4-b`1~R9Qu=WbLa{0CJH=QdZS#Qg&KHGpTvgm&X#p2z8mgxbu%Yy z^vgpMy6)c#JH4}f8-F2v=1TG+pH1GU#vGc&(rMSe=lqLX&79_<+OLm%QChyuBrwi) z%Gk8~MPPsHi1LO5UOK1s-()U2;Wg~1#ckuPzMa!bI9YWe7p+TY1NTNN>hYAO2mHL^ z$Gq#)Qn8y@0x$5u*JfTh?&>H=WKT7hotrOzn literal 0 HcmV?d00001 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..4fd0c343 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -8,7 +8,7 @@ #include "../MiscHelpers/Common/SettingsWidgets.h" #include "Helpers/WinAdmin.h" #include "../Wizards/TemplateWizard.h" - +#include class NoEditDelegate : public QStyledItemDelegate { public: @@ -532,6 +532,13 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // edit + ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); + ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); + ui.btnResetIniEditFont->setToolTip(tr("Reset font")); + ApplyIniEditFont(); + + connect(ui.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); + connect(ui.btnResetIniEditFont, 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())); @@ -625,6 +632,30 @@ 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); + ui.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font +} + +void COptionsWindow::OnSelectIniEditFont() +{ + bool ok; + auto newFont = QFontDialog::getFont(&ok, ui.txtIniSection->font(), this); + if (!ok) return; + theConf->SetValue("UIConfig/IniFont", newFont.toString()); + ApplyIniEditFont(); +} + +void COptionsWindow::OnResetIniEditFont() +{ + theConf->DelValue("UIConfig/IniFont"); + ApplyIniEditFont(); +} + void COptionsWindow::OnSetTree() { if (!ui.tabs) return; diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.h b/SandboxiePlus/SandMan/Windows/OptionsWindow.h index e2cb0e4f..09c1059c 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.h +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.h @@ -228,6 +228,9 @@ private slots: void OnSetTree(); + void OnSelectIniEditFont(); + void OnResetIniEditFont(); + protected: void closeEvent(QCloseEvent *e); @@ -481,6 +484,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..ba3b3c34 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,14 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // Ini Edit + + ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); + ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); + ui.btnResetIniEditFont->setToolTip(tr("Reset font")); + ApplyIniEditFont(); + + connect(ui.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); + connect(ui.btnResetIniEditFont, 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 +547,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.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font +} + +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; From 29017c51bca0b300fa68a0c68463925809d4ecde Mon Sep 17 00:00:00 2001 From: typpos <28550406+typpos@users.noreply.github.com> Date: Mon, 3 Jul 2023 21:58:49 +1000 Subject: [PATCH 3/3] Move ini font selector to Display Options --- SandboxiePlus/SandMan/Forms/OptionsWindow.ui | 62 ++--- SandboxiePlus/SandMan/Forms/SettingsWindow.ui | 243 ++++++++++-------- .../SandMan/Windows/OptionsWindow.cpp | 23 +- SandboxiePlus/SandMan/Windows/OptionsWindow.h | 3 - .../SandMan/Windows/SettingsWindow.cpp | 15 +- 5 files changed, 166 insertions(+), 180 deletions(-) diff --git a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui index 4b31551c..4e70d414 100644 --- a/SandboxiePlus/SandMan/Forms/OptionsWindow.ui +++ b/SandboxiePlus/SandMan/Forms/OptionsWindow.ui @@ -4643,26 +4643,6 @@ Please note that this values are currently user specific and saved globally for Edit ini Section - - - - Qt::Horizontal - - - - 10 - 20 - - - - - - - - - - - @@ -4673,7 +4653,7 @@ Please note that this values are currently user specific and saved globally for - + false @@ -4683,7 +4663,20 @@ Please note that this values are currently user specific and saved globally for - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + false @@ -4693,36 +4686,13 @@ Please note that this values are currently user specific and saved globally for - + QPlainTextEdit::NoWrap - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 20 - 20 - - - - - - - - - - - diff --git a/SandboxiePlus/SandMan/Forms/SettingsWindow.ui b/SandboxiePlus/SandMan/Forms/SettingsWindow.ui index ca9e9cc3..6ece66d4 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 @@ -2135,7 +2204,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, Edit ini Section - + false @@ -2145,31 +2214,14 @@ Unlike the preview channel, it does not include untested, potentially breaking, - - - - - - - - - - - - - - - + Qt::Horizontal - - QSizePolicy::Minimum - - 10 + 40 20 @@ -2185,20 +2237,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + false @@ -2208,7 +2247,7 @@ Unlike the preview channel, it does not include untested, potentially breaking, - + QPlainTextEdit::NoWrap diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index 4fd0c343..ced80740 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -8,7 +8,7 @@ #include "../MiscHelpers/Common/SettingsWidgets.h" #include "Helpers/WinAdmin.h" #include "../Wizards/TemplateWizard.h" -#include + class NoEditDelegate : public QStyledItemDelegate { public: @@ -532,13 +532,8 @@ COptionsWindow::COptionsWindow(const QSharedPointer& pBox, const QStri connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // edit - ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); - ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); - ui.btnResetIniEditFont->setToolTip(tr("Reset font")); ApplyIniEditFont(); - connect(ui.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); - connect(ui.btnResetIniEditFont, 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())); @@ -638,22 +633,6 @@ void COptionsWindow::ApplyIniEditFont() auto fontName = theConf->GetString("UIConfig/IniFont", "").trimmed(); if (!fontName.isEmpty()) bool dummy = font.fromString(fontName); // ignore fromString() fail ui.txtIniSection->setFont(font); - ui.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font -} - -void COptionsWindow::OnSelectIniEditFont() -{ - bool ok; - auto newFont = QFontDialog::getFont(&ok, ui.txtIniSection->font(), this); - if (!ok) return; - theConf->SetValue("UIConfig/IniFont", newFont.toString()); - ApplyIniEditFont(); -} - -void COptionsWindow::OnResetIniEditFont() -{ - theConf->DelValue("UIConfig/IniFont"); - ApplyIniEditFont(); } void COptionsWindow::OnSetTree() diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.h b/SandboxiePlus/SandMan/Windows/OptionsWindow.h index 09c1059c..63cf081d 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.h +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.h @@ -228,9 +228,6 @@ private slots: void OnSetTree(); - void OnSelectIniEditFont(); - void OnResetIniEditFont(); - protected: void closeEvent(QCloseEvent *e); diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index ba3b3c34..de2182cc 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -494,14 +494,15 @@ CSettingsWindow::CSettingsWindow(QWidget* parent) connect(ui.tabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab())); // Ini Edit - - ui.btnSelectIniEditFont->setIcon(CSandMan::GetIcon("Font")); - ui.btnResetIniEditFont->setIcon(CSandMan::GetIcon("ResetFont")); - ui.btnResetIniEditFont->setToolTip(tr("Reset font")); + + 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.btnSelectIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnSelectIniEditFont())); - connect(ui.btnResetIniEditFont, SIGNAL(clicked(bool)), this, SLOT(OnResetIniEditFont())); + 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())); @@ -553,7 +554,7 @@ void CSettingsWindow::ApplyIniEditFont() auto fontName = theConf->GetString("UIConfig/IniFont", "").trimmed(); if (!fontName.isEmpty()) bool dummy = font.fromString(fontName); // ignore fromString() fail ui.txtIniSection->setFont(font); - ui.btnSelectIniEditFont->setToolTip(tr("Select font (%1)").arg(font.family())); //tr: %1 = name of current font + ui.lblIniEditFont->setText(tr("%0, %1 pt").arg(font.family()).arg(font.pointSizeF())); // tr: example: "Calibri, 9.5 pt" } void CSettingsWindow::OnSelectIniEditFont()