texteditorsettings.cpp 17.6 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
hjk's avatar
hjk committed
7
** Contact: Nokia Corporation (info@qt.nokia.com)
con's avatar
con committed
8
**
9
**
10
** GNU Lesser General Public License Usage
11
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
Tobias Hunger's avatar
Tobias Hunger committed
29
** Nokia at info@qt.nokia.com.
con's avatar
con committed
30
**
31
**************************************************************************/
hjk's avatar
hjk committed
32

con's avatar
con committed
33
#include "texteditorsettings.h"
34
#include "texteditorconstants.h"
con's avatar
con committed
35

36
#include "basetexteditor.h"
37
#include "behaviorsettings.h"
38
#include "behaviorsettingspage.h"
39
#include "completionsettings.h"
con's avatar
con committed
40
#include "displaysettings.h"
41
#include "displaysettingspage.h"
con's avatar
con committed
42
#include "fontsettingspage.h"
Jarek Kobus's avatar
Jarek Kobus committed
43
#include "typingsettings.h"
con's avatar
con committed
44
45
#include "storagesettings.h"
#include "tabsettings.h"
46
#include "extraencodingsettings.h"
con's avatar
con committed
47
#include "texteditorplugin.h"
48
#include "highlightersettingspage.h"
49
#include "snippetssettingspage.h"
Jarek Kobus's avatar
Jarek Kobus committed
50
51
#include "icodestylepreferences.h"
#include "icodestylepreferencesfactory.h"
con's avatar
con committed
52

53
#include <extensionsystem/pluginmanager.h>
54
#include <coreplugin/icore.h>
hjk's avatar
hjk committed
55
56
#include <utils/qtcassert.h>

57
#include <QtGui/QApplication>
con's avatar
con committed
58
59
60

using namespace TextEditor;
using namespace TextEditor::Constants;
61
62
63
64
65
66
67
68
69
70
71
using namespace TextEditor::Internal;

namespace TextEditor {
namespace Internal {

class TextEditorSettingsPrivate
{
public:
    FontSettingsPage *m_fontSettingsPage;
    BehaviorSettingsPage *m_behaviorSettingsPage;
    DisplaySettingsPage *m_displaySettingsPage;
72
    HighlighterSettingsPage *m_highlighterSettingsPage;
73
    SnippetsSettingsPage *m_snippetsSettingsPage;
74

Jarek Kobus's avatar
Jarek Kobus committed
75
    QMap<QString, ICodeStylePreferencesFactory *> m_languageToFactory;
76

Jarek Kobus's avatar
Jarek Kobus committed
77
78
    QMap<QString, ICodeStylePreferences *> m_languageToCodeStyle;
    QMap<QString, CodeStylePool *> m_languageToCodeStylePool;
79
80
    QMap<QString, QString> m_mimeTypeToLanguage;

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
    CompletionSettings m_completionSettings;

    void fontZoomRequested(int pointSize);
    void zoomResetRequested();
};

void TextEditorSettingsPrivate::fontZoomRequested(int zoom)
{
    FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
    fs.setFontZoom(qMax(10, fs.fontZoom() + zoom));
    m_fontSettingsPage->saveSettings();
}

void TextEditorSettingsPrivate::zoomResetRequested()
{
    FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
    fs.setFontZoom(100);
    m_fontSettingsPage->saveSettings();
}

} // namespace Internal
} // namespace TextEditor

con's avatar
con committed
104
105
106

TextEditorSettings *TextEditorSettings::m_instance = 0;

107
TextEditorSettings::TextEditorSettings(QObject *parent)
con's avatar
con committed
108
    : QObject(parent)
109
    , m_d(new Internal::TextEditorSettingsPrivate)
