forked from qt-creator/qt-creator
TextEditor: Simplify configuring generic highlighter
* configureMimeType -> configureGenericHighlighter, since that is what it actually does. * setupAsPlainEditor -> setupGenericHighlighter, since that is what it actually does * avoid multiple highlighting definition lookups * unify code paths by not separately creating generic highlighters through the factories Change-Id: I9579ca5736bbf08c01b8e41b63c6b9f36bdc725e Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -53,7 +53,8 @@ QString TextEditor::findDefinitionId(const Core::MimeType &mimeType,
|
||||
return definitionId;
|
||||
}
|
||||
|
||||
void TextEditor::setMimeTypeForHighlighter(Highlighter *highlighter, const Core::MimeType &mimeType)
|
||||
void TextEditor::setMimeTypeForHighlighter(Highlighter *highlighter, const Core::MimeType &mimeType,
|
||||
QString *foundDefinitionId)
|
||||
{
|
||||
const QString type = mimeType.type();
|
||||
QString definitionId = Manager::instance()->definitionIdByMimeType(type);
|
||||
@@ -66,6 +67,9 @@ void TextEditor::setMimeTypeForHighlighter(Highlighter *highlighter, const Core:
|
||||
if (!definition.isNull() && definition->isValid())
|
||||
highlighter->setDefaultContext(definition->initialContext());
|
||||
}
|
||||
|
||||
if (foundDefinitionId)
|
||||
*foundDefinitionId = definitionId;
|
||||
}
|
||||
|
||||
SyntaxHighlighter *TextEditor::createGenericSyntaxHighlighter(const Core::MimeType &mimeType)
|
||||
|
||||
Reference in New Issue
Block a user