src/settingseditor/settingseditor.cpp

changeset 356
65b4741b302d
parent 347
5c655cc006de
child 357
66c75604f5b8
equal deleted inserted replaced
355:e81f4ad53efd 356:65b4741b302d
44 this->ui.toolButtonStyle->addItem(tr("Icons only"), Qt::ToolButtonIconOnly); 44 this->ui.toolButtonStyle->addItem(tr("Icons only"), Qt::ToolButtonIconOnly);
45 this->ui.toolButtonStyle->addItem(tr("Text only"), Qt::ToolButtonTextOnly); 45 this->ui.toolButtonStyle->addItem(tr("Text only"), Qt::ToolButtonTextOnly);
46 this->ui.toolButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonTextBesideIcon); 46 this->ui.toolButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonTextBesideIcon);
47 this->ui.toolButtonStyle->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon); 47 this->ui.toolButtonStyle->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon);
48 this->ui.toolButtonStyle->addItem(tr("Style default"), Qt::ToolButtonFollowStyle); 48 this->ui.toolButtonStyle->addItem(tr("Style default"), Qt::ToolButtonFollowStyle);
49 connect(
50 this->ui.codeEditorSystemFont,
51 &QCheckBox::stateChanged,
52 [this](int state){
53 const bool checked = (state == Qt::Checked);
54 this->ui.codeEditorFontFamily->setEnabled(not checked);
55 this->ui.codeEditorFontSize->setEnabled(not checked);
56 }
57 );
49 this->loadSettings(); 58 this->loadSettings();
50 this->setWindowTitle(tr("Settings")); 59 this->setWindowTitle(tr("Settings"));
51 this->setWindowIcon(QIcon{":/icons/settings-outline.png"}); 60 this->setWindowIcon(QIcon{":/icons/settings-outline.png"});
52 this->librariesEditor.setModel(&libraries); 61 this->librariesEditor.setModel(&libraries);
53 QVBoxLayout* layout = new QVBoxLayout{this}; 62 QVBoxLayout* layout = new QVBoxLayout{this};
103 setSetting<Setting::BackgroundColor>(this->ui.backgroundColorButton->color()); 112 setSetting<Setting::BackgroundColor>(this->ui.backgroundColorButton->color());
104 setSetting<Setting::SelectedColor>(this->ui.selectedColorButton->color()); 113 setSetting<Setting::SelectedColor>(this->ui.selectedColorButton->color());
105 setSetting<Setting::LineThickness>(static_cast<GLfloat>(this->ui.lineThickness->value())); 114 setSetting<Setting::LineThickness>(static_cast<GLfloat>(this->ui.lineThickness->value()));
106 setSetting<Setting::LineAntiAliasing>(this->ui.lineAntiAliasing->isChecked()); 115 setSetting<Setting::LineAntiAliasing>(this->ui.lineAntiAliasing->isChecked());
107 setSetting<Setting::LogOpenGLDebugMessages>(this->ui.logOpenGLDebugMessages->isChecked()); 116 setSetting<Setting::LogOpenGLDebugMessages>(this->ui.logOpenGLDebugMessages->isChecked());
117 setSetting<Setting::CodeEditorUseSystemFont>(this->ui.codeEditorSystemFont->isChecked());
118 setSetting<Setting::CodeEditorFontFamily>(this->ui.codeEditorFontFamily->currentText());
119 setSetting<Setting::CodeEditorFontSize>(this->ui.codeEditorFontSize->value());
108 const int viewMode = this->ui.viewModeButtonGroup->checkedId(); 120 const int viewMode = this->ui.viewModeButtonGroup->checkedId();
109 if (viewMode != -1) { 121 if (viewMode != -1) {
110 setSetting<Setting::ViewMode>(static_cast<QMdiArea::ViewMode>(viewMode)); 122 setSetting<Setting::ViewMode>(static_cast<QMdiArea::ViewMode>(viewMode));
111 } 123 }
112 const QVariant toolButtonStyle = this->ui.toolButtonStyle->currentData(); 124 const QVariant toolButtonStyle = this->ui.toolButtonStyle->currentData();
125 this->ui.backgroundColorButton->setColor(setting<Setting::BackgroundColor>()); 137 this->ui.backgroundColorButton->setColor(setting<Setting::BackgroundColor>());
126 this->ui.selectedColorButton->setColor(setting<Setting::SelectedColor>()); 138 this->ui.selectedColorButton->setColor(setting<Setting::SelectedColor>());
127 this->ui.lineThickness->setValue(double_cast(setting<Setting::LineThickness>())); 139 this->ui.lineThickness->setValue(double_cast(setting<Setting::LineThickness>()));
128 this->ui.lineAntiAliasing->setChecked(setting<Setting::LineAntiAliasing>()); 140 this->ui.lineAntiAliasing->setChecked(setting<Setting::LineAntiAliasing>());
129 this->ui.logOpenGLDebugMessages->setChecked(setting<Setting::LogOpenGLDebugMessages>()); 141 this->ui.logOpenGLDebugMessages->setChecked(setting<Setting::LogOpenGLDebugMessages>());
142 this->ui.codeEditorSystemFont->setChecked(setting<Setting::CodeEditorUseSystemFont>());
143 this->ui.codeEditorFontFamily->setCurrentText(setting<Setting::CodeEditorFontFamily>());
144 this->ui.codeEditorFontSize->setValue(setting<Setting::CodeEditorFontSize>());
130 auto* const viewModeButton = this->ui.viewModeButtonGroup->button(setting<Setting::ViewMode>()); 145 auto* const viewModeButton = this->ui.viewModeButtonGroup->button(setting<Setting::ViewMode>());
131 if (viewModeButton != nullptr) { 146 if (viewModeButton != nullptr) {
132 viewModeButton->setChecked(true); 147 viewModeButton->setChecked(true);
133 } 148 }
134 int toolButtonStyleIndex = this->ui.toolButtonStyle->findData( 149 int toolButtonStyleIndex = this->ui.toolButtonStyle->findData(

mercurial