CMake: Rename CMakeLocatorFilter to CMakeTargetLocatorFilter

Make virtual function implementations final while touching the file.

Change-Id: I94c44ee3efbc9beb39789dd198ee607791a9a44d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2019-07-24 13:44:17 +02:00
parent 69b3d90683
commit efc89ff60d
3 changed files with 20 additions and 14 deletions

View File

@@ -41,7 +41,11 @@ using namespace CMakeProjectManager::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
CMakeLocatorFilter::CMakeLocatorFilter() // --------------------------------------------------------------------
// CMakeTargetLocatorFilter:
// --------------------------------------------------------------------
CMakeTargetLocatorFilter::CMakeTargetLocatorFilter()
{ {
setId("Build CMake target"); setId("Build CMake target");
setDisplayName(tr("Build CMake target")); setDisplayName(tr("Build CMake target"));
@@ -49,15 +53,15 @@ CMakeLocatorFilter::CMakeLocatorFilter()
setPriority(High); setPriority(High);
connect(SessionManager::instance(), &SessionManager::projectAdded, connect(SessionManager::instance(), &SessionManager::projectAdded,
this, &CMakeLocatorFilter::projectListUpdated); this, &CMakeTargetLocatorFilter::projectListUpdated);
connect(SessionManager::instance(), &SessionManager::projectRemoved, connect(SessionManager::instance(), &SessionManager::projectRemoved,
this, &CMakeLocatorFilter::projectListUpdated); this, &CMakeTargetLocatorFilter::projectListUpdated);
// Initialize the filter // Initialize the filter
projectListUpdated(); projectListUpdated();
} }
void CMakeLocatorFilter::prepareSearch(const QString &entry) void CMakeTargetLocatorFilter::prepareSearch(const QString &entry)
{ {
m_result.clear(); m_result.clear();
const QList<Project *> projects = SessionManager::projects(); const QList<Project *> projects = SessionManager::projects();
@@ -78,14 +82,14 @@ void CMakeLocatorFilter::prepareSearch(const QString &entry)
} }
} }
QList<Core::LocatorFilterEntry> CMakeLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry) QList<Core::LocatorFilterEntry> CMakeTargetLocatorFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry)
{ {
Q_UNUSED(future) Q_UNUSED(future)
Q_UNUSED(entry) Q_UNUSED(entry)
return m_result; return m_result;
} }
void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection, void CMakeTargetLocatorFilter::accept(Core::LocatorFilterEntry selection,
QString *newText, int *selectionStart, int *selectionLength) const QString *newText, int *selectionStart, int *selectionLength) const
{ {
Q_UNUSED(newText) Q_UNUSED(newText)
@@ -116,12 +120,12 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection,
buildStep->setBuildTarget(oldTarget); buildStep->setBuildTarget(oldTarget);
} }
void CMakeLocatorFilter::refresh(QFutureInterface<void> &future) void CMakeTargetLocatorFilter::refresh(QFutureInterface<void> &future)
{ {
Q_UNUSED(future) Q_UNUSED(future)
} }
void CMakeLocatorFilter::projectListUpdated() void CMakeTargetLocatorFilter::projectListUpdated()
{ {
// Enable the filter if there's at least one CMake project // Enable the filter if there's at least one CMake project
setEnabled(Utils::contains(SessionManager::projects(), [](Project *p) { return qobject_cast<CMakeProject *>(p); })); setEnabled(Utils::contains(SessionManager::projects(), [](Project *p) { return qobject_cast<CMakeProject *>(p); }));

View File

@@ -30,19 +30,21 @@
namespace CMakeProjectManager { namespace CMakeProjectManager {
namespace Internal { namespace Internal {
class CMakeLocatorFilter : public Core::ILocatorFilter class CMakeTargetLocatorFilter : public Core::ILocatorFilter
{ {
Q_OBJECT Q_OBJECT
public: public:
CMakeLocatorFilter(); CMakeTargetLocatorFilter();
void prepareSearch(const QString &entry) override; void prepareSearch(const QString &entry) override;
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
const QString &entry) override; const QString &entry) final;
void accept(Core::LocatorFilterEntry selection, void accept(Core::LocatorFilterEntry selection,
QString *newText, int *selectionStart, int *selectionLength) const override; QString *newText,
void refresh(QFutureInterface<void> &future) override; int *selectionStart,
int *selectionLength) const final;
void refresh(QFutureInterface<void> &future) final;
private: private:
void projectListUpdated(); void projectListUpdated();

View File

@@ -75,7 +75,7 @@ public:
SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration> runWorkerFactory; SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration> runWorkerFactory;
CMakeBuildConfigurationFactory buildConfigFactory; CMakeBuildConfigurationFactory buildConfigFactory;
CMakeEditorFactory editorFactor; CMakeEditorFactory editorFactor;
CMakeLocatorFilter locatorFiler; CMakeTargetLocatorFilter locatorFiler;
CMakeKitAspect cmakeKitAspect; CMakeKitAspect cmakeKitAspect;
CMakeGeneratorKitAspect cmakeGeneratorKitAspect; CMakeGeneratorKitAspect cmakeGeneratorKitAspect;