GenericProject: Use new setup pattern for ProjectFilesFactory

Change-Id: If5d64a8d6b09fbd3ceaea1736ce74ba2c837a456
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-11-20 15:18:28 +01:00
parent 181b362fcf
commit 96dcd41d41
3 changed files with 28 additions and 33 deletions

View File

@@ -6,21 +6,19 @@
#include <coreplugin/coreplugintr.h> #include <coreplugin/coreplugintr.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditoractionhandler.h>
#include <QCoreApplication> #include <texteditor/textdocument.h>
#include <texteditor/texteditor.h>
#include <texteditor/texteditoractionhandler.h>
using namespace TextEditor; using namespace TextEditor;
namespace GenericProjectManager { namespace GenericProjectManager::Internal {
namespace Internal {
// class ProjectFilesFactory : public TextEditorFactory
// ProjectFilesFactory {
// public:
ProjectFilesFactory()
ProjectFilesFactory::ProjectFilesFactory()
{ {
setId(Constants::FILES_EDITOR_ID); setId(Constants::FILES_EDITOR_ID);
setDisplayName(::Core::Tr::tr(".files Editor")); setDisplayName(::Core::Tr::tr(".files Editor"));
@@ -33,6 +31,11 @@ ProjectFilesFactory::ProjectFilesFactory()
setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); }); setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); });
setEditorActionHandlers(TextEditorActionHandler::None); setEditorActionHandlers(TextEditorActionHandler::None);
} }
};
} // namespace Internal void setupGenericProjectFiles()
} // namespace GenericProjectManager {
static ProjectFilesFactory theProjectFilesFactory;
}
} // GenericProjectManager::Internal

View File

@@ -3,16 +3,8 @@
#pragma once #pragma once
#include <texteditor/texteditor.h> namespace GenericProjectManager::Internal {
namespace GenericProjectManager { void setupGenericProjectFiles();
namespace Internal {
class ProjectFilesFactory : public TextEditor::TextEditorFactory } // GenericProjectManager::Internal
{
public:
ProjectFilesFactory();
};
} // namespace Internal
} // namespace GenericProjectManager

View File

@@ -35,7 +35,6 @@ class GenericProjectPluginPrivate : public QObject
public: public:
GenericProjectPluginPrivate(); GenericProjectPluginPrivate();
ProjectFilesFactory projectFilesFactory;
GenericMakeStepFactory makeStepFactory; GenericMakeStepFactory makeStepFactory;
GenericBuildConfigurationFactory buildConfigFactory; GenericBuildConfigurationFactory buildConfigFactory;
}; };
@@ -45,6 +44,7 @@ GenericProjectPluginPrivate::GenericProjectPluginPrivate()
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE); ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
setupGenericProjectWizard(); setupGenericProjectWizard();
setupGenericProjectFiles();
ActionBuilder editAction(this, "GenericProjectManager.EditFiles"); ActionBuilder editAction(this, "GenericProjectManager.EditFiles");
editAction.setContext(Constants::GENERICPROJECT_ID); editAction.setContext(Constants::GENERICPROJECT_ID);