Commit 1c4e0d6d authored by Leandro Melo's avatar Leandro Melo
Browse files

C++ editor: Make code a bit better in the C++ element evaluator.

parent 17367b3f
...@@ -302,13 +302,11 @@ CppMacro::~CppMacro() ...@@ -302,13 +302,11 @@ CppMacro::~CppMacro()
// CppDeclarableElement // CppDeclarableElement
CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement() CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement()
{ {
const FullySpecifiedType &type = declaration->type(); m_icon = Icons().iconForSymbol(declaration);
Overview overview; Overview overview;
overview.setShowArgumentNames(true); overview.setShowArgumentNames(true);
overview.setShowReturnTypes(true); overview.setShowReturnTypes(true);
m_icon = Icons().iconForSymbol(declaration);
m_name = overview.prettyName(declaration->name()); m_name = overview.prettyName(declaration->name());
if (declaration->enclosingScope()->isClass() || if (declaration->enclosingScope()->isClass() ||
declaration->enclosingScope()->isNamespace() || declaration->enclosingScope()->isNamespace() ||
...@@ -318,16 +316,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement() ...@@ -318,16 +316,7 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration) : CppElement()
m_qualifiedName = m_name; m_qualifiedName = m_name;
} }
if (declaration->isClass() || setTooltip(overview.prettyType(declaration->type(), m_qualifiedName));
declaration->isNamespace() ||
declaration->isForwardClassDeclaration() ||
declaration->isEnum()) {
m_type = m_qualifiedName;
} else {
m_type = overview.prettyType(type, m_qualifiedName);
}
setTooltip(m_type);
setLink(CPPEditor::linkToSymbol(declaration)); setLink(CPPEditor::linkToSymbol(declaration));
QStringList helpIds; QStringList helpIds;
...@@ -367,6 +356,7 @@ const QIcon &CppDeclarableElement::icon() const ...@@ -367,6 +356,7 @@ const QIcon &CppDeclarableElement::icon() const
CppNamespace::CppNamespace(Symbol *declaration) : CppDeclarableElement(declaration) CppNamespace::CppNamespace(Symbol *declaration) : CppDeclarableElement(declaration)
{ {
setHelpCategory(TextEditor::HelpItem::ClassOrNamespace); setHelpCategory(TextEditor::HelpItem::ClassOrNamespace);
setTooltip(qualifiedName());
} }
CppNamespace::~CppNamespace() CppNamespace::~CppNamespace()
...@@ -376,6 +366,7 @@ CppNamespace::~CppNamespace() ...@@ -376,6 +366,7 @@ CppNamespace::~CppNamespace()
CppClass::CppClass(Symbol *declaration) : CppDeclarableElement(declaration) CppClass::CppClass(Symbol *declaration) : CppDeclarableElement(declaration)
{ {
setHelpCategory(TextEditor::HelpItem::ClassOrNamespace); setHelpCategory(TextEditor::HelpItem::ClassOrNamespace);
setTooltip(qualifiedName());
} }
CppClass::~CppClass() CppClass::~CppClass()
...@@ -445,6 +436,8 @@ CppEnum::CppEnum(Symbol *declaration) : CppDeclarableElement(declaration) ...@@ -445,6 +436,8 @@ CppEnum::CppEnum(Symbol *declaration) : CppDeclarableElement(declaration)
Overview overview; Overview overview;
setHelpMark(overview.prettyName(enumSymbol->name())); setHelpMark(overview.prettyName(enumSymbol->name()));
setTooltip(overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol))); setTooltip(overview.prettyName(LookupContext::fullyQualifiedName(enumSymbol)));
} else {
setTooltip(qualifiedName());
} }
} }
...@@ -452,10 +445,10 @@ CppEnum::~CppEnum() ...@@ -452,10 +445,10 @@ CppEnum::~CppEnum()
{} {}
// CppTypedef // CppTypedef
CppTypedef::CppTypedef(Symbol *declaration) : CppTypedef::CppTypedef(Symbol *declaration) : CppDeclarableElement(declaration)
CppDeclarableElement(declaration)
{ {
setHelpCategory(TextEditor::HelpItem::Typedef); setHelpCategory(TextEditor::HelpItem::Typedef);
setTooltip(Overview().prettyType(declaration->type(), qualifiedName()));
} }
CppTypedef::~CppTypedef() CppTypedef::~CppTypedef()
......
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