forked from qt-creator/qt-creator
Locator: Extract MatchLevel and use it in several filters
... that already used index-based prioritising. There are a few more with two- or three-level priority, but these still use the old scheme with multiple lists good/better/bestEntries and converting them would not gain much. Change-Id: I21f7cfe07a3ae8183db9cb62311697d03db6e4da Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
847108d4f4
commit
3b41b9b24b
@@ -69,8 +69,7 @@ void CppLocatorFilter::refresh(QFutureInterface<void> &future)
|
||||
QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
|
||||
QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry)
|
||||
{
|
||||
enum { Best = 0, Better, Good, Normal, EntryNumber };
|
||||
QList<Core::LocatorFilterEntry> entries[EntryNumber];
|
||||
QList<Core::LocatorFilterEntry> entries[int(MatchLevel::Count)];
|
||||
const Qt::CaseSensitivity caseSensitivityForPrefix = caseSensitivity(entry);
|
||||
const IndexItem::ItemType wanted = matchTypes();
|
||||
|
||||
@@ -113,13 +112,13 @@ QList<Core::LocatorFilterEntry> CppLocatorFilter::matchesFor(
|
||||
}
|
||||
|
||||
if (matchInParameterList)
|
||||
entries[Normal].append(filterEntry);
|
||||
entries[int(MatchLevel::Normal)].append(filterEntry);
|
||||
else if (filterEntry.displayName.startsWith(entry, caseSensitivityForPrefix))
|
||||
entries[Best].append(filterEntry);
|
||||
entries[int(MatchLevel::Best)].append(filterEntry);
|
||||
else if (filterEntry.displayName.contains(entry, caseSensitivityForPrefix))
|
||||
entries[Better].append(filterEntry);
|
||||
entries[int(MatchLevel::Better)].append(filterEntry);
|
||||
else
|
||||
entries[Good].append(filterEntry);
|
||||
entries[int(MatchLevel::Good)].append(filterEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user