forked from qt-creator/qt-creator
ILocatorFilter: Remove prepareSearch() and matchesFor()
Implement matchers() instead. Make matchers() a pure virtual method. Change-Id: I931cb9a5787bc796968cd2123e14d33002169588 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -592,23 +592,6 @@ QString ILocatorFilter::shortcutString() const
|
|||||||
return m_shortcut;
|
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.
|
Sets the refresh recipe for refreshing cached data.
|
||||||
*/
|
*/
|
||||||
@@ -1112,22 +1095,6 @@ bool ILocatorFilter::isOldSetting(const QByteArray &state)
|
|||||||
return !doc.isObject();
|
return !doc.isObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QList<Core::LocatorFilterEntry> Core::ILocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &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
|
\enum Core::ILocatorFilter::Priority
|
||||||
|
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include <utils/link.h>
|
#include <utils/link.h>
|
||||||
#include <utils/tasktree.h>
|
#include <utils/tasktree.h>
|
||||||
|
|
||||||
#include <QFutureInterface>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class QPromise;
|
class QFuture;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -227,11 +226,6 @@ public:
|
|||||||
std::optional<QString> defaultSearchText() const;
|
std::optional<QString> defaultSearchText() const;
|
||||||
void setDefaultSearchText(const QString &defaultSearchText);
|
void setDefaultSearchText(const QString &defaultSearchText);
|
||||||
|
|
||||||
virtual void prepareSearch(const QString &entry);
|
|
||||||
|
|
||||||
virtual QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &,
|
|
||||||
const QString &) { return {}; };
|
|
||||||
|
|
||||||
virtual QByteArray saveState() const;
|
virtual QByteArray saveState() const;
|
||||||
virtual void restoreState(const QByteArray &state);
|
virtual void restoreState(const QByteArray &state);
|
||||||
|
|
||||||
@@ -281,8 +275,7 @@ protected:
|
|||||||
static bool isOldSetting(const QByteArray &state);
|
static bool isOldSetting(const QByteArray &state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO: Make pure virtual when all subclasses implement it.
|
virtual LocatorMatcherTasks matchers() = 0;
|
||||||
virtual LocatorMatcherTasks matchers() { return {}; }
|
|
||||||
|
|
||||||
friend class Internal::Locator;
|
friend class Internal::Locator;
|
||||||
friend class Internal::LocatorWidget;
|
friend class Internal::LocatorWidget;
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include <cppeditor/indexitem.h>
|
#include <cppeditor/indexitem.h>
|
||||||
#include <cppeditor/searchsymbols.h>
|
#include <cppeditor/searchsymbols.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/locator/ilocatorfilter.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
Reference in New Issue
Block a user