Ability to select font for ini editor panels.
This commit is contained in:
parent
d11d55bd27
commit
849465ee40
|
@ -4643,6 +4643,26 @@ Please note that this values are currently user specific and saved globally for
|
|||
<string>Edit ini Section</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnSelectIniEditFont">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btnEditIni">
|
||||
<property name="text">
|
||||
|
@ -4653,7 +4673,7 @@ Please note that this values are currently user specific and saved globally for
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="6">
|
||||
<widget class="QPushButton" name="btnCancelEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -4663,20 +4683,7 @@ Please note that this values are currently user specific and saved globally for
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="2">
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="btnSaveIni">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -4686,13 +4693,36 @@ Please note that this values are currently user specific and saved globally for
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<item row="1" column="0" colspan="7">
|
||||
<widget class="QPlainTextEdit" name="txtIniSection">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="btnResetIniEditFont">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
@ -2135,7 +2135,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
<string>Edit ini Section</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="btnSaveIni">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -2145,6 +2145,36 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="btnResetIniEditFont">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnSelectIniEditFont">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btnEditIni">
|
||||
<property name="text">
|
||||
|
@ -2155,7 +2185,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -2168,7 +2198,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="6">
|
||||
<widget class="QPushButton" name="btnCancelEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -2178,7 +2208,7 @@ Unlike the preview channel, it does not include untested, potentially breaking,
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<item row="1" column="0" colspan="7">
|
||||
<widget class="QPlainTextEdit" name="txtIniSection">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
|
|
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>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "../MiscHelpers/Common/SettingsWidgets.h"
|
||||
#include "Helpers/WinAdmin.h"
|
||||
#include "../Wizards/TemplateWizard.h"
|
||||
|
||||
#include <qfontdialog.h>
|
||||
|
||||
class NoEditDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
|
@ -532,6 +532,13 @@ COptionsWindow::COptionsWindow(const QSharedPointer<CSbieIni>& 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<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);
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <QJsonDocument>
|
||||
#include "../Wizards/TemplateWizard.h"
|
||||
#include "../AddonManager.h"
|
||||
#include <qfontdialog.h>
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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