Commit f0c9ef58 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools: Fix displaying symbols of CppLocatorFilter

The left column of the locator filter displayed the fully qualified
name, which is a bit too long...

Regression introduced by commit 760aa0f8.

Change-Id: I57fb44cd205c6e54158de22b6638e4a28014749c
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent e7b015e9
......@@ -47,14 +47,6 @@ CppClassesFilter::~CppClassesFilter()
{
}
QString CppClassesFilter::stringToMatchUserInputAgainst(const ModelItemInfo &info,
bool userInputContainsColonColon)
{
if (userInputContainsColonColon)
return info.scopedSymbolName();
return info.symbolName;
}
Locator::FilterEntry CppClassesFilter::filterEntryFromModelItemInfo(const ModelItemInfo &info)
{
const QVariant id = qVariantFromValue(info);
......
......@@ -44,8 +44,6 @@ public:
~CppClassesFilter();
private:
QString stringToMatchUserInputAgainst(const ModelItemInfo &info,
bool userInputContainsColonColon);
Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info);
};
......
......@@ -46,14 +46,6 @@ CppFunctionsFilter::~CppFunctionsFilter()
{
}
QString CppFunctionsFilter::stringToMatchUserInputAgainst(const CppTools::ModelItemInfo &info,
bool userInputContainsColonColon)
{
if (userInputContainsColonColon)
return info.scopedSymbolName();
return info.symbolName;
}
Locator::FilterEntry CppFunctionsFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info)
{
const QVariant id = qVariantFromValue(info);
......
......@@ -44,8 +44,6 @@ public:
~CppFunctionsFilter();
private:
QString stringToMatchUserInputAgainst(const ModelItemInfo &info,
bool userInputContainsColonColon);
Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info);
};
......
......@@ -108,18 +108,10 @@ void CppLocatorFilter::onAboutToRemoveFiles(const QStringList &files)
m_searchList.remove(file);
}
QString CppLocatorFilter::stringToMatchUserInputAgainst(const CppTools::ModelItemInfo &info,
bool userInputContainsColonColon)
{
Q_UNUSED(userInputContainsColonColon)
return info.scopedSymbolName();
}
Locator::FilterEntry CppLocatorFilter::filterEntryFromModelItemInfo(const CppTools::ModelItemInfo &info)
{
const QVariant id = qVariantFromValue(info);
const QString name = info.symbolScope.isEmpty() ? info.symbolName : info.scopedSymbolName();
Locator::FilterEntry filterEntry(this, name, id, info.icon);
Locator::FilterEntry filterEntry(this, info.symbolName, id, info.icon);
filterEntry.extraInfo = info.type == ModelItemInfo::Class || info.type == ModelItemInfo::Enum
? info.shortNativeFilePath()
: info.symbolType;
......@@ -163,7 +155,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato
const QList<ModelItemInfo> items = it.value();
foreach (const ModelItemInfo &info, items) {
const QString matchString = stringToMatchUserInputAgainst(info, hasColonColon);
const QString matchString = hasColonColon ? info.scopedSymbolName() : info.symbolName;
if ((hasWildcard && regexp.exactMatch(matchString))
|| (!hasWildcard && matcher.indexIn(matchString) != -1)) {
const Locator::FilterEntry filterEntry = filterEntryFromModelItemInfo(info);
......
......@@ -63,8 +63,6 @@ private slots:
void onAboutToRemoveFiles(const QStringList &files);
private:
virtual QString stringToMatchUserInputAgainst(const ModelItemInfo &info,
bool userInputContainsColonColon);
virtual Locator::FilterEntry filterEntryFromModelItemInfo(const ModelItemInfo &info);
private:
......
......@@ -214,20 +214,17 @@ void CppToolsPlugin::test_cpplocatorfilters_CppLocatorFilter_data()
<< _("my")
<< (QList<ResultData>()
<< ResultData(_("MyClass"), testFileShort)
<< ResultData(_("MyClass::MyClass"), _("()"))
<< ResultData(_("MyClass::function2"), _("(bool, int)"))
<< ResultData(_("MyClass"), _("()"))
<< ResultData(_("MyClass"), _("()"))
<< ResultData(_("MyClass"), testFileShort)
<< ResultData(_("MyClass"), _("()"))
<< ResultData(_("MyClass"), testFileShort)
<< ResultData(_("MyEnum"), testFileShort)
<< ResultData(_("MyEnum"), testFileShort)
<< ResultData(_("MyNamespace::MyClass"), testFileShort)
<< ResultData(_("MyNamespace::MyClass::MyClass"), _("()"))
<< ResultData(_("MyNamespace::MyClass::function2"), _("(bool, int)"))
<< ResultData(_("MyNamespace::MyEnum"), testFileShort)
<< ResultData(_("MyNamespace::myFunction"), _("(bool, int)"))
<< ResultData(_("MyEnum"), testFileShort)
<< ResultData(_("myFunction"), _("(bool, int)"))
<< ResultData(_("myFunction"), _("(bool, int)"))
<< ResultData(_("myFunction"), _("(bool, int)"))
<< ResultData(_("<anonymous namespace>::MyClass"), testFileShort)
<< ResultData(_("<anonymous namespace>::MyClass::MyClass"), _("()"))
<< ResultData(_("<anonymous namespace>::MyClass::function2"), _("(bool, int)"))
<< ResultData(_("<anonymous namespace>::MyEnum"), testFileShort)
<< ResultData(_("<anonymous namespace>::myFunction"), _("(bool, int)"))
);
}
......
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