forked from qt-creator/qt-creator
texteditor: use an enum instead of QString as color ids
Change-Id: I658412c18d5ccfe978ec444451c6417ffb18d71c Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -1015,13 +1015,13 @@ void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
highlighter->setFormats(fs.toTextCharFormats(highlighterFormatCategories()));
|
||||
highlighter->rehighlight();
|
||||
|
||||
m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
|
||||
m_occurrencesUnusedFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_UNUSED));
|
||||
m_occurrencesFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES);
|
||||
m_occurrencesUnusedFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_UNUSED);
|
||||
m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
|
||||
m_occurrencesUnusedFormat.setUnderlineColor(m_occurrencesUnusedFormat.foreground().color());
|
||||
m_occurrencesUnusedFormat.clearForeground();
|
||||
m_occurrencesUnusedFormat.setToolTip(tr("Unused variable"));
|
||||
m_occurrenceRenameFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_RENAME));
|
||||
m_occurrenceRenameFormat = fs.toTextCharFormat(TextEditor::C_OCCURRENCES_RENAME);
|
||||
|
||||
// only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link
|
||||
m_occurrencesFormat.clearForeground();
|
||||
@@ -1429,7 +1429,7 @@ bool QmlJSTextEditorWidget::hideContextPane()
|
||||
return b;
|
||||
}
|
||||
|
||||
QVector<QString> QmlJSTextEditorWidget::highlighterFormatCategories()
|
||||
QVector<TextEditor::TextStyle> QmlJSTextEditorWidget::highlighterFormatCategories()
|
||||
{
|
||||
/*
|
||||
NumberFormat,
|
||||
@@ -1440,15 +1440,15 @@ QVector<QString> QmlJSTextEditorWidget::highlighterFormatCategories()
|
||||
CommentFormat,
|
||||
VisualWhitespace,
|
||||
*/
|
||||
static QVector<QString> categories;
|
||||
static QVector<TextEditor::TextStyle> categories;
|
||||
if (categories.isEmpty()) {
|
||||
categories << QLatin1String(TextEditor::Constants::C_NUMBER)
|
||||
<< QLatin1String(TextEditor::Constants::C_STRING)
|
||||
<< QLatin1String(TextEditor::Constants::C_TYPE)
|
||||
<< QLatin1String(TextEditor::Constants::C_KEYWORD)
|
||||
<< QLatin1String(TextEditor::Constants::C_FIELD)
|
||||
<< QLatin1String(TextEditor::Constants::C_COMMENT)
|
||||
<< QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
|
||||
categories << TextEditor::C_NUMBER
|
||||
<< TextEditor::C_STRING
|
||||
<< TextEditor::C_TYPE
|
||||
<< TextEditor::C_KEYWORD
|
||||
<< TextEditor::C_FIELD
|
||||
<< TextEditor::C_COMMENT
|
||||
<< TextEditor::C_VISUAL_WHITESPACE;
|
||||
}
|
||||
return categories;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <qmljstools/qmljssemanticinfo.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/quickfix.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QModelIndex>
|
||||
@@ -108,7 +109,7 @@ public:
|
||||
Internal::QmlOutlineModel *outlineModel() const;
|
||||
QModelIndex outlineModelIndex();
|
||||
|
||||
static QVector<QString> highlighterFormatCategories();
|
||||
static QVector<TextEditor::TextStyle> highlighterFormatCategories();
|
||||
|
||||
TextEditor::IAssistInterface *createAssistInterface(TextEditor::AssistKind assistKind,
|
||||
TextEditor::AssistReason reason) const;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <texteditor/basetextdocumentlayout.h>
|
||||
#include <texteditor/syntaxhighlighter.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
namespace QmlJSEditor {
|
||||
|
||||
|
||||
@@ -468,18 +468,18 @@ void SemanticHighlighter::finished()
|
||||
|
||||
void SemanticHighlighter::updateFontSettings(const TextEditor::FontSettings &fontSettings)
|
||||
{
|
||||
m_formats[LocalIdType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_LOCAL_ID));
|
||||
m_formats[ExternalIdType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_EXTERNAL_ID));
|
||||
m_formats[QmlTypeType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_TYPE_ID));
|
||||
m_formats[RootObjectPropertyType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_ROOT_OBJECT_PROPERTY));
|
||||
m_formats[ScopeObjectPropertyType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_SCOPE_OBJECT_PROPERTY));
|
||||
m_formats[ExternalObjectPropertyType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_EXTERNAL_OBJECT_PROPERTY));
|
||||
m_formats[JsScopeType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_JS_SCOPE_VAR));
|
||||
m_formats[JsImportType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_JS_IMPORT_VAR));
|
||||
m_formats[JsGlobalType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_JS_GLOBAL_VAR));
|
||||
m_formats[LocalStateNameType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_QML_STATE_NAME));
|
||||
m_formats[BindingNameType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_BINDING));
|
||||
m_formats[FieldType] = fontSettings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_FIELD));
|
||||
m_formats[LocalIdType] = fontSettings.toTextCharFormat(TextEditor::C_QML_LOCAL_ID);
|
||||
m_formats[ExternalIdType] = fontSettings.toTextCharFormat(TextEditor::C_QML_EXTERNAL_ID);
|
||||
m_formats[QmlTypeType] = fontSettings.toTextCharFormat(TextEditor::C_QML_TYPE_ID);
|
||||
m_formats[RootObjectPropertyType] = fontSettings.toTextCharFormat(TextEditor::C_QML_ROOT_OBJECT_PROPERTY);
|
||||
m_formats[ScopeObjectPropertyType] = fontSettings.toTextCharFormat(TextEditor::C_QML_SCOPE_OBJECT_PROPERTY);
|
||||
m_formats[ExternalObjectPropertyType] = fontSettings.toTextCharFormat(TextEditor::C_QML_EXTERNAL_OBJECT_PROPERTY);
|
||||
m_formats[JsScopeType] = fontSettings.toTextCharFormat(TextEditor::C_JS_SCOPE_VAR);
|
||||
m_formats[JsImportType] = fontSettings.toTextCharFormat(TextEditor::C_JS_IMPORT_VAR);
|
||||
m_formats[JsGlobalType] = fontSettings.toTextCharFormat(TextEditor::C_JS_GLOBAL_VAR);
|
||||
m_formats[LocalStateNameType] = fontSettings.toTextCharFormat(TextEditor::C_QML_STATE_NAME);
|
||||
m_formats[BindingNameType] = fontSettings.toTextCharFormat(TextEditor::C_BINDING);
|
||||
m_formats[FieldType] = fontSettings.toTextCharFormat(TextEditor::C_FIELD);
|
||||
}
|
||||
|
||||
int SemanticHighlighter::startRevision() const
|
||||
|
||||
Reference in New Issue
Block a user