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

@@ -30,8 +30,6 @@
#include <cplusplus/Symbols.h> #include <cplusplus/Symbols.h>
#include <cplusplus/Type.h> #include <cplusplus/Type.h>
#include <utils/icon.h>
using namespace CPlusPlus; using namespace CPlusPlus;
using CPlusPlus::Icons; using CPlusPlus::Icons;
@@ -42,16 +40,17 @@ QIcon Icons::iconForSymbol(const Symbol *symbol)
QIcon Icons::keywordIcon() QIcon Icons::keywordIcon()
{ {
return iconForType(KeywordIconType); return iconForType(Utils::CodeModelIcon::Keyword);
} }
QIcon Icons::macroIcon() QIcon Icons::macroIcon()
{ {
return iconForType(MacroIconType); return iconForType(Utils::CodeModelIcon::Macro);
} }
Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol) Utils::CodeModelIcon::Type Icons::iconTypeForSymbol(const Symbol *symbol)
{ {
using namespace Utils::CodeModelIcon;
if (const Template *templ = symbol->asTemplate()) { if (const Template *templ = symbol->asTemplate()) {
if (Symbol *decl = templ->declaration()) if (Symbol *decl = templ->declaration())
return iconTypeForSymbol(decl); return iconTypeForSymbol(decl);
@@ -67,244 +66,53 @@ Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol)
if (function->isSlot()) { if (function->isSlot()) {
if (function->isPublic()) if (function->isPublic())
return SlotPublicIconType; return SlotPublic;
else if (function->isProtected()) else if (function->isProtected())
return SlotProtectedIconType; return SlotProtected;
else if (function->isPrivate()) else if (function->isPrivate())
return SlotPrivateIconType; return SlotPrivate;
} else if (function->isSignal()) { } else if (function->isSignal()) {
return SignalIconType; return Signal;
} else if (symbol->isPublic()) { } else if (symbol->isPublic()) {
return symbol->isStatic() ? FuncPublicStaticIconType : FuncPublicIconType; return symbol->isStatic() ? FuncPublicStatic : FuncPublic;
} else if (symbol->isProtected()) { } else if (symbol->isProtected()) {
return symbol->isStatic() ? FuncProtectedStaticIconType : FuncProtectedIconType; return symbol->isStatic() ? FuncProtectedStatic : FuncProtected;
} else if (symbol->isPrivate()) { } else if (symbol->isPrivate()) {
return symbol->isStatic() ? FuncPrivateStaticIconType : FuncPrivateIconType; return symbol->isStatic() ? FuncPrivateStatic : FuncPrivate;
} }
} else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) { } else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) {
return EnumeratorIconType; return Enumerator;
} else if (symbol->isDeclaration() || symbol->isArgument()) { } else if (symbol->isDeclaration() || symbol->isArgument()) {
if (symbol->isPublic()) { if (symbol->isPublic()) {
return symbol->isStatic() ? VarPublicStaticIconType : VarPublicIconType; return symbol->isStatic() ? VarPublicStatic : VarPublic;
} else if (symbol->isProtected()) { } else if (symbol->isProtected()) {
return symbol->isStatic() ? VarProtectedStaticIconType : VarProtectedIconType; return symbol->isStatic() ? VarProtectedStatic : VarProtected;
} else if (symbol->isPrivate()) { } else if (symbol->isPrivate()) {
return symbol->isStatic() ? VarPrivateStaticIconType : VarPrivateIconType; return symbol->isStatic() ? VarPrivateStatic : VarPrivate;
} }
} else if (symbol->isEnum()) { } else if (symbol->isEnum()) {
return EnumIconType; return Utils::CodeModelIcon::Enum;
} else if (symbol->isForwardClassDeclaration()) { } else if (symbol->isForwardClassDeclaration()) {
return ClassIconType; // TODO: Store class key in ForwardClassDeclaration return Utils::CodeModelIcon::Class; // TODO: Store class key in ForwardClassDeclaration
} else if (const Class *klass = symbol->asClass()) { } else if (const Class *klass = symbol->asClass()) {
return klass->isStruct() ? StructIconType : ClassIconType; return klass->isStruct() ? Struct : Utils::CodeModelIcon::Class;
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) { } else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
return ClassIconType; return Utils::CodeModelIcon::Class;
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) { } else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
return ClassIconType; return Utils::CodeModelIcon::Class;
} else if (symbol->isObjCMethod()) { } else if (symbol->isObjCMethod()) {
return FuncPublicIconType; return FuncPublic;
} else if (symbol->isNamespace()) { } else if (symbol->isNamespace()) {
return NamespaceIconType; return Utils::CodeModelIcon::Namespace;
} else if (symbol->isTypenameArgument()) { } else if (symbol->isTypenameArgument()) {
return ClassIconType; return Utils::CodeModelIcon::Class;
} else if (symbol->isQtPropertyDeclaration() || symbol->isObjCPropertyDeclaration()) { } else if (symbol->isQtPropertyDeclaration() || symbol->isObjCPropertyDeclaration()) {
return PropertyIconType; return Property;
} else if (symbol->isUsingNamespaceDirective() || } else if (symbol->isUsingNamespaceDirective() ||
symbol->isUsingDeclaration()) { symbol->isUsingDeclaration()) {
// TODO: Might be nice to have a different icons for these things // TODO: Might be nice to have a different icons for these things
return NamespaceIconType; return Utils::CodeModelIcon::Namespace;
} }
return UnknownIconType; return Unknown;
}
QIcon Icons::iconForType(IconType type)
{
using namespace Utils;
static const IconMaskAndColor classRelationIcon {
QLatin1String(":/codemodel/images/classrelation.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor classRelationBackgroundIcon {
QLatin1String(":/codemodel/images/classrelationbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor classMemberFunctionIcon {
QLatin1String(":/codemodel/images/classmemberfunction.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor classMemberVariableIcon {
QLatin1String(":/codemodel/images/classmembervariable.png"), Theme::IconsCodeModelVariableColor};
static const IconMaskAndColor functionIcon {
QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor variableIcon {
QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelVariableColor};
static const IconMaskAndColor signalIcon {
QLatin1String(":/codemodel/images/signal.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor slotIcon {
QLatin1String(":/codemodel/images/slot.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor propertyIcon {
QLatin1String(":/codemodel/images/property.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor propertyBackgroundIcon {
QLatin1String(":/codemodel/images/propertybackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor protectedIcon {
QLatin1String(":/codemodel/images/protected.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor protectedBackgroundIcon {
QLatin1String(":/codemodel/images/protectedbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor privateIcon {
QLatin1String(":/codemodel/images/private.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor privateBackgroundIcon {
QLatin1String(":/codemodel/images/privatebackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor staticIcon {
QLatin1String(":/codemodel/images/static.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor staticBackgroundIcon {
QLatin1String(":/codemodel/images/staticbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
switch (type) {
case ClassIconType: {
const static QIcon icon(Icon({
classRelationBackgroundIcon, classRelationIcon,
{QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelClassColor},
classMemberFunctionIcon, classMemberVariableIcon
}, Icon::Tint).icon());
return icon;
}
case StructIconType: {
const static QIcon icon(Icon({
classRelationBackgroundIcon, classRelationIcon,
{QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelStructColor},
classMemberFunctionIcon, classMemberVariableIcon
}, Icon::Tint).icon());
return icon;
}
case EnumIconType: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/enum.png"), Theme::IconsCodeModelEnumColor}
}, Icon::Tint).icon());
return icon;
}
case EnumeratorIconType: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/enumerator.png"), Theme::IconsCodeModelEnumColor}
}, Icon::Tint).icon());
return icon;
}
case FuncPublicIconType: {
const static QIcon icon(Icon({
functionIcon}, Icon::Tint).icon());
return icon;
}
case FuncProtectedIconType: {
const static QIcon icon(Icon({
functionIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPrivateIconType: {
const static QIcon icon(Icon({
functionIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPublicStaticIconType: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon
}, Icon::Tint).icon());
return icon;
}
case FuncProtectedStaticIconType: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPrivateStaticIconType: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case NamespaceIconType: {
const static QIcon icon(Icon({
{QLatin1String(":/utils/images/namespace.png"), Theme::IconsCodeModelKeywordColor}
}, Icon::Tint).icon());
return icon;
}
case VarPublicIconType: {
const static QIcon icon(Icon({
variableIcon
}, Icon::Tint).icon());
return icon;
}
case VarProtectedIconType: {
const static QIcon icon(Icon({
variableIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case VarPrivateIconType: {
const static QIcon icon(Icon({
variableIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case VarPublicStaticIconType: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon
}, Icon::Tint).icon());
return icon;
}
case VarProtectedStaticIconType: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case VarPrivateStaticIconType: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case SignalIconType: {
const static QIcon icon(Icon({
signalIcon
}, Icon::Tint).icon());
return icon;
}
case SlotPublicIconType: {
const static QIcon icon(Icon({
slotIcon
}, Icon::Tint).icon());
return icon;
}
case SlotProtectedIconType: {
const static QIcon icon(Icon({
slotIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case SlotPrivateIconType: {
const static QIcon icon(Icon({
slotIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case KeywordIconType: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/keyword.png"), Theme::IconsCodeModelKeywordColor}
}, Icon::Tint).icon());
return icon;
}
case MacroIconType: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/macro.png"), Theme::IconsCodeModelMacroColor}
}, Icon::Tint).icon());
return icon;
}
case PropertyIconType: {
const static QIcon icon(Icon({
variableIcon, propertyBackgroundIcon, propertyIcon
}, Icon::Tint).icon());
return icon;
}
default:
break;
}
return QIcon();
} }

View File

@@ -26,6 +26,7 @@
#pragma once #pragma once
#include <cplusplus/CPlusPlusForwardDeclarations.h> #include <cplusplus/CPlusPlusForwardDeclarations.h>
#include <utils/utilsicons.h>
#include <QIcon> #include <QIcon>
@@ -41,36 +42,7 @@ public:
static QIcon keywordIcon(); static QIcon keywordIcon();
static QIcon macroIcon(); static QIcon macroIcon();
enum IconType { static Utils::CodeModelIcon::Type iconTypeForSymbol(const Symbol *symbol);
ClassIconType = 0,
StructIconType,
EnumIconType,
EnumeratorIconType,
FuncPublicIconType,
FuncProtectedIconType,
FuncPrivateIconType,
FuncPublicStaticIconType,
FuncProtectedStaticIconType,
FuncPrivateStaticIconType,
NamespaceIconType,
VarPublicIconType,
VarProtectedIconType,
VarPrivateIconType,
VarPublicStaticIconType,
VarProtectedStaticIconType,
VarPrivateStaticIconType,
SignalIconType,
SlotPublicIconType,
SlotProtectedIconType,
SlotPrivateIconType,
KeywordIconType,
MacroIconType,
PropertyIconType,
UnknownIconType
};
static IconType iconTypeForSymbol(const Symbol *symbol);
static QIcon iconForType(IconType type);
private: private:
Icons() {} Icons() {}

View File

@@ -84,5 +84,3 @@ SOURCES += \
$$PWD/findcdbbreakpoint.cpp \ $$PWD/findcdbbreakpoint.cpp \
$$PWD/PPToken.cpp \ $$PWD/PPToken.cpp \
$$PWD/cppmodelmanagerbase.cpp $$PWD/cppmodelmanagerbase.cpp
RESOURCES += $$PWD/cplusplus.qrc

View File

@@ -122,7 +122,6 @@ Project {
"SymbolNameVisitor.cpp", "SymbolNameVisitor.h", "SymbolNameVisitor.cpp", "SymbolNameVisitor.h",
"TypeOfExpression.cpp", "TypeOfExpression.h", "TypeOfExpression.cpp", "TypeOfExpression.h",
"TypePrettyPrinter.cpp", "TypePrettyPrinter.h", "TypePrettyPrinter.cpp", "TypePrettyPrinter.h",
"cplusplus.qrc",
"findcdbbreakpoint.cpp", "findcdbbreakpoint.h", "findcdbbreakpoint.cpp", "findcdbbreakpoint.h",
"pp-cctype.h", "pp-cctype.h",
"pp-engine.cpp", "pp-engine.h", "pp-engine.cpp", "pp-engine.h",

View File

@@ -1,44 +0,0 @@
<RCC>
<qresource prefix="/codemodel">
<file>images/enum.png</file>
<file>images/enum@2x.png</file>
<file>images/enumerator.png</file>
<file>images/enumerator@2x.png</file>
<file>images/keyword.png</file>
<file>images/keyword@2x.png</file>
<file>images/macro.png</file>
<file>images/macro@2x.png</file>
<file>images/signal.png</file>
<file>images/signal@2x.png</file>
<file>images/slot.png</file>
<file>images/slot@2x.png</file>
<file>images/member.png</file>
<file>images/member@2x.png</file>
<file>images/private.png</file>
<file>images/private@2x.png</file>
<file>images/privatebackground.png</file>
<file>images/privatebackground@2x.png</file>
<file>images/property.png</file>
<file>images/property@2x.png</file>
<file>images/propertybackground.png</file>
<file>images/propertybackground@2x.png</file>
<file>images/protected.png</file>
<file>images/protected@2x.png</file>
<file>images/protectedbackground.png</file>
<file>images/protectedbackground@2x.png</file>
<file>images/static.png</file>
<file>images/static@2x.png</file>
<file>images/staticbackground.png</file>
<file>images/staticbackground@2x.png</file>
<file>images/classmemberfunction.png</file>
<file>images/classmemberfunction@2x.png</file>
<file>images/classmembervariable.png</file>
<file>images/classmembervariable@2x.png</file>
<file>images/classparent.png</file>
<file>images/classparent@2x.png</file>
<file>images/classrelation.png</file>
<file>images/classrelation@2x.png</file>
<file>images/classrelationbackground.png</file>
<file>images/classrelationbackground@2x.png</file>
</qresource>
</RCC>

View File

@@ -123,20 +123,20 @@ QIcon Icons::icon(Node *node)
QIcon Icons::objectDefinitionIcon() QIcon Icons::objectDefinitionIcon()
{ {
return CPlusPlus::Icons::iconForType(CPlusPlus::Icons::ClassIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Class);
} }
QIcon Icons::scriptBindingIcon() QIcon Icons::scriptBindingIcon()
{ {
return CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarPublicIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::VarPublic);
} }
QIcon Icons::publicMemberIcon() QIcon Icons::publicMemberIcon()
{ {
return CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPublicIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::FuncPublic);
} }
QIcon Icons::functionDeclarationIcon() QIcon Icons::functionDeclarationIcon()
{ {
return CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPublicIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::FuncPublic);
} }

View File

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

View File

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 168 B

View File

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 136 B

View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View File

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

View File

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

View File

Before

Width:  |  Height:  |  Size: 121 B

After

Width:  |  Height:  |  Size: 121 B

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 112 B

View File

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 124 B

View File

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

View File

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

View File

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 143 B

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 217 B

View File

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

View File

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B

View File

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 112 B

View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

View File

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

View File

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

View File

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View File

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 216 B

View File

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View File

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 374 B

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

View File

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 120 B

View File

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 173 B

View File

@@ -210,4 +210,46 @@
<file>images/toolbuttonexpandarrow.png</file> <file>images/toolbuttonexpandarrow.png</file>
<file>images/toolbuttonexpandarrow@2x.png</file> <file>images/toolbuttonexpandarrow@2x.png</file>
</qresource> </qresource>
<qresource prefix="/codemodel">
<file>images/enum.png</file>
<file>images/enum@2x.png</file>
<file>images/enumerator.png</file>
<file>images/enumerator@2x.png</file>
<file>images/keyword.png</file>
<file>images/keyword@2x.png</file>
<file>images/macro.png</file>
<file>images/macro@2x.png</file>
<file>images/signal.png</file>
<file>images/signal@2x.png</file>
<file>images/slot.png</file>
<file>images/slot@2x.png</file>
<file>images/member.png</file>
<file>images/member@2x.png</file>
<file>images/private.png</file>
<file>images/private@2x.png</file>
<file>images/privatebackground.png</file>
<file>images/privatebackground@2x.png</file>
<file>images/property.png</file>
<file>images/property@2x.png</file>
<file>images/propertybackground.png</file>
<file>images/propertybackground@2x.png</file>
<file>images/protected.png</file>
<file>images/protected@2x.png</file>
<file>images/protectedbackground.png</file>
<file>images/protectedbackground@2x.png</file>
<file>images/static.png</file>
<file>images/static@2x.png</file>
<file>images/staticbackground.png</file>
<file>images/staticbackground@2x.png</file>
<file>images/classmemberfunction.png</file>
<file>images/classmemberfunction@2x.png</file>
<file>images/classmembervariable.png</file>
<file>images/classmembervariable@2x.png</file>
<file>images/classparent.png</file>
<file>images/classparent@2x.png</file>
<file>images/classrelation.png</file>
<file>images/classrelation@2x.png</file>
<file>images/classrelationbackground.png</file>
<file>images/classrelationbackground@2x.png</file>
</qresource>
</RCC> </RCC>

View File

@@ -256,4 +256,194 @@ const Icon CODEMODEL_FIXIT({
{":/utils/images/lightbulb.png", Theme::IconsWarningColor}}, Icon::Tint); {":/utils/images/lightbulb.png", Theme::IconsWarningColor}}, Icon::Tint);
} // namespace Icons } // namespace Icons
QIcon CodeModelIcon::iconForType(CodeModelIcon::Type type)
{
static const IconMaskAndColor classRelationIcon {
QLatin1String(":/codemodel/images/classrelation.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor classRelationBackgroundIcon {
QLatin1String(":/codemodel/images/classrelationbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor classMemberFunctionIcon {
QLatin1String(":/codemodel/images/classmemberfunction.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor classMemberVariableIcon {
QLatin1String(":/codemodel/images/classmembervariable.png"), Theme::IconsCodeModelVariableColor};
static const IconMaskAndColor functionIcon {
QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor variableIcon {
QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelVariableColor};
static const IconMaskAndColor signalIcon {
QLatin1String(":/codemodel/images/signal.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor slotIcon {
QLatin1String(":/codemodel/images/slot.png"), Theme::IconsCodeModelFunctionColor};
static const IconMaskAndColor propertyIcon {
QLatin1String(":/codemodel/images/property.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor propertyBackgroundIcon {
QLatin1String(":/codemodel/images/propertybackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor protectedIcon {
QLatin1String(":/codemodel/images/protected.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor protectedBackgroundIcon {
QLatin1String(":/codemodel/images/protectedbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor privateIcon {
QLatin1String(":/codemodel/images/private.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor privateBackgroundIcon {
QLatin1String(":/codemodel/images/privatebackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
static const IconMaskAndColor staticIcon {
QLatin1String(":/codemodel/images/static.png"), Theme::IconsCodeModelOverlayForegroundColor};
static const IconMaskAndColor staticBackgroundIcon {
QLatin1String(":/codemodel/images/staticbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
switch (type) {
case Class: {
const static QIcon icon(Icon({
classRelationBackgroundIcon, classRelationIcon,
{QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelClassColor},
classMemberFunctionIcon, classMemberVariableIcon
}, Icon::Tint).icon());
return icon;
}
case Struct: {
const static QIcon icon(Icon({
classRelationBackgroundIcon, classRelationIcon,
{QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelStructColor},
classMemberFunctionIcon, classMemberVariableIcon
}, Icon::Tint).icon());
return icon;
}
case Enum: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/enum.png"), Theme::IconsCodeModelEnumColor}
}, Icon::Tint).icon());
return icon;
}
case Enumerator: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/enumerator.png"), Theme::IconsCodeModelEnumColor}
}, Icon::Tint).icon());
return icon;
}
case FuncPublic: {
const static QIcon icon(Icon({
functionIcon}, Icon::Tint).icon());
return icon;
}
case FuncProtected: {
const static QIcon icon(Icon({
functionIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPrivate: {
const static QIcon icon(Icon({
functionIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPublicStatic: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon
}, Icon::Tint).icon());
return icon;
}
case FuncProtectedStatic: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case FuncPrivateStatic: {
const static QIcon icon(Icon({
functionIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case Namespace: {
const static QIcon icon(Icon({
{QLatin1String(":/utils/images/namespace.png"), Theme::IconsCodeModelKeywordColor}
}, Icon::Tint).icon());
return icon;
}
case VarPublic: {
const static QIcon icon(Icon({
variableIcon
}, Icon::Tint).icon());
return icon;
}
case VarProtected: {
const static QIcon icon(Icon({
variableIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case VarPrivate: {
const static QIcon icon(Icon({
variableIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case VarPublicStatic: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon
}, Icon::Tint).icon());
return icon;
}
case VarProtectedStatic: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case VarPrivateStatic: {
const static QIcon icon(Icon({
variableIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case Signal: {
const static QIcon icon(Icon({
signalIcon
}, Icon::Tint).icon());
return icon;
}
case SlotPublic: {
const static QIcon icon(Icon({
slotIcon
}, Icon::Tint).icon());
return icon;
}
case SlotProtected: {
const static QIcon icon(Icon({
slotIcon, protectedBackgroundIcon, protectedIcon
}, Icon::Tint).icon());
return icon;
}
case SlotPrivate: {
const static QIcon icon(Icon({
slotIcon, privateBackgroundIcon, privateIcon
}, Icon::Tint).icon());
return icon;
}
case Keyword: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/keyword.png"), Theme::IconsCodeModelKeywordColor}
}, Icon::Tint).icon());
return icon;
}
case Macro: {
const static QIcon icon(Icon({
{QLatin1String(":/codemodel/images/macro.png"), Theme::IconsCodeModelMacroColor}
}, Icon::Tint).icon());
return icon;
}
case Property: {
const static QIcon icon(Icon({
variableIcon, propertyBackgroundIcon, propertyIcon
}, Icon::Tint).icon());
return icon;
}
default:
break;
}
return QIcon();
}
} // namespace Utils } // namespace Utils

View File

@@ -145,4 +145,38 @@ QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_DISABLED_WARNING;
QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_FIXIT; QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_FIXIT;
} // namespace Icons } // namespace Icons
namespace CodeModelIcon {
enum Type {
Class = 0,
Struct,
Enum,
Enumerator,
FuncPublic,
FuncProtected,
FuncPrivate,
FuncPublicStatic,
FuncProtectedStatic,
FuncPrivateStatic,
Namespace,
VarPublic,
VarProtected,
VarPrivate,
VarPublicStatic,
VarProtectedStatic,
VarPrivateStatic,
Signal,
SlotPublic,
SlotProtected,
SlotPrivate,
Keyword,
Macro,
Property,
Unknown
};
QTCREATOR_UTILS_EXPORT QIcon iconForType(Type type);
} // namespace CodeModel
} // namespace Utils } // namespace Utils

View File

@@ -62,8 +62,8 @@ static QIcon testTreeIcon(TestTreeItem::Type type)
static QIcon icons[] = { static QIcon icons[] = {
QIcon(), QIcon(),
Utils::Icons::OPENFILE.icon(), Utils::Icons::OPENFILE.icon(),
CPlusPlus::Icons::iconForType(CPlusPlus::Icons::ClassIconType), Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Class),
CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SlotPrivateIconType), Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::SlotPrivate),
QIcon(":/autotest/images/data.png") QIcon(":/autotest/images/data.png")
}; };

View File

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

View File

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

View File

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

View File

@@ -171,7 +171,7 @@ QVariant TokenTreeItem::data(int column, int role) const
} }
case Qt::DecorationRole: { case Qt::DecorationRole: {
return CPlusPlus::Icons::iconForType(ClangCodeModel::Utils::iconTypeForToken(token)); return ::Utils::CodeModelIcon::iconForType(ClangCodeModel::Utils::iconTypeForToken(token));
} }
case CppTools::AbstractOverviewModel::FileNameRole: { 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; 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; const ClangBackEnd::ExtraInfo &extraInfo = token.extraInfo;
if (extraInfo.signal) if (extraInfo.signal)
return CPlusPlus::Icons::SignalIconType; return ::Utils::CodeModelIcon::Signal;
ClangBackEnd::AccessSpecifier access = extraInfo.accessSpecifier; ClangBackEnd::AccessSpecifier access = extraInfo.accessSpecifier;
if (extraInfo.slot) { if (extraInfo.slot) {
switch (access) { switch (access) {
case ClangBackEnd::AccessSpecifier::Public: case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid: case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::SlotPublicIconType; return ::Utils::CodeModelIcon::SlotPublic;
case ClangBackEnd::AccessSpecifier::Protected: case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::SlotProtectedIconType; return ::Utils::CodeModelIcon::SlotProtected;
case ClangBackEnd::AccessSpecifier::Private: case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::SlotPrivateIconType; return ::Utils::CodeModelIcon::SlotPrivate;
} }
} }
ClangBackEnd::HighlightingType mainType = token.types.mainHighlightingType; ClangBackEnd::HighlightingType mainType = token.types.mainHighlightingType;
if (mainType == ClangBackEnd::HighlightingType::QtProperty) if (mainType == ClangBackEnd::HighlightingType::QtProperty)
return CPlusPlus::Icons::PropertyIconType; return ::Utils::CodeModelIcon::Property;
if (mainType == ClangBackEnd::HighlightingType::PreprocessorExpansion if (mainType == ClangBackEnd::HighlightingType::PreprocessorExpansion
|| mainType == ClangBackEnd::HighlightingType::PreprocessorDefinition) { || mainType == ClangBackEnd::HighlightingType::PreprocessorDefinition) {
return CPlusPlus::Icons::MacroIconType; return ::Utils::CodeModelIcon::Macro;
} }
if (mainType == ClangBackEnd::HighlightingType::Enumeration) if (mainType == ClangBackEnd::HighlightingType::Enumeration)
return CPlusPlus::Icons::EnumeratorIconType; return ::Utils::CodeModelIcon::Enumerator;
if (mainType == ClangBackEnd::HighlightingType::Type if (mainType == ClangBackEnd::HighlightingType::Type
|| mainType == ClangBackEnd::HighlightingType::Keyword) { || mainType == ClangBackEnd::HighlightingType::Keyword) {
const ClangBackEnd::MixinHighlightingTypes &types = token.types.mixinHighlightingTypes; const ClangBackEnd::MixinHighlightingTypes &types = token.types.mixinHighlightingTypes;
if (types.contains(ClangBackEnd::HighlightingType::Enum)) if (types.contains(ClangBackEnd::HighlightingType::Enum))
return CPlusPlus::Icons::EnumIconType; return ::Utils::CodeModelIcon::Enum;
if (types.contains(ClangBackEnd::HighlightingType::Struct)) if (types.contains(ClangBackEnd::HighlightingType::Struct))
return CPlusPlus::Icons::StructIconType; return ::Utils::CodeModelIcon::Struct;
if (types.contains(ClangBackEnd::HighlightingType::Namespace)) if (types.contains(ClangBackEnd::HighlightingType::Namespace))
return CPlusPlus::Icons::NamespaceIconType; return ::Utils::CodeModelIcon::Namespace;
if (types.contains(ClangBackEnd::HighlightingType::Class)) if (types.contains(ClangBackEnd::HighlightingType::Class))
return CPlusPlus::Icons::ClassIconType; return ::Utils::CodeModelIcon::Class;
if (mainType == ClangBackEnd::HighlightingType::Keyword) if (mainType == ClangBackEnd::HighlightingType::Keyword)
return CPlusPlus::Icons::KeywordIconType; return ::Utils::CodeModelIcon::Keyword;
return CPlusPlus::Icons::ClassIconType; return ::Utils::CodeModelIcon::Class;
} }
ClangBackEnd::StorageClass storageClass = extraInfo.storageClass; ClangBackEnd::StorageClass storageClass = extraInfo.storageClass;
@@ -261,21 +261,21 @@ CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContain
switch (access) { switch (access) {
case ClangBackEnd::AccessSpecifier::Public: case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid: case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::FuncPublicIconType; return ::Utils::CodeModelIcon::FuncPublic;
case ClangBackEnd::AccessSpecifier::Protected: case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::FuncProtectedIconType; return ::Utils::CodeModelIcon::FuncProtected;
case ClangBackEnd::AccessSpecifier::Private: case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::FuncPrivateIconType; return ::Utils::CodeModelIcon::FuncPrivate;
} }
} else { } else {
switch (access) { switch (access) {
case ClangBackEnd::AccessSpecifier::Public: case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid: case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::FuncPublicStaticIconType; return ::Utils::CodeModelIcon::FuncPublicStatic;
case ClangBackEnd::AccessSpecifier::Protected: case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::FuncProtectedStaticIconType; return ::Utils::CodeModelIcon::FuncProtectedStatic;
case ClangBackEnd::AccessSpecifier::Private: 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) { switch (access) {
case ClangBackEnd::AccessSpecifier::Public: case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid: case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::VarPublicIconType; return ::Utils::CodeModelIcon::VarPublic;
case ClangBackEnd::AccessSpecifier::Protected: case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::VarProtectedIconType; return ::Utils::CodeModelIcon::VarProtected;
case ClangBackEnd::AccessSpecifier::Private: case ClangBackEnd::AccessSpecifier::Private:
return CPlusPlus::Icons::VarPrivateIconType; return ::Utils::CodeModelIcon::VarPrivate;
} }
} else { } else {
switch (access) { switch (access) {
case ClangBackEnd::AccessSpecifier::Public: case ClangBackEnd::AccessSpecifier::Public:
case ClangBackEnd::AccessSpecifier::Invalid: case ClangBackEnd::AccessSpecifier::Invalid:
return CPlusPlus::Icons::VarPublicStaticIconType; return ::Utils::CodeModelIcon::VarPublicStatic;
case ClangBackEnd::AccessSpecifier::Protected: case ClangBackEnd::AccessSpecifier::Protected:
return CPlusPlus::Icons::VarProtectedStaticIconType; return ::Utils::CodeModelIcon::VarProtectedStatic;
case ClangBackEnd::AccessSpecifier::Private: 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) QString diagnosticCategoryPrefixRemoved(const QString &text)

View File

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

View File

@@ -173,7 +173,7 @@ QList<QToolButton *> NavigationWidget::createToolButtons()
// create a button // create a button
fullProjectsModeButton = new QToolButton(); fullProjectsModeButton = new QToolButton();
fullProjectsModeButton->setIcon( fullProjectsModeButton->setIcon(
CPlusPlus::Icons::iconForType(CPlusPlus::Icons::ClassIconType)); ::Utils::CodeModelIcon::iconForType(::Utils::CodeModelIcon::Class));
fullProjectsModeButton->setCheckable(true); fullProjectsModeButton->setCheckable(true);
fullProjectsModeButton->setToolTip(tr("Show Subprojects")); fullProjectsModeButton->setToolTip(tr("Show Subprojects"));

View File

@@ -62,7 +62,7 @@ QVariant TreeItemModel::data(const QModelIndex &index, int role) const
bool ok = false; bool ok = false;
int type = iconType.toInt(&ok); int type = iconType.toInt(&ok);
if (ok && type >= 0) if (ok && type >= 0)
return CPlusPlus::Icons::iconForType(static_cast<CPlusPlus::Icons::IconType>(type)); return ::Utils::CodeModelIcon::iconForType(static_cast<::Utils::CodeModelIcon::Type>(type));
} }
} }
break; break;

View File

@@ -43,29 +43,29 @@ namespace Constants {
//! Default icon sort order //! Default icon sort order
const int IconSortOrder[] = { const int IconSortOrder[] = {
CPlusPlus::Icons::NamespaceIconType, Utils::CodeModelIcon::Namespace,
CPlusPlus::Icons::EnumIconType, Utils::CodeModelIcon::Enum,
CPlusPlus::Icons::ClassIconType, Utils::CodeModelIcon::Class,
CPlusPlus::Icons::FuncPublicIconType, Utils::CodeModelIcon::FuncPublic,
CPlusPlus::Icons::FuncProtectedIconType, Utils::CodeModelIcon::FuncProtected,
CPlusPlus::Icons::FuncPrivateIconType, Utils::CodeModelIcon::FuncPrivate,
CPlusPlus::Icons::FuncPublicStaticIconType, Utils::CodeModelIcon::FuncPublicStatic,
CPlusPlus::Icons::FuncProtectedStaticIconType, Utils::CodeModelIcon::FuncProtectedStatic,
CPlusPlus::Icons::FuncPrivateStaticIconType, Utils::CodeModelIcon::FuncPrivateStatic,
CPlusPlus::Icons::SignalIconType, Utils::CodeModelIcon::Signal,
CPlusPlus::Icons::SlotPublicIconType, Utils::CodeModelIcon::SlotPublic,
CPlusPlus::Icons::SlotProtectedIconType, Utils::CodeModelIcon::SlotProtected,
CPlusPlus::Icons::SlotPrivateIconType, Utils::CodeModelIcon::SlotPrivate,
CPlusPlus::Icons::VarPublicIconType, Utils::CodeModelIcon::VarPublic,
CPlusPlus::Icons::VarProtectedIconType, Utils::CodeModelIcon::VarProtected,
CPlusPlus::Icons::VarPrivateIconType, Utils::CodeModelIcon::VarPrivate,
CPlusPlus::Icons::VarPublicStaticIconType, Utils::CodeModelIcon::VarPublicStatic,
CPlusPlus::Icons::VarProtectedStaticIconType, Utils::CodeModelIcon::VarProtectedStatic,
CPlusPlus::Icons::VarPrivateStaticIconType, Utils::CodeModelIcon::VarPrivateStatic,
CPlusPlus::Icons::EnumeratorIconType, Utils::CodeModelIcon::Enumerator,
CPlusPlus::Icons::KeywordIconType, Utils::CodeModelIcon::Keyword,
CPlusPlus::Icons::MacroIconType, Utils::CodeModelIcon::Macro,
CPlusPlus::Icons::UnknownIconType Utils::CodeModelIcon::Unknown
}; };
} // namespace Constants } // namespace Constants

View File

@@ -1837,7 +1837,7 @@ bool InternalCppCompletionAssistProcessor::completeQtMethodClassName(
return false; return false;
const LookupContext &context = m_model->m_typeOfExpression->context(); const LookupContext &context = m_model->m_typeOfExpression->context();
const QIcon classIcon = Icons::iconForType(Icons::ClassIconType); const QIcon classIcon = Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Class);
Overview overview; Overview overview;
foreach (const LookupItem &lookupItem, results) { foreach (const LookupItem &lookupItem, results) {

View File

@@ -161,15 +161,15 @@ static QIcon glslIcon(IconTypes iconType)
switch (iconType) { switch (iconType) {
case IconTypeType: case IconTypeType:
return Icons::iconForType(Icons::ClassIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Class);
case IconTypeConst: case IconTypeConst:
return Icons::iconForType(Icons::EnumeratorIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Enumerator);
case IconTypeKeyword: case IconTypeKeyword:
return Icons::iconForType(Icons::KeywordIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Keyword);
case IconTypeFunction: case IconTypeFunction:
return Icons::iconForType(Icons::FuncPublicIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::FuncPublic);
case IconTypeVariable: case IconTypeVariable:
return Icons::iconForType(Icons::VarPublicIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::VarPublic);
case IconTypeAttribute: { case IconTypeAttribute: {
static const QIcon icon = static const QIcon icon =
Icon({{member, Theme::IconsCodeModelAttributeColor}}, Icon::Tint).icon(); Icon({{member, Theme::IconsCodeModelAttributeColor}}, Icon::Tint).icon();
@@ -187,7 +187,7 @@ static QIcon glslIcon(IconTypes iconType)
} }
case IconTypeOther: case IconTypeOther:
default: default:
return Icons::iconForType(Icons::NamespaceIconType); return Utils::CodeModelIcon::iconForType(Utils::CodeModelIcon::Namespace);
} }
} }

View File

@@ -823,55 +823,56 @@ void IconLister::addUtilsIcons()
void IconLister::addCPlusPlusIcons() void IconLister::addCPlusPlusIcons()
{ {
using namespace Utils::CodeModelIcon;
const QString prefix = "CPlusPlus"; const QString prefix = "CPlusPlus";
const QList<IconInfo> icons = { const QList<IconInfo> icons = {
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::ClassIconType), "ClassIconType", prefix, {iconForType(Class), "Class", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::StructIconType), "StructIconType", prefix, {iconForType(Struct), "Struct", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::EnumIconType), "EnumIconType", prefix, {iconForType(Enum), "Enum", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::EnumeratorIconType), "EnumeratorIconType", prefix, {iconForType(Enumerator), "Enumerator", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPublicIconType), "FuncPublicIconType", prefix, {iconForType(FuncPublic), "FuncPublic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncProtectedIconType), "FuncProtectedIconType", prefix, {iconForType(FuncProtected), "FuncProtected", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPrivateIconType), "FuncPrivateIconType", prefix, {iconForType(FuncPrivate), "FuncPrivate", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPublicStaticIconType), "FuncPublicStaticIconType", prefix, {iconForType(FuncPublicStatic), "FuncPublicStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncProtectedStaticIconType), "FuncProtectedStaticIconType", prefix, {iconForType(FuncProtectedStatic), "FuncProtectedStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::FuncPrivateStaticIconType), "FuncPrivateStaticIconType", prefix, {iconForType(FuncPrivateStatic), "FuncPrivateStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::NamespaceIconType), "NamespaceIconType", prefix, {iconForType(Namespace), "Namespace", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarPublicIconType), "VarPublicIconType", prefix, {iconForType(VarPublic), "VarPublic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarProtectedIconType), "VarProtectedIconType", prefix, {iconForType(VarProtected), "VarProtected", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarPrivateIconType), "VarPrivateIconType", prefix, {iconForType(VarPrivate), "VarPrivate", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarPublicStaticIconType), "VarPublicStaticIconType", prefix, {iconForType(VarPublicStatic), "VarPublicStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarProtectedStaticIconType), "VarProtectedStaticIconType", prefix, {iconForType(VarProtectedStatic), "VarProtectedStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::VarPrivateStaticIconType), "VarPrivateStaticIconType", prefix, {iconForType(VarPrivateStatic), "VarPrivateStatic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SignalIconType), "SignalIconType", prefix, {iconForType(Signal), "Signal", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SlotPublicIconType), "SlotPublicIconType", prefix, {iconForType(SlotPublic), "SlotPublic", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SlotProtectedIconType), "SlotProtectedIconType", prefix, {iconForType(SlotProtected), "SlotProtected", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::SlotPrivateIconType), "SlotPrivateIconType", prefix, {iconForType(SlotPrivate), "SlotPrivate", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::KeywordIconType), "KeywordIconType", prefix, {iconForType(Keyword), "Keyword", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::MacroIconType), "MacroIconType", prefix, {iconForType(Macro), "Macro", prefix,
""}, ""},
{CPlusPlus::Icons::iconForType(CPlusPlus::Icons::PropertyIconType), "PropertyIconType", prefix, {iconForType(Property), "Property", prefix,
""} ""}
}; };
m_icons.append(icons); m_icons.append(icons);

View File

@@ -6275,7 +6275,7 @@
style="display:inline" /> style="display:inline" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/member" id="src/libs/utils/images/member"
transform="translate(-28,0)"> transform="translate(-28,0)">
<rect <rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
@@ -6292,7 +6292,7 @@
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/signal"> id="src/libs/utils/images/signal">
<rect <rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="rect4853-8-7" id="rect4853-8-7"
@@ -6355,7 +6355,7 @@
</g> </g>
<g <g
transform="translate(4,0)" transform="translate(4,0)"
id="src/libs/cplusplus/images/slot"> id="src/libs/utils/images/slot">
<rect <rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="rect4853-8-0" id="rect4853-8-0"
@@ -6385,7 +6385,7 @@
height="100%" /> height="100%" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/protected" id="src/libs/utils/images/protected"
transform="translate(36,0)"> transform="translate(36,0)">
<rect <rect
y="552" y="552"
@@ -6418,7 +6418,7 @@
</g> </g>
</g> </g>
<g <g
id="src/libs/cplusplus/images/protectedbackground" id="src/libs/utils/images/protectedbackground"
transform="translate(52,0)"> transform="translate(52,0)">
<rect <rect
y="552" y="552"
@@ -6451,7 +6451,7 @@
</g> </g>
</g> </g>
<g <g
id="src/libs/cplusplus/images/private" id="src/libs/utils/images/private"
transform="translate(36,0)"> transform="translate(36,0)">
<rect <rect
y="552" y="552"
@@ -6497,7 +6497,7 @@
sodipodi:nodetypes="zzzzz" /> sodipodi:nodetypes="zzzzz" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/privatebackground" id="src/libs/utils/images/privatebackground"
transform="translate(52,0)"> transform="translate(52,0)">
<rect <rect
y="552" y="552"
@@ -6537,7 +6537,7 @@
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/static" id="src/libs/utils/images/static"
transform="translate(68,0)"> transform="translate(68,0)">
<rect <rect
y="552" y="552"
@@ -6554,7 +6554,7 @@
sodipodi:nodetypes="cczczcc" /> sodipodi:nodetypes="cczczcc" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/staticbackground" id="src/libs/utils/images/staticbackground"
transform="translate(84,0)"> transform="translate(84,0)">
<rect <rect
y="552" y="552"
@@ -6571,7 +6571,7 @@
sodipodi:nodetypes="cczczcc" /> sodipodi:nodetypes="cczczcc" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/classparent" id="src/libs/utils/images/classparent"
transform="translate(84,0)"> transform="translate(84,0)">
<rect <rect
y="552" y="552"
@@ -6588,7 +6588,7 @@
sodipodi:nodetypes="ccccc" /> sodipodi:nodetypes="ccccc" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/classmemberfunction" id="src/libs/utils/images/classmemberfunction"
transform="translate(100,0)"> transform="translate(100,0)">
<rect <rect
y="552" y="552"
@@ -6606,7 +6606,7 @@
inkscape:label="#path4895-4" /> inkscape:label="#path4895-4" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/classmembervariable" id="src/libs/utils/images/classmembervariable"
transform="translate(116,0)"> transform="translate(116,0)">
<rect <rect
y="552" y="552"
@@ -6625,7 +6625,7 @@
height="100%" /> height="100%" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/classrelation" id="src/libs/utils/images/classrelation"
transform="translate(148,0)"> transform="translate(148,0)">
<rect <rect
y="552" y="552"
@@ -6648,7 +6648,7 @@
sodipodi:nodetypes="cc" /> sodipodi:nodetypes="cc" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/classrelationbackground" id="src/libs/utils/images/classrelationbackground"
transform="translate(164,0)"> transform="translate(164,0)">
<rect <rect
y="552" y="552"
@@ -6671,7 +6671,7 @@
sodipodi:nodetypes="cc" /> sodipodi:nodetypes="cc" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/keyword"> id="src/libs/utils/images/keyword">
<rect <rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="rect4853-8-9-8-3-7-5-1-9" id="rect4853-8-9-8-3-7-5-1-9"
@@ -6729,7 +6729,7 @@
x="0" /> x="0" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/macro"> id="src/libs/utils/images/macro">
<rect <rect
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="rect4853-8-9-8-3-7-5-1-9-9-5" id="rect4853-8-9-8-3-7-5-1-9-9-5"
@@ -6786,7 +6786,7 @@
</g> </g>
</g> </g>
<g <g
id="src/libs/cplusplus/images/enum" id="src/libs/utils/images/enum"
transform="translate(16,0)"> transform="translate(16,0)">
<rect <rect
y="552" y="552"
@@ -6823,7 +6823,7 @@
</g> </g>
</g> </g>
<g <g
id="src/libs/cplusplus/images/enumerator" id="src/libs/utils/images/enumerator"
transform="translate(32,0)"> transform="translate(32,0)">
<rect <rect
y="552" y="552"
@@ -6856,7 +6856,7 @@
style="opacity:1;fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> style="opacity:1;fill:#b3b3b3;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/property" id="src/libs/utils/images/property"
transform="translate(292)"> transform="translate(292)">
<rect <rect
y="552" y="552"
@@ -6881,7 +6881,7 @@
rx="1" /> rx="1" />
</g> </g>
<g <g
id="src/libs/cplusplus/images/propertybackground"> id="src/libs/utils/images/propertybackground">
<rect <rect
y="552" y="552"
x="441" x="441"

Before

Width:  |  Height:  |  Size: 356 KiB

After

Width:  |  Height:  |  Size: 356 KiB