Utils: move code model icons to utils

In preperation for the language server protocol support.

Change-Id: Iee4ccd53a86d9afdb357972ea62b75ace2edcb1d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
David Schulz
2018-07-25 10:00:38 +02:00
parent 5d67a471e0
commit 141f19a652
63 changed files with 423 additions and 423 deletions

View File

@@ -362,11 +362,11 @@ QIcon ClangAssistProposalItem::icon() const
case CodeCompletion::ClassCompletionKind:
case CodeCompletion::TemplateClassCompletionKind:
case CodeCompletion::TypeAliasCompletionKind:
return Icons::iconForType(Icons::ClassIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Class);
case CodeCompletion::EnumerationCompletionKind:
return Icons::iconForType(Icons::EnumIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Enum);
case CodeCompletion::EnumeratorCompletionKind:
return Icons::iconForType(Icons::EnumeratorIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Enumerator);
case CodeCompletion::ConstructorCompletionKind:
case CodeCompletion::DestructorCompletionKind:
case CodeCompletion::FunctionCompletionKind:
@@ -376,40 +376,40 @@ QIcon ClangAssistProposalItem::icon() const
switch (completion.availability) {
case CodeCompletion::Available:
case CodeCompletion::Deprecated:
return Icons::iconForType(Icons::FuncPublicIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::FuncPublic);
default:
return Icons::iconForType(Icons::FuncPrivateIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::FuncPrivate);
}
case CodeCompletion::SignalCompletionKind:
return Icons::iconForType(Icons::SignalIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Signal);
case CodeCompletion::SlotCompletionKind:
switch (completion.availability) {
case CodeCompletion::Available:
case CodeCompletion::Deprecated:
return Icons::iconForType(Icons::SlotPublicIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::SlotPublic);
case CodeCompletion::NotAccessible:
case CodeCompletion::NotAvailable:
return Icons::iconForType(Icons::SlotPrivateIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::SlotPrivate);
}
break;
case CodeCompletion::NamespaceCompletionKind:
return Icons::iconForType(Icons::NamespaceIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Namespace);
case CodeCompletion::PreProcessorCompletionKind:
return Icons::iconForType(Icons::MacroIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro);
case CodeCompletion::VariableCompletionKind:
switch (completion.availability) {
case CodeCompletion::Available:
case CodeCompletion::Deprecated:
return Icons::iconForType(Icons::VarPublicIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::VarPublic);
default:
return Icons::iconForType(Icons::VarPrivateIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::VarPrivate);
}
case CodeCompletion::KeywordCompletionKind:
return Icons::iconForType(Icons::KeywordIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Keyword);
case CodeCompletion::ClangSnippetKind:
return snippetIcon;
case CodeCompletion::Other:
return Icons::iconForType(Icons::UnknownIconType);
return ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Unknown);
default:
break;
}

View File

@@ -496,11 +496,11 @@ bool ClangCompletionAssistProcessor::completePreprocessorDirectives()
{
foreach (const QString &preprocessorCompletion, m_preprocessorCompletions)
addCompletionItem(preprocessorCompletion,
Icons::iconForType(Icons::MacroIconType));
::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro));
if (m_interface->objcEnabled())
addCompletionItem(QLatin1String("import"),
Icons::iconForType(Icons::MacroIconType));
::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Macro));
return !m_completions.isEmpty();
}

View File

@@ -97,7 +97,7 @@ static Core::LocatorFilterEntry makeEntry(Core::ILocatorFilter *filter,
}
entry.displayName = displayName;
entry.extraInfo = extra;
entry.displayIcon = CPlusPlus::Icons::iconForType(Utils::iconTypeForToken(info));
entry.displayIcon = ::Utils::CodeModelIcon::iconForType(Utils::iconTypeForToken(info));
return entry;
}

View File

