diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2019-08-15 09:30:50 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2019-08-15 09:57:46 +0000 |
commit | 3b41b9b24be08f08106dd820614988b1ac426d82 (patch) | |
tree | 5d9f7253279fda8ee4d8fafba6c581e1326e9426 /src/plugins/cpptools/cpplocatorfilter.cpp | |
parent | 847108d4f44c9d940162166b14e59f38ff99d54f (diff) |
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>
Diffstat (limited to 'src/plugins/cpptools/cpplocatorfilter.cpp')
-rw-r--r-- | src/plugins/cpptools/cpplocatorfilter.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 5ae84c08ac2..bfc93c7e531 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -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); } } |