// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "pythonplugin.h" #include "pythonbuildconfiguration.h" #include "pythonconstants.h" #include "pythoneditor.h" #include "pythonkitaspect.h" #include "pythonproject.h" #include "pythonrunconfiguration.h" #include "pythonsettings.h" #include "pythontr.h" #include "pythonwizardpage.h" #include #include #include #include #include #include #include #include #include #include using namespace Debugger; using namespace ProjectExplorer; using namespace Utils; namespace Python::Internal { static QObject *m_instance = nullptr; QObject *pluginInstance() { return m_instance; } class PythonPluginPrivate { public: PythonOutputFormatterFactory outputFormatterFactory; PythonRunConfigurationFactory runConfigFactory; PySideBuildStepFactory buildStepFactory; PythonBuildConfigurationFactory buildConfigFactory; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; SimpleDebugRunnerFactory debugRunWorkerFactory{{runConfigFactory.runConfigurationId()}, {ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE}}; PythonSettings settings; PythonWizardPageFactory pythonWizardPageFactory; }; class PythonPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Python.json") public: PythonPlugin() { m_instance = this; } ~PythonPlugin() final { m_instance = nullptr; delete d; } private: void initialize() final { d = new PythonPluginPrivate; setupPythonEditorFactory(this); KitManager::setIrrelevantAspects(KitManager::irrelevantAspects() + QSet{PythonKitAspect::id()}); ProjectManager::registerProjectType(Constants::C_PY_PROJECT_MIME_TYPE); ProjectManager::registerProjectType(Constants::C_PY_PROJECT_MIME_TYPE_LEGACY); } void extensionsInitialized() final { // Add MIME overlay icons (these icons displayed at Project dock panel) const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro, ProjectExplorer::Constants::FILEOVERLAY_PY); FileIconProvider::registerIconOverlayForSuffix(imageFile, "py"); TaskHub::addCategory({PythonErrorTaskCategory, "Python", Tr::tr("Issues parsed from Python runtime output."), true}); } PythonPluginPrivate *d = nullptr; }; } // Python::Internal #include "pythonplugin.moc"