MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / updateSettings

Method updateSettings

src/plugins/codeeditor/gui/private/texteditor_p.cpp:178–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void TextEditorPrivate::updateSettings()
179{
180 fontName = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontFamily, DEFAULT_FONT_NAME).toString();
181 fontSize = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontSize, 10).toInt();
182 commentSettings = EditorSettings::instance()->getMap(Node::MimeTypeConfig);
183
184 QFont font(fontName, fontSize, QFont::Normal);
185 if (q->lexer())
186 q->lexer()->setDefaultFont(font);
187 else if (!fileName.isEmpty())
188 q->setFont(font);
189
190 int fontZoom = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontZoom, 100).toInt();
191 int realFontZoom = (fontZoom - 100) / 10;
192 {
193 // Avoid triggering the `zoomChanged` signal.
194 QSignalBlocker blk(q);
195 q->zoomTo(realFontZoom);
196 }
197
198 // Indentation
199 auto tabPolicy = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::TabPolicy, 0).toInt();
200 auto tabSize = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::TabSize, 4).toInt();
201 auto autoIndent = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::EnableAutoIndentation, true).toBool();
202 q->setIndentationsUseTabs(tabPolicy);
203 q->setTabWidth(tabSize);
204 q->setWhitespaceSize(3);
205 q->setAutoIndent(autoIndent);
206
207 int hoverTime = EditorSettings::instance()->value(Node::Behavior, Group::TipGroup, Key::TipActiveTime, 500).toInt();
208 q->SendScintilla(TextEditor::SCI_SETMOUSEDWELLTIME, hoverTime);
209
210 // Highlight the current line
211 q->setCaretLineVisible(true);
212
213 // Opening brace matching
214 q->setBraceMatching(TextEditor::SloppyBraceMatch);
215
216 q->setEolMode(TextEditor::EolUnix);
217 q->setScrollWidth(1);
218 q->setScrollWidthTracking(true);
219
220 resetThemeColor();
221
222 q->setMarginsFont(font);
223 q->updateLineNumberWidth(false);
224}
225
226void TextEditorPrivate::onSelectionChanged()
227{

Callers

nothing calls this directly

Calls 15

getMapMethod · 0.80
setDefaultFontMethod · 0.80
zoomToMethod · 0.80
setTabWidthMethod · 0.80
setWhitespaceSizeMethod · 0.80
setAutoIndentMethod · 0.80
setCaretLineVisibleMethod · 0.80
setBraceMatchingMethod · 0.80
setEolModeMethod · 0.80
setScrollWidthMethod · 0.80

Tested by

no test coverage detected