Nim: Standardize Project classes setup

Change-Id: If95e98e406c1a9bacd75ccf3b58416185e6152a2
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-07-22 13:59:55 +02:00
parent 0982613a73
commit 750e9c3b6b
5 changed files with 13 additions and 24 deletions

View File

@@ -61,9 +61,6 @@ public:
NimCodeStyleSettingsPage codeStyleSettingsPage; NimCodeStyleSettingsPage codeStyleSettingsPage;
NimCodeStylePreferencesFactory codeStylePreferencesPage; NimCodeStylePreferencesFactory codeStylePreferencesPage;
NimToolchainFactory toolChainFactory; NimToolchainFactory toolChainFactory;
NimProjectFactory nimProjectFactory;
NimbleProjectFactory nimbleProjectFactory;
}; };
class NimPlugin final : public ExtensionSystem::IPlugin class NimPlugin final : public ExtensionSystem::IPlugin
@@ -80,6 +77,9 @@ class NimPlugin final : public ExtensionSystem::IPlugin
{ {
d = new NimPluginPrivate; d = new NimPluginPrivate;
setupNimProject();
setupNimbleProject();
#ifdef WITH_TESTS #ifdef WITH_TESTS
addTest<NimParserTest>(); addTest<NimParserTest>();
#endif #endif

View File

@@ -17,8 +17,8 @@ using namespace Utils;
namespace Nim { namespace Nim {
NimbleProject::NimbleProject(const Utils::FilePath &fileName) NimbleProject::NimbleProject(const FilePath &fileName)
: ProjectExplorer::Project(Constants::C_NIMBLE_MIMETYPE, fileName) : Project(Constants::C_NIMBLE_MIMETYPE, fileName)
{ {
setId(Constants::C_NIMBLEPROJECT_ID); setId(Constants::C_NIMBLEPROJECT_ID);
setDisplayName(fileName.completeBaseName()); setDisplayName(fileName.completeBaseName());
@@ -50,9 +50,9 @@ void NimbleProject::setExcludedFiles(const QStringList &excludedFiles)
m_excludedFiles = excludedFiles; m_excludedFiles = excludedFiles;
} }
// Factory // Setup
NimbleProjectFactory::NimbleProjectFactory() void setupNimbleProject()
{ {
ProjectManager::registerProjectType<NimbleProject>(Constants::C_NIMBLE_MIMETYPE); ProjectManager::registerProjectType<NimbleProject>(Constants::C_NIMBLE_MIMETYPE);
} }

View File

@@ -3,15 +3,12 @@
#pragma once #pragma once
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
namespace Nim { namespace Nim {
class NimbleProject : public ProjectExplorer::Project class NimbleProject final : public ProjectExplorer::Project
{ {
Q_OBJECT
public: public:
NimbleProject(const Utils::FilePath &filename); NimbleProject(const Utils::FilePath &filename);
@@ -28,10 +25,6 @@ protected:
QStringList m_excludedFiles; QStringList m_excludedFiles;
}; };
class NimbleProjectFactory void setupNimbleProject();
{
public:
NimbleProjectFactory();
};
} // Nim } // Nim

View File

@@ -19,7 +19,7 @@ using namespace Utils;
namespace Nim { namespace Nim {
class NimProject : public Project class NimProject final : public Project
{ {
public: public:
explicit NimProject(const FilePath &filePath); explicit NimProject(const FilePath &filePath);
@@ -86,9 +86,9 @@ void NimProject::setExcludedFiles(const QStringList &excludedFiles)
m_excludedFiles = excludedFiles; m_excludedFiles = excludedFiles;
} }
// Factory // Setup
NimProjectFactory::NimProjectFactory() void setupNimProject()
{ {
ProjectManager::registerProjectType<NimProject>(Constants::C_NIM_PROJECT_MIMETYPE); ProjectManager::registerProjectType<NimProject>(Constants::C_NIM_PROJECT_MIMETYPE);
} }

View File

@@ -5,10 +5,6 @@
namespace Nim { namespace Nim {
class NimProjectFactory void setupNimProject();
{
public:
NimProjectFactory();
};
} // Nim } // Nim