Pass id to RunConfiguration constructor

It's what the base class requires, and opens the possibility to
have several factories creating the same type of run configuration.

Also move ios, winrt and android factories closer to their products,
it's the predominant pattern nowadays.

Change-Id: Iad48152f02a248d22cb18dd435a2fc34d73c7077
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-04-25 10:26:08 +02:00
parent 4146a98599
commit 366be94ad9
49 changed files with 124 additions and 353 deletions

View File

@@ -75,7 +75,6 @@ using namespace Utils;
namespace PythonEditor {
namespace Internal {
const char PythonRunConfigurationPrefix[] = "PythonEditor.RunConfiguration.";
const char InterpreterKey[] = "PythonEditor.RunConfiguation.Interpreter";
const char MainScriptKey[] = "PythonEditor.RunConfiguation.MainScript";
const char PythonMimeType[] = "text/x-python-project"; // ### FIXME
@@ -235,7 +234,7 @@ class PythonRunConfiguration : public RunConfiguration
Q_PROPERTY(QString arguments READ arguments)
public:
explicit PythonRunConfiguration(Target *target);
PythonRunConfiguration(Target *target, Core::Id id);
QWidget *createConfigurationWidget() override;
QVariantMap toMap() const override;
@@ -250,8 +249,6 @@ public:
void setInterpreter(const QString &interpreter) { m_interpreter = interpreter; }
private:
friend class ProjectExplorer::RunConfigurationFactory;
QString defaultDisplayName() const;
QString m_interpreter;
@@ -260,8 +257,8 @@ private:
////////////////////////////////////////////////////////////////
PythonRunConfiguration::PythonRunConfiguration(Target *target)
: RunConfiguration(target, PythonRunConfigurationPrefix)
PythonRunConfiguration::PythonRunConfiguration(Target *target, Core::Id id)
: RunConfiguration(target, id)
{
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
@@ -351,7 +348,7 @@ class PythonRunConfigurationFactory : public RunConfigurationFactory
public:
PythonRunConfigurationFactory()
{
registerRunConfiguration<PythonRunConfiguration>(PythonRunConfigurationPrefix);
registerRunConfiguration<PythonRunConfiguration>("PythonEditor.RunConfiguration.");
addSupportedProjectType(PythonProjectId);
}
};