con's avatar
con committed
110
{
hjk's avatar
hjk committed
111
    QTC_ASSERT(!m_instance, return);
con's avatar
con committed
112
113
114
115
116
117
118
119
    m_instance = this;

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();

    // Note: default background colors are coming from FormatDescription::background()

    // Add font preference page
    FormatDescriptions formatDescriptions;
120
    formatDescriptions.append(FormatDescription(QLatin1String(C_TEXT), tr("Text")));
con's avatar
con committed
121
122
123

    // Special categories
    const QPalette p = QApplication::palette();
124
125
126
127
128
129
130
    formatDescriptions.append(FormatDescription(QLatin1String(C_LINK), tr("Link"), Qt::blue));
    formatDescriptions.append(FormatDescription(QLatin1String(C_SELECTION), tr("Selection"), p.color(QPalette::HighlightedText)));
    formatDescriptions.append(FormatDescription(QLatin1String(C_LINE_NUMBER), tr("Line Number")));
    formatDescriptions.append(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result")));
    formatDescriptions.append(FormatDescription(QLatin1String(C_SEARCH_SCOPE), tr("Search Scope")));
    formatDescriptions.append(FormatDescription(QLatin1String(C_PARENTHESES), tr("Parentheses")));
    formatDescriptions.append(FormatDescription(QLatin1String(C_CURRENT_LINE), tr("Current Line")));
131
132
133

    FormatDescription currentLineNumber = FormatDescription(QLatin1String(C_CURRENT_LINE_NUMBER), tr("Current Line Number"), Qt::darkGray);
    currentLineNumber.format().setBold(true);
134
    formatDescriptions.append(currentLineNumber);
con's avatar
con committed
135

136
    formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES), tr("Occurrences")));
Roberto Raggi's avatar
Roberto Raggi committed
137
    formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_UNUSED), tr("Unused Occurrence")));
138
139
    formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_RENAME), tr("Renaming Occurrence")));

con's avatar
con committed
140
    // Standard categories
141
142
143
    formatDescriptions.append(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue));
    formatDescriptions.append(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen));
    formatDescriptions.append(FormatDescription(QLatin1String(C_TYPE), tr("Type"), Qt::darkMagenta));
144
    formatDescriptions.append(FormatDescription(QLatin1String(C_LOCAL), tr("Local")));
145
    formatDescriptions.append(FormatDescription(QLatin1String(C_FIELD), tr("Field"), Qt::darkRed));
146
    formatDescriptions.append(FormatDescription(QLatin1String(C_STATIC), tr("Static"), Qt::darkMagenta));
147
148
149
150
151

    FormatDescription virtualMethodFormatDescriptor(QLatin1String(C_VIRTUAL_METHOD), tr("Virtual Method"));
    virtualMethodFormatDescriptor.format().setItalic(true);
    formatDescriptions.append(virtualMethodFormatDescriptor);

152
153
    formatDescriptions.append(FormatDescription(QLatin1String(C_BINDING), tr("QML Binding"), Qt::darkRed));

154
155
156
157
158
159
160
161
162
163
164
165
166
167
    Format qmlLocalNameFormat;
    qmlLocalNameFormat.setItalic(true);
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_LOCAL_ID), tr("QML Local Id"), qmlLocalNameFormat));
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_ROOT_OBJECT_PROPERTY), tr("QML Root Object Property"), qmlLocalNameFormat));
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_SCOPE_OBJECT_PROPERTY), tr("QML Scope Object Property"), qmlLocalNameFormat));
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_STATE_NAME), tr("QML State Name"), qmlLocalNameFormat));

    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_TYPE_ID), tr("QML Type Name"), Qt::darkMagenta));

    Format qmlExternalNameFormat = qmlLocalNameFormat;
    qmlExternalNameFormat.setForeground(Qt::darkBlue);
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_EXTERNAL_ID), tr("QML External Id"), qmlExternalNameFormat));
    formatDescriptions.append(FormatDescription(QLatin1String(C_QML_EXTERNAL_OBJECT_PROPERTY), tr("QML External Object Property"), qmlExternalNameFormat));

