Commit 915ba478 authored by Denis Mingulov's avatar Denis Mingulov Committed by Kai Koehne

CPlusPlus::Icons - modify to support icon's id additionally

Merge-request: 2167
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 8519ca11
......@@ -58,6 +58,21 @@ Icons::Icons()
}
QIcon Icons::iconForSymbol(const Symbol *symbol) const
{
return iconForType(iconTypeForSymbol(symbol));
}
QIcon Icons::keywordIcon() const
{
return _keywordIcon;
}
QIcon Icons::macroIcon() const
{
return _macroIcon;
}
Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol)
{
FullySpecifiedType symbolType = symbol->type();
if (symbol->isFunction() || (symbol->isDeclaration() && symbolType &&
......@@ -69,58 +84,89 @@ QIcon Icons::iconForSymbol(const Symbol *symbol) const
if (function->isSlot()) {
if (function->isPublic()) {
return _slotPublicIcon;
return SlotPublicIconType;
} else if (function->isProtected()) {
return _slotProtectedIcon;
return SlotProtectedIconType;
} else if (function->isPrivate()) {
return _slotPrivateIcon;
return SlotPrivateIconType;
}
} else if (function->isSignal()) {
return _signalIcon;
return SignalIconType;
} else if (symbol->isPublic()) {
return _funcPublicIcon;
return FuncPublicIconType;
} else if (symbol->isProtected()) {
return _funcProtectedIcon;
return FuncProtectedIconType;
} else if (symbol->isPrivate()) {
return _funcPrivateIcon;
return FuncPrivateIconType;
}
} else if (symbol->scope() && symbol->scope()->isEnumScope()) {
return _enumeratorIcon;
return EnumeratorIconType;
} else if (symbol->isDeclaration() || symbol->isArgument()) {
if (symbol->isPublic()) {
return _varPublicIcon;
return VarPublicIconType;
} else if (symbol->isProtected()) {
return _varProtectedIcon;
return VarProtectedIconType;
} else if (symbol->isPrivate()) {
return _varPrivateIcon;
return VarPrivateIconType;
}
} else if (symbol->isEnum()) {
return _enumIcon;
return EnumIconType;
} else if (symbol->isClass() || symbol->isForwardClassDeclaration()) {
return _classIcon;
return ClassIconType;
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
return _classIcon;
return ClassIconType;
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
return _classIcon;
return ClassIconType;
} else if (symbol->isObjCMethod()) {
return _funcPublicIcon;
return FuncPublicIconType;
} else if (symbol->isNamespace()) {
return _namespaceIcon;
return NamespaceIconType;
} else if (symbol->isUsingNamespaceDirective() ||
symbol->isUsingDeclaration()) {
// TODO: Might be nice to have a different icons for these things
return _namespaceIcon;
return NamespaceIconType;
}
return QIcon();
return UnknownIconType;
}
QIcon Icons::keywordIcon() const
QIcon Icons::iconForType(IconType type) const
{
switch(type) {
case ClassIconType:
return _classIcon;
case EnumIconType:
return _enumIcon;
case EnumeratorIconType:
return _enumeratorIcon;
case FuncPublicIconType:
return _funcPublicIcon;
case FuncProtectedIconType:
return _funcProtectedIcon;
case FuncPrivateIconType:
return _funcPrivateIcon;
case NamespaceIconType:
return _namespaceIcon;
case VarPublicIconType:
return _varPublicIcon;
case VarProtectedIconType:
return _varProtectedIcon;
case VarPrivateIconType:
return _varPrivateIcon;
case SignalIconType:
return _signalIcon;
case SlotPublicIconType:
return _slotPublicIcon;
case SlotProtectedIconType:
return _slotProtectedIcon;
case SlotPrivateIconType:
return _slotPrivateIcon;
case KeywordIconType:
return _keywordIcon;
}
QIcon Icons::macroIcon() const
{
case MacroIconType:
return _macroIcon;
default:
break;
}
return QIcon();
}
......@@ -48,6 +48,29 @@ public:
QIcon keywordIcon() const;
QIcon macroIcon() const;
enum IconType {
ClassIconType = 0,
EnumIconType,
EnumeratorIconType,
FuncPublicIconType,
FuncProtectedIconType,
FuncPrivateIconType,
NamespaceIconType,
VarPublicIconType,
VarProtectedIconType,
VarPrivateIconType,
SignalIconType,
SlotPublicIconType,
SlotProtectedIconType,
SlotPrivateIconType,
KeywordIconType,
MacroIconType,
UnknownIconType
};
static IconType iconTypeForSymbol(const Symbol *symbol);
QIcon iconForType(IconType type) const;
private:
QIcon _classIcon;
QIcon _enumIcon;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment