src/settingseditor/settingseditor.cpp

changeset 356
65b4741b302d
parent 347
5c655cc006de
child 357
66c75604f5b8
--- a/src/settingseditor/settingseditor.cpp	Sat Apr 08 16:59:55 2023 +0300
+++ b/src/settingseditor/settingseditor.cpp	Sat Apr 08 21:48:49 2023 +0300
@@ -46,6 +46,15 @@
 	this->ui.toolButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonTextBesideIcon);
 	this->ui.toolButtonStyle->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon);
 	this->ui.toolButtonStyle->addItem(tr("Style default"), Qt::ToolButtonFollowStyle);
+	connect(
+		this->ui.codeEditorSystemFont,
+		&QCheckBox::stateChanged,
+		[this](int state){
+			const bool checked = (state == Qt::Checked);
+			this->ui.codeEditorFontFamily->setEnabled(not checked);
+			this->ui.codeEditorFontSize->setEnabled(not checked);
+		}
+	);
 	this->loadSettings();
 	this->setWindowTitle(tr("Settings"));
 	this->setWindowIcon(QIcon{":/icons/settings-outline.png"});
@@ -105,6 +114,9 @@
 	setSetting<Setting::LineThickness>(static_cast<GLfloat>(this->ui.lineThickness->value()));
 	setSetting<Setting::LineAntiAliasing>(this->ui.lineAntiAliasing->isChecked());
 	setSetting<Setting::LogOpenGLDebugMessages>(this->ui.logOpenGLDebugMessages->isChecked());
+	setSetting<Setting::CodeEditorUseSystemFont>(this->ui.codeEditorSystemFont->isChecked());
+	setSetting<Setting::CodeEditorFontFamily>(this->ui.codeEditorFontFamily->currentText());
+	setSetting<Setting::CodeEditorFontSize>(this->ui.codeEditorFontSize->value());
 	const int viewMode = this->ui.viewModeButtonGroup->checkedId();
 	if (viewMode != -1) {
 		setSetting<Setting::ViewMode>(static_cast<QMdiArea::ViewMode>(viewMode));
@@ -127,6 +139,9 @@
 	this->ui.lineThickness->setValue(double_cast(setting<Setting::LineThickness>()));
 	this->ui.lineAntiAliasing->setChecked(setting<Setting::LineAntiAliasing>());
 	this->ui.logOpenGLDebugMessages->setChecked(setting<Setting::LogOpenGLDebugMessages>());
+	this->ui.codeEditorSystemFont->setChecked(setting<Setting::CodeEditorUseSystemFont>());
+	this->ui.codeEditorFontFamily->setCurrentText(setting<Setting::CodeEditorFontFamily>());
+	this->ui.codeEditorFontSize->setValue(setting<Setting::CodeEditorFontSize>());
 	auto* const viewModeButton = this->ui.viewModeButtonGroup->button(setting<Setting::ViewMode>());
 	if (viewModeButton != nullptr) {
 		viewModeButton->setChecked(true);

mercurial