168
169
170
171
172
173
174
175
176
    Format jsLocalFormat;
    jsLocalFormat.setForeground(QColor(41, 133, 199)); // very light blue
    jsLocalFormat.setItalic(true);
    formatDescriptions.append(FormatDescription(QLatin1String(C_JS_SCOPE_VAR), tr("JavaScript Scope Var"), jsLocalFormat));

    Format jsGlobalFormat;
    jsGlobalFormat.setForeground(QColor(0, 85, 175)); // light blue
    jsGlobalFormat.setItalic(true);
    formatDescriptions.append(FormatDescription(QLatin1String(C_JS_IMPORT_VAR), tr("JavaScript Import"), jsGlobalFormat));
Friedemann Kleint's avatar
Friedemann Kleint committed
177
    formatDescriptions.append(FormatDescription(QLatin1String(C_JS_GLOBAL_VAR), tr("JavaScript Global Variable"), jsGlobalFormat));
178

179
180
181
182
183
184
185
    formatDescriptions.append(FormatDescription(QLatin1String(C_KEYWORD), tr("Keyword"), Qt::darkYellow));
    formatDescriptions.append(FormatDescription(QLatin1String(C_OPERATOR), tr("Operator")));
    formatDescriptions.append(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue));
    formatDescriptions.append(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed));
    formatDescriptions.append(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen));
    formatDescriptions.append(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue));
    formatDescriptions.append(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue));
mae's avatar
mae committed
186
    formatDescriptions.append(FormatDescription(QLatin1String(C_VISUAL_WHITESPACE), tr("Visual Whitespace"), Qt::lightGray));
187
    formatDescriptions.append(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code")));
con's avatar
con committed
188
189

    // Diff categories
190
191
192
193
    formatDescriptions.append(FormatDescription(QLatin1String(C_ADDED_LINE), tr("Added Line"), QColor(0, 170, 0)));
    formatDescriptions.append(FormatDescription(QLatin1String(C_REMOVED_LINE), tr("Removed Line"), Qt::red));
    formatDescriptions.append(FormatDescription(QLatin1String(C_DIFF_FILE), tr("Diff File"), Qt::darkBlue));
    formatDescriptions.append(FormatDescription(QLatin1String(C_DIFF_LOCATION), tr("Diff Location"), Qt::blue));
con's avatar
con committed
194

195
    m_d->m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
196
                                                   QLatin1String(Constants::TEXT_EDITOR_FONT_SETTINGS),
197
198
                                                   this);
    pm->addObject(m_d->m_fontSettingsPage);
con's avatar
con committed
199

200
201
    // Add the GUI used to configure the tab, storage and interaction settings
    TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters;
202
    behaviorSettingsPageParameters.id = QLatin1String(Constants::TEXT_EDITOR_BEHAVIOR_SETTINGS);
203
    behaviorSettingsPageParameters.displayName = tr("Behavior");
204
    behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text");
205
206
    m_d->m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this);
    pm->addObject(m_d->m_behaviorSettingsPage);
207
208

    TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters;
209
    displaySettingsPageParameters.id = QLatin1String(Constants::TEXT_EDITOR_DISPLAY_SETTINGS),
210
    displaySettingsPageParameters.displayName = tr("Display");
211
    displaySettingsPageParameters.settingsPrefix = QLatin1String("text");
212
213
    m_d->m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this);
    pm->addObject(m_d->m_displaySettingsPage);
con's avatar
con committed
214

215
    m_d->m_highlighterSettingsPage =
216
        new HighlighterSettingsPage(QLatin1String(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS), this);
217
218
    pm->addObject(m_d->m_highlighterSettingsPage);

219
220
221
222
    m_d->m_snippetsSettingsPage =
        new SnippetsSettingsPage(QLatin1String(Constants::TEXT_EDITOR_SNIPPETS_SETTINGS), this);
    pm->addObject(m_d->m_snippetsSettingsPage);

223
    connect(m_d->m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)),
con's avatar
con committed
224
            this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)));
Jarek Kobus's avatar
Jarek Kobus committed
225
226
    connect(m_d->m_behaviorSettingsPage, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
            this, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)));
227
    connect(m_d->m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
con's avatar
con committed
228
            this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)));
229
    connect(m_d->m_behaviorSettingsPage, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
230
            this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)));
