forked from qt-creator/qt-creator
Python: Move plugin class definition to .cpp
The plugin classes partially changed there purpose, they are no more meant to provide internal utility functionality. Change-Id: I9b9200995eaa95dcd924c94dcedb28e6d5db0be9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -221,7 +221,7 @@ QFuture<PipPackageInfo> Pip::info(const PipPackage &package)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pip::Pip(const Utils::FilePath &python)
|
Pip::Pip(const Utils::FilePath &python)
|
||||||
: QObject(PythonPlugin::instance())
|
: QObject(pluginInstance())
|
||||||
, m_python(python)
|
, m_python(python)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ QString PySideInstaller::importedPySide(const QString &text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PySideInstaller::PySideInstaller()
|
PySideInstaller::PySideInstaller()
|
||||||
: QObject(PythonPlugin::instance())
|
: QObject(pluginInstance())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void PySideInstaller::installPyside(const FilePath &python,
|
void PySideInstaller::installPyside(const FilePath &python,
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ PyLSClient *PyLSClient::clientForPython(const FilePath &python)
|
|||||||
|
|
||||||
PyLSConfigureAssistant *PyLSConfigureAssistant::instance()
|
PyLSConfigureAssistant *PyLSConfigureAssistant::instance()
|
||||||
{
|
{
|
||||||
static auto *instance = new PyLSConfigureAssistant(PythonPlugin::instance());
|
static auto *instance = new PyLSConfigureAssistant(pluginInstance());
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include "pythontr.h"
|
#include "pythontr.h"
|
||||||
#include "pythonwizardpage.h"
|
#include "pythonwizardpage.h"
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildtargetinfo.h>
|
#include <projectexplorer/buildtargetinfo.h>
|
||||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
@@ -28,7 +30,12 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Python::Internal {
|
namespace Python::Internal {
|
||||||
|
|
||||||
static PythonPlugin *m_instance = nullptr;
|
static QObject *m_instance = nullptr;
|
||||||
|
|
||||||
|
QObject *pluginInstance()
|
||||||
|
{
|
||||||
|
return m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
class PythonPluginPrivate
|
class PythonPluginPrivate
|
||||||
{
|
{
|
||||||
@@ -43,23 +50,25 @@ public:
|
|||||||
PythonWizardPageFactory pythonWizardPageFactory;
|
PythonWizardPageFactory pythonWizardPageFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
PythonPlugin::PythonPlugin()
|
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;
|
m_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonPlugin::~PythonPlugin()
|
~PythonPlugin() final
|
||||||
{
|
{
|
||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonPlugin *PythonPlugin::instance()
|
private:
|
||||||
{
|
void initialize() final
|
||||||
return m_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PythonPlugin::initialize()
|
|
||||||
{
|
{
|
||||||
d = new PythonPluginPrivate;
|
d = new PythonPluginPrivate;
|
||||||
|
|
||||||
@@ -70,7 +79,7 @@ void PythonPlugin::initialize()
|
|||||||
ProjectManager::registerProjectType<PythonProject>(Constants::C_PY_PROJECT_MIME_TYPE_LEGACY);
|
ProjectManager::registerProjectType<PythonProject>(Constants::C_PY_PROJECT_MIME_TYPE_LEGACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonPlugin::extensionsInitialized()
|
void extensionsInitialized() final
|
||||||
{
|
{
|
||||||
// Add MIME overlay icons (these icons displayed at Project dock panel)
|
// Add MIME overlay icons (these icons displayed at Project dock panel)
|
||||||
const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro,
|
const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro,
|
||||||
@@ -83,4 +92,9 @@ void PythonPlugin::extensionsInitialized()
|
|||||||
true});
|
true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PythonPluginPrivate *d = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
|
||||||
|
#include "pythonplugin.moc"
|
||||||
|
|||||||
@@ -3,28 +3,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <QObject>
|
||||||
|
|
||||||
namespace Python::Internal {
|
namespace Python::Internal {
|
||||||
|
|
||||||
class PythonBuildConfigurationFactory;
|
QObject *pluginInstance();
|
||||||
|
|
||||||
class PythonPlugin final : public ExtensionSystem::IPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Python.json")
|
|
||||||
|
|
||||||
public:
|
|
||||||
PythonPlugin();
|
|
||||||
~PythonPlugin() final;
|
|
||||||
|
|
||||||
static PythonPlugin *instance();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void initialize() final;
|
|
||||||
void extensionsInitialized() final;
|
|
||||||
|
|
||||||
class PythonPluginPrivate *d = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
|||||||
@@ -642,7 +642,7 @@ static void disableOutdatedPyls()
|
|||||||
disableOutdatedPylsNow();
|
disableOutdatedPylsNow();
|
||||||
} else {
|
} else {
|
||||||
QObject::connect(PluginManager::instance(), &PluginManager::initializationDone,
|
QObject::connect(PluginManager::instance(), &PluginManager::initializationDone,
|
||||||
PythonPlugin::instance(), &disableOutdatedPylsNow);
|
pluginInstance(), &disableOutdatedPylsNow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user