@@ -171,7 +171,7 @@ QVariant TokenTreeItem::data(int column, int role) const
}
case Qt::DecorationRole: {
return CPlusPlus::Icons::iconForType(ClangCodeModel::Utils::iconTypeForToken(token));
return ::Utils::CodeModelIcon::iconForType(ClangCodeModel::Utils::iconTypeForToken(token));
}
case CppTools::AbstractOverviewModel::FileNameRole: {

View File

@@ -205,52 +205,52 @@ int clangColumn(const QTextBlock &line, int cppEditorColumn)
return line.text().left(cppEditorColumn).toUtf8().size() + 1;
}
CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token)
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token)
{
const ClangBackEnd::ExtraInfo &extraInfo = token.extraInfo;
if (extraInfo.signal)
return CPlusPlus::Icons::SignalIconType;
return ::Utils::CodeModelIcon::Signal;
ClangBackEnd::AccessSpecifier access = extraInfo.accessSpecifier;
if (extraInfo.slot) {
switch (access) {
case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::SlotPublicIconType;
return ::Utils::CodeModelIcon::SlotPublic;
case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::SlotProtectedIconType;
return ::Utils::CodeModelIcon::SlotProtected;
case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::SlotPrivateIconType;
return ::Utils::CodeModelIcon::SlotPrivate;
}
}
ClangBackEnd::HighlightingType mainType = token.types.mainHighlightingType;
if (mainType == ClangBackEnd::HighlightingType::QtProperty)
return CPlusPlus::Icons::PropertyIconType;
return ::Utils::CodeModelIcon::Property;
if (mainType == ClangBackEnd::HighlightingType::PreprocessorExpansion
|| mainType == ClangBackEnd::HighlightingType::PreprocessorDefinition) {
return CPlusPlus::Icons::MacroIconType;
return ::Utils::CodeModelIcon::Macro;
}
if (mainType == ClangBackEnd::HighlightingType::Enumeration)
return CPlusPlus::Icons::EnumeratorIconType;
return ::Utils::CodeModelIcon::Enumerator;
if (mainType == ClangBackEnd::HighlightingType::Type
|| mainType == ClangBackEnd::HighlightingType::Keyword) {
const ClangBackEnd::MixinHighlightingTypes &types = token.types.mixinHighlightingTypes;
if (types.contains(ClangBackEnd::HighlightingType::Enum))
return CPlusPlus::Icons::EnumIconType;
return ::Utils::CodeModelIcon::Enum;
if (types.contains(ClangBackEnd::HighlightingType::Struct))
return CPlusPlus::Icons::StructIconType;
return ::Utils::CodeModelIcon::Struct;
if (types.contains(ClangBackEnd::HighlightingType::Namespace))
return CPlusPlus::Icons::NamespaceIconType;
return ::Utils::CodeModelIcon::Namespace;
if (types.contains(ClangBackEnd::HighlightingType::Class))
return CPlusPlus::Icons::ClassIconType;
return ::Utils::CodeModelIcon::Class;
if (mainType == ClangBackEnd::HighlightingType::Keyword)
return CPlusPlus::Icons::KeywordIconType;
return CPlusPlus::Icons::ClassIconType;
return ::Utils::CodeModelIcon::Keyword;
return ::Utils::CodeModelIcon::Class;
}
ClangBackEnd::StorageClass storageClass = extraInfo.storageClass;
@@ -261,21 +261,21 @@ CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContain
switch (access) {
case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::FuncPublicIconType;
return ::Utils::CodeModelIcon::FuncPublic;
case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::FuncProtectedIconType;
return ::Utils::CodeModelIcon::FuncProtected;
case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::FuncPrivateIconType;
return ::Utils::CodeModelIcon::FuncPrivate;
}
} else {
switch (access) {
case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::FuncPublicStaticIconType;
return ::Utils::CodeModelIcon::FuncPublicStatic;
case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::FuncProtectedStaticIconType;
return ::Utils::CodeModelIcon::FuncProtectedStatic;
case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::FuncPrivateStaticIconType;
return ::Utils::CodeModelIcon::FuncPrivateStatic;
}
}
}
@@ -285,26 +285,26 @@ CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContain
switch (access) {
case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::VarPublicIconType;
return ::Utils::CodeModelIcon::VarPublic;
case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::VarProtectedIconType;
return ::Utils::CodeModelIcon::VarProtected;
case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::VarPrivateIconType;
return ::Utils::CodeModelIcon::VarPrivate;
}
} else {
switch (access) {
case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::VarPublicStaticIconType;
return ::Utils::CodeModelIcon::VarPublicStatic;
case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::VarProtectedStaticIconType;
return ::Utils::CodeModelIcon::VarProtectedStatic;
case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::VarPrivateStaticIconType;
return ::Utils::CodeModelIcon::VarPrivateStatic;
}
}
}
return CPlusPlus::Icons::UnknownIconType;
return ::Utils::CodeModelIcon::Unknown;
}
QString diagnosticCategoryPrefixRemoved(const QString &text)

View File

@@ -58,7 +58,7 @@ int clangColumn(const QTextBlock &lineText, int cppEditorColumn);
QString diagnosticCategoryPrefixRemoved(const QString &text);
CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token);
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token);
} // namespace Utils
} // namespace Clang