231
    connect(m_d->m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
con's avatar
con committed
232
            this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
233
234
235
236

    // TODO: Move these settings to TextEditor category
    if (QSettings *s = Core::ICore::instance()->settings())
        m_d->m_completionSettings.fromSettings(QLatin1String("CppTools/"), s);
con's avatar
con committed
237
238
239
240
241
}

TextEditorSettings::~TextEditorSettings()
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
242
243
244
    pm->removeObject(m_d->m_fontSettingsPage);
    pm->removeObject(m_d->m_behaviorSettingsPage);
    pm->removeObject(m_d->m_displaySettingsPage);
245
    pm->removeObject(m_d->m_highlighterSettingsPage);
246
    pm->removeObject(m_d->m_snippetsSettingsPage);
247
248

    delete m_d;
con's avatar
con committed
249
250
251
252
253
254
255
256
257

    m_instance = 0;
}

TextEditorSettings *TextEditorSettings::instance()
{
    return m_instance;
}

258
259
260
261
/**
 * Initializes editor settings. Also connects signals to keep them up to date
 * when they are changed.
 */
262
void TextEditorSettings::initializeEditor(BaseTextEditorWidget *editor)
263
264
265
{
    // Connect to settings change signals
    connect(this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
Roberto Raggi's avatar
Roberto Raggi committed
266
            editor, SLOT(setFontSettingsIfVisible(TextEditor::FontSettings)));
Jarek Kobus's avatar
Jarek Kobus committed
267
268
    connect(this, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
            editor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
269
270
    connect(this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
            editor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
271
272
    connect(this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
            editor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
273
274
    connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
            editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
275
276
    connect(this, SIGNAL(completionSettingsChanged(TextEditor::CompletionSettings)),
            editor, SLOT(setCompletionSettings(TextEditor::CompletionSettings)));
277
278
    connect(this, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
            editor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
279

mae's avatar
mae committed
280
281
282
283
    connect(editor, SIGNAL(requestFontZoom(int)),
            this, SLOT(fontZoomRequested(int)));
    connect(editor, SIGNAL(requestZoomReset()),
            this, SLOT(zoomResetRequested()));
mae's avatar
mae committed
284

285
286
    // Apply current settings (tab settings depend on font settings)
    editor->setFontSettings(fontSettings());
Jarek Kobus's avatar
Jarek Kobus committed
287
288
    editor->setTabSettings(codeStyle()->tabSettings());
    editor->setTypingSettings(typingSettings());
289
    editor->setStorageSettings(storageSettings());
290
    editor->setBehaviorSettings(behaviorSettings());
291
    editor->setDisplaySettings(displaySettings());
292
    editor->setCompletionSettings(completionSettings());
293
    editor->setExtraEncodingSettings(extraEncodingSettings());
Jarek Kobus's avatar
Jarek Kobus committed
294
    editor->setCodeStyle(codeStyle(editor->languageSettingsId()));
295
296
}

297
const FontSettings &TextEditorSettings::fontSettings() const
mae's avatar
mae committed
298
{
299
    return m_d->m_fontSettingsPage->fontSettings();
mae's avatar
mae committed
300
301
}

Jarek Kobus's avatar
Jarek Kobus committed
302
303
304
305
306
const TypingSettings &TextEditorSettings::typingSettings() const
{
    return m_d->m_behaviorSettingsPage->typingSettings();
}

307
const StorageSettings &TextEditorSettings::storageSettings() const
con's avatar
con committed
308
{
309
    return m_d->m_behaviorSettingsPage->storageSettings();
con's avatar
con committed
310
311
}

312
const BehaviorSettings &TextEditorSettings::behaviorSettings() const
con's avatar
con committed
313
{
314
    return m_d->m_behaviorSettingsPage->behaviorSettings();
con's avatar
con committed
315
316
}

317
const DisplaySettings &TextEditorSettings::displaySettings() const
con's avatar
con committed
318
{
319
    return m_d->m_displaySettingsPage->displaySettings();
con's avatar
con committed
320
321
}

322
const CompletionSettings &TextEditorSettings::completionSettings() const
323
{
324
    return m_d->m_completionSettings;
325
326
}

327
328
329
330
331
const HighlighterSettings &TextEditorSettings::highlighterSettings() const
{
    return m_d->m_highlighterSettingsPage->highlighterSettings();
}

332
333
334
335
336
const ExtraEncodingSettings &TextEditorSettings::extraEncodingSettings() const
{
    return m_d->m_behaviorSettingsPage->extraEncodingSettings();
}

337
void TextEditorSettings::setCompletionSettings(const TextEditor::CompletionSettings &settings)
con's avatar
con committed
338
{
339
340
341
342
343
344
345
346
    if (m_d->m_completionSettings == settings)
        return;

    m_d->m_completionSettings = settings;
    if (QSettings *s = Core::ICore::instance()->settings())
        m_d->m_completionSettings.toSettings(QLatin1String("CppTools/"), s);

    emit completionSettingsChanged(m_d->m_completionSettings);
con's avatar
con committed
347
}
348

Jarek Kobus's avatar
Jarek Kobus committed
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
void TextEditorSettings::registerCodeStyleFactory(ICodeStylePreferencesFactory *factory)
{
    m_d->m_languageToFactory.insert(factory->languageId(), factory);
}

QMap<QString, ICodeStylePreferencesFactory *> TextEditorSettings::codeStyleFactories() const
{
    return m_d->m_languageToFactory;
}

ICodeStylePreferencesFactory *TextEditorSettings::codeStyleFactory(const QString &languageId) const
{
    return m_d->m_languageToFactory.value(languageId);
}

ICodeStylePreferences *TextEditorSettings::codeStyle() const
365
{
Jarek Kobus's avatar
Jarek Kobus committed
366
    return m_d->m_behaviorSettingsPage->codeStyle();
367
368
}

Jarek Kobus's avatar
Jarek Kobus committed
369
ICodeStylePreferences *TextEditorSettings::codeStyle(const QString &languageId) const
370
{
Jarek Kobus's avatar
Jarek Kobus committed
371
    return m_d->m_languageToCodeStyle.value(languageId);
372
373
}

Jarek Kobus's avatar
Jarek Kobus committed
374
QMap<QString, ICodeStylePreferences *> TextEditorSettings::codeStyles() const
375
{
Jarek Kobus's avatar
Jarek Kobus committed
376
    return m_d->m_languageToCodeStyle;
377
378
}

Jarek Kobus's avatar
Jarek Kobus committed
379
void TextEditorSettings::registerCodeStyle(const QString &languageId, ICodeStylePreferences *prefs)
380
{
Jarek Kobus's avatar
Jarek Kobus committed
381
    m_d->m_languageToCodeStyle.insert(languageId, prefs);
382
383
}

Jarek Kobus's avatar
Jarek Kobus committed
384
CodeStylePool *TextEditorSettings::codeStylePool() const
385
{
Jarek Kobus's avatar
Jarek Kobus committed
386
    return m_d->m_behaviorSettingsPage->codeStylePool();
387
388
}

Jarek Kobus's avatar
Jarek Kobus committed
389
CodeStylePool *TextEditorSettings::codeStylePool(const QString &languageId) const
390
{
Jarek Kobus's avatar
Jarek Kobus committed
391
    return m_d->m_languageToCodeStylePool.value(languageId);
392
393
}

Jarek Kobus's avatar
Jarek Kobus committed
394
void TextEditorSettings::registerCodeStylePool(const QString &languageId, CodeStylePool *pool)
395
{
Jarek Kobus's avatar
Jarek Kobus committed
396
    m_d->m_languageToCodeStylePool.insert(languageId, pool);
397
398
}

399
400
401
402
403
404
405
406
407
408
void TextEditorSettings::registerMimeTypeForLanguageId(const QString &mimeType, const QString &languageId)
{
    m_d->m_mimeTypeToLanguage.insert(mimeType, languageId);
}

QString TextEditorSettings::languageId(const QString &mimeType) const
{
    return m_d->m_mimeTypeToLanguage.value(mimeType);
}

409
#include "moc_texteditorsettings.cpp"