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;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PythonPluginPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PythonSettings settings;
|
|
||||||
PythonWizardPageFactory pythonWizardPageFactory;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PythonPlugin final : public ExtensionSystem::IPlugin
|
class PythonPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -61,14 +54,11 @@ public:
|
|||||||
~PythonPlugin() final
|
~PythonPlugin() final
|
||||||
{
|
{
|
||||||
m_instance = nullptr;
|
m_instance = nullptr;
|
||||||
delete d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize() final
|
void initialize() final
|
||||||
{
|
{
|
||||||
d = new PythonPluginPrivate;
|
|
||||||
|
|
||||||
setupPythonEditorFactory(this);
|
setupPythonEditorFactory(this);
|
||||||
|
|
||||||
setupPySideBuildStep();
|
setupPySideBuildStep();
|
||||||
@@ -79,6 +69,9 @@ private:
|
|||||||
setupPythonDebugWorker();
|
setupPythonDebugWorker();
|
||||||
setupPythonOutputParser();
|
setupPythonOutputParser();
|
||||||
|
|
||||||
|
setupPythonSettings(this);
|
||||||
|
setupPythonWizard();
|
||||||
|
|
||||||
KitManager::setIrrelevantAspects(KitManager::irrelevantAspects()
|
KitManager::setIrrelevantAspects(KitManager::irrelevantAspects()
|
||||||
+ QSet<Id>{PythonKitAspect::id()});
|
+ QSet<Id>{PythonKitAspect::id()});
|
||||||
|
|
||||||
@@ -98,8 +91,6 @@ private:
|
|||||||
Tr::tr("Issues parsed from Python runtime output."),
|
Tr::tr("Issues parsed from Python runtime output."),
|
||||||
true});
|
true});
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonPluginPrivate *d = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
@@ -1193,6 +1193,12 @@ Interpreter PythonSettings::interpreter(const QString &interpreterId)
|
|||||||
Utils::equal(&Interpreter::id, interpreterId));
|
Utils::equal(&Interpreter::id, interpreterId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupPythonSettings(QObject *guard)
|
||||||
|
{
|
||||||
|
new PythonSettings; // Initializes settingsInstance
|
||||||
|
settingsInstance->setParent(guard);
|
||||||
|
}
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
|
||||||
#include "pythonsettings.moc"
|
#include "pythonsettings.moc"
|
||||||
|
@@ -71,4 +71,6 @@ private:
|
|||||||
static void saveSettings();
|
static void saveSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setupPythonSettings(QObject *guard);
|
||||||
|
|
||||||
} // Python::Internal
|
} // Python::Internal
|
||||||
|
@@ -10,26 +10,48 @@
|
|||||||
|
|
||||||
#include <coreplugin/generatedfile.h>
|
#include <coreplugin/generatedfile.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <projectexplorer/jsonwizard/jsonwizard.h>
|
||||||
#include <utils/layoutbuilder.h>
|
#include <projectexplorer/jsonwizard/jsonwizardpagefactory.h>
|
||||||
#include <utils/mimeutils.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectmanager.h>
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
#include <projectexplorer/target.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 ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Python::Internal {
|
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");
|
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)
|
WizardPage *PythonWizardPageFactory::create(JsonWizard *wizard, Id typeId, const QVariant &data)
|
||||||
{
|
{
|
||||||
Q_UNUSED(wizard)
|
Q_UNUSED(wizard)
|
||||||
@@ -110,5 +132,10 @@ bool PythonWizardPage::validatePage()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupPythonWizard()
|
||||||
|
{
|
||||||
|
static PythonWizardPageFactory thePythonWizardPageFactory;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Python::Internal
|
} // namespace Python::Internal
|
||||||
|
|
||||||
|
@@ -3,34 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#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 {
|
namespace Python::Internal {
|
||||||
|
|
||||||
class PythonWizardPageFactory : public ProjectExplorer::JsonWizardPageFactory
|
void setupPythonWizard();
|
||||||
{
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Python::Internal
|
} // namespace Python::Internal
|
||||||
|
Reference in New Issue
Block a user