From 23f7352834c1e0c6fb6440766dbb16341ce01ae8 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 25 Apr 2023 09:48:03 +0200 Subject: [PATCH] ILocatorFilter: Remove prepareSearch() and matchesFor() Implement matchers() instead. Make matchers() a pure virtual method. Change-Id: I931cb9a5787bc796968cd2123e14d33002169588 Reviewed-by: Eike Ziller --- .../coreplugin/locator/ilocatorfilter.cpp | 33 ------------------- .../coreplugin/locator/ilocatorfilter.h | 11 ++----- src/plugins/modeleditor/elementtasks.cpp | 1 - 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index 45ae41c8fdd..1a08792382b 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -592,23 +592,6 @@ QString ILocatorFilter::shortcutString() const return m_shortcut; } -/*! - Performs actions that need to be done in the main thread before actually - running the search for \a entry. - - Called on the main thread before matchesFor() is called in a separate - thread. - - The default implementation does nothing. - - \sa matchesFor() -*/ -void ILocatorFilter::prepareSearch(const QString &entry) -{ - Q_UNUSED(entry) -} - - /*! Sets the refresh recipe for refreshing cached data. */ @@ -1112,22 +1095,6 @@ bool ILocatorFilter::isOldSetting(const QByteArray &state) return !doc.isObject(); } -/*! - \fn QList Core::ILocatorFilter::matchesFor(QFutureInterface &future, const QString &entry) - - Returns the list of results of this filter for the search term \a entry. - This is run in a separate thread, but is guaranteed to only run in a single - thread at any given time. Quickly running preparations can be done in the - GUI thread in prepareSearch(). - - Implementations should do a case sensitive or case insensitive search - depending on caseSensitivity(). If \a future is \c canceled, the search - should be aborted. - - \sa prepareSearch() - \sa caseSensitivity() -*/ - /*! \enum Core::ILocatorFilter::Priority diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h index fb70648967e..8a8114743ce 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.h +++ b/src/plugins/coreplugin/locator/ilocatorfilter.h @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -18,7 +17,7 @@ QT_BEGIN_NAMESPACE template -class QPromise; +class QFuture; QT_END_NAMESPACE namespace Core { @@ -227,11 +226,6 @@ public: std::optional defaultSearchText() const; void setDefaultSearchText(const QString &defaultSearchText); - virtual void prepareSearch(const QString &entry); - - virtual QList matchesFor(QFutureInterface &, - const QString &) { return {}; }; - virtual QByteArray saveState() const; virtual void restoreState(const QByteArray &state); @@ -281,8 +275,7 @@ protected: static bool isOldSetting(const QByteArray &state); private: - // TODO: Make pure virtual when all subclasses implement it. - virtual LocatorMatcherTasks matchers() { return {}; } + virtual LocatorMatcherTasks matchers() = 0; friend class Internal::Locator; friend class Internal::LocatorWidget; diff --git a/src/plugins/modeleditor/elementtasks.cpp b/src/plugins/modeleditor/elementtasks.cpp index d54cc2e6c84..6413686f61d 100644 --- a/src/plugins/modeleditor/elementtasks.cpp +++ b/src/plugins/modeleditor/elementtasks.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include