forked from qt-creator/qt-creator
Python: Use setup function for remaining plugin items
... and remove the now-empty plugin pimpl. Change-Id: I0db27757e832a0e3ac52b938a4d6ad820adfc195 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -40,13 +40,6 @@ QObject *pluginInstance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
class PythonPluginPrivate
|
||||
{
|
||||
public:
|
||||
PythonSettings settings;
|
||||
PythonWizardPageFactory pythonWizardPageFactory;
|
||||
};
|
||||
|
||||
class PythonPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -61,14 +54,11 @@ public:
|
||||
~PythonPlugin() final
|
||||
{
|
||||
m_instance = nullptr;
|
||||
delete d;
|
||||
}
|
||||
|
||||
private:
|
||||
void initialize() final
|
||||
{
|
||||
d = new PythonPluginPrivate;
|
||||
|
||||
setupPythonEditorFactory(this);
|
||||
|
||||
setupPySideBuildStep();
|
||||
@@ -79,6 +69,9 @@ private:
|
||||
setupPythonDebugWorker();
|
||||
setupPythonOutputParser();
|
||||
|
||||
setupPythonSettings(this);
|
||||
setupPythonWizard();
|
||||
|
||||
KitManager::setIrrelevantAspects(KitManager::irrelevantAspects()
|
||||
+ QSet<Id>{PythonKitAspect::id()});
|
||||
|
||||
@@ -98,8 +91,6 @@ private:
|
||||
Tr::tr("Issues parsed from Python runtime output."),
|
||||
true});
|
||||
}
|
||||
|
||||
PythonPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // Python::Internal
|
||||
|
@@ -1193,6 +1193,12 @@ Interpreter PythonSettings::interpreter(const QString &interpreterId)
|
||||
Utils::equal(&Interpreter::id, interpreterId));
|
||||
}
|
||||
|
||||
void setupPythonSettings(QObject *guard)
|
||||
{
|
||||
new PythonSettings; // Initializes settingsInstance
|
||||
settingsInstance->setParent(guard);
|
||||
}
|
||||
|
||||
} // Python::Internal
|
||||
|
||||
#include "pythonsettings.moc"
|
||||
|
@@ -71,4 +71,6 @@ private:
|
||||
static void saveSettings();
|
||||
};
|
||||
|
||||
void setupPythonSettings(QObject *guard);
|
||||
|
||||
} // Python::Internal
|
||||
|
@@ -10,26 +10,48 @@
|
||||
|
||||
#include <coreplugin/generatedfile.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <projectexplorer/jsonwizard/jsonwizard.h>
|
||||
#include <projectexplorer/jsonwizard/jsonwizardpagefactory.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/wizardpage.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Python::Internal {
|
||||
|
||||
PythonWizardPageFactory::PythonWizardPageFactory()
|
||||
class PythonWizardPage final : public WizardPage
|
||||
{
|
||||
public:
|
||||
PythonWizardPage(const QList<QPair<QString, QVariant>> &pySideAndData, int defaultPyside);
|
||||
bool validatePage() final;
|
||||
|
||||
private:
|
||||
SelectionAspect m_pySideVersion;
|
||||
};
|
||||
|
||||
class PythonWizardPageFactory final : public JsonWizardPageFactory
|
||||
{
|
||||
public:
|
||||
PythonWizardPageFactory()
|
||||
{
|
||||
setTypeIdsSuffix("PythonConfiguration");
|
||||
}
|
||||
|
||||
WizardPage *create(JsonWizard *wizard, Id typeId, const QVariant &data) final;
|
||||
bool validateData(Utils::Id typeId, const QVariant &data, QString *errorMessage) final;
|
||||
};
|
||||
|
||||
WizardPage *PythonWizardPageFactory::create(JsonWizard *wizard, Id typeId, const QVariant &data)
|
||||
{
|
||||
Q_UNUSED(wizard)
|
||||
@@ -110,5 +132,10 @@ bool PythonWizardPage::validatePage()
|
||||
return true;
|
||||
}
|
||||
|
||||
void setupPythonWizard()
|
||||
{
|
||||
static PythonWizardPageFactory thePythonWizardPageFactory;
|
||||
}
|
||||
|
||||
} // namespace Python::Internal
|
||||
|
||||
|
@@ -3,34 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/jsonwizard/jsonwizard.h>
|
||||
#include <projectexplorer/jsonwizard/jsonwizardpagefactory.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
|
||||
#include <utils/aspects.h>
|
||||
#include <utils/wizardpage.h>
|
||||
|
||||
namespace Python::Internal {
|
||||
|
||||
class PythonWizardPageFactory : public ProjectExplorer::JsonWizardPageFactory
|
||||
{
|
||||
public:
|
||||
PythonWizardPageFactory();
|
||||
|
||||
Utils::WizardPage *create(ProjectExplorer::JsonWizard *wizard,
|
||||
Utils::Id typeId,
|
||||
const QVariant &data) override;
|
||||
bool validateData(Utils::Id typeId, const QVariant &data, QString *errorMessage) override;
|
||||
};
|
||||
|
||||
class PythonWizardPage : public Utils::WizardPage
|
||||
{
|
||||
public:
|
||||
PythonWizardPage(const QList<QPair<QString, QVariant>> &pySideAndData, const int defaultPyside);
|
||||
bool validatePage() override;
|
||||
|
||||
private:
|
||||
Utils::SelectionAspect m_pySideVersion;
|
||||
};
|
||||
void setupPythonWizard();
|
||||
|
||||
} // namespace Python::Internal
|
||||
|
Reference in New Issue
Block a user