ProjectExplorer: Use setup function for CurrentProjectFind

Change-Id: Ided76af53468a7dac9a6defd95585fb299670326
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-02-01 18:40:50 +01:00
parent 4718dd5225
commit c20c2a8c86
3 changed files with 36 additions and 34 deletions

View File

@@ -3,6 +3,7 @@
#include "currentprojectfind.h" #include "currentprojectfind.h"
#include "allprojectsfind.h"
#include "project.h" #include "project.h"
#include "projectexplorertr.h" #include "projectexplorertr.h"
#include "projectmanager.h" #include "projectmanager.h"
@@ -12,10 +13,32 @@
#include <utils/qtcsettings.h> #include <utils/qtcsettings.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using namespace TextEditor; using namespace TextEditor;
using namespace Utils; using namespace Utils;
namespace ProjectExplorer::Internal {
class CurrentProjectFind final : public AllProjectsFind
{
public:
CurrentProjectFind();
private:
QString id() const final;
QString displayName() const final;
bool isEnabled() const final;
void writeSettings(Utils::QtcSettings *settings) final;
void readSettings(Utils::QtcSettings *settings) final;
QString label() const final;
TextEditor::FileContainerProvider fileContainerProvider() const final;
void handleProjectChanged();
void setupSearch(Core::SearchResult *search) final;
};
CurrentProjectFind::CurrentProjectFind() CurrentProjectFind::CurrentProjectFind()
{ {
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged, connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
@@ -105,3 +128,10 @@ void CurrentProjectFind::readSettings(QtcSettings *settings)
readCommonSettings(settings, "*", ""); readCommonSettings(settings, "*", "");
settings->endGroup(); settings->endGroup();
} }
void setupCurrentProjectFind()
{
static CurrentProjectFind theCurrentProjectFind;
}
} // ProjectExplorer::Internal

View File

@@ -3,37 +3,8 @@
#pragma once #pragma once
#include "allprojectsfind.h" namespace ProjectExplorer::Internal {
namespace ProjectExplorer { void setupCurrentProjectFind();
class Project; } // ProjectExplorer::Internal
namespace Internal {
class CurrentProjectFind : public AllProjectsFind
{
Q_OBJECT
public:
CurrentProjectFind();
QString id() const override;
QString displayName() const override;
bool isEnabled() const override;
void writeSettings(Utils::QtcSettings *settings) override;
void readSettings(Utils::QtcSettings *settings) override;
protected:
QString label() const override;
private:
TextEditor::FileContainerProvider fileContainerProvider() const override;
void handleProjectChanged();
void setupSearch(Core::SearchResult *search) override;
};
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -690,7 +690,6 @@ public:
ProcessStepFactory m_processStepFactory; ProcessStepFactory m_processStepFactory;
AllProjectsFind m_allProjectsFind; AllProjectsFind m_allProjectsFind;
CurrentProjectFind m_curretProjectFind;
FilesInAllProjectsFind m_filesInAllProjectsFind; FilesInAllProjectsFind m_filesInAllProjectsFind;
CustomExecutableRunConfigurationFactory m_customExecutableRunConfigFactory; CustomExecutableRunConfigurationFactory m_customExecutableRunConfigFactory;
@@ -820,6 +819,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
setupProjectTreeWidgetFactory(); setupProjectTreeWidgetFactory();
setupCurrentProjectFind();
dd = new ProjectExplorerPluginPrivate; dd = new ProjectExplorerPluginPrivate;
setupSanitizerOutputParser(); setupSanitizerOutputParser();