aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-11-27 12:29:14 +0100
committerEike Ziller <eike.ziller@qt.io>2017-11-27 12:34:01 +0000
commit6ee714619f6cdd95098c98e86c840ee56b2f07f4 (patch)
tree5a6496f7bf9c25ac270af05c1fb6ef068542ba1d
parent01c0fa565f95d75ea2745f246a17dc0e15dc7175 (diff)
Adapt to upstream API changes for run configuration factories
Change-Id: Ifc984f3eff16d109923db33f87906c49765f7864 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--plugins/haskell/haskellproject.cpp6
-rw-r--r--plugins/haskell/haskellproject.h2
-rw-r--r--plugins/haskell/haskellrunconfiguration.cpp57
-rw-r--r--plugins/haskell/haskellrunconfiguration.h15
4 files changed, 14 insertions, 66 deletions
diff --git a/plugins/haskell/haskellproject.cpp b/plugins/haskell/haskellproject.cpp
index 96855ee..420ea9e 100644
--- a/plugins/haskell/haskellproject.cpp
+++ b/plugins/haskell/haskellproject.cpp
@@ -86,11 +86,9 @@ HaskellProject *HaskellProject::toHaskellProject(Project *project)
return nullptr;
}
-QList<Core::Id> HaskellProject::availableRunConfigurationIds() const
+QList<QString> HaskellProject::availableExecutables() const
{
- return Utils::transform<QList>(parseExecutableNames(projectFilePath()), [](const QString &exe) {
- return Core::Id(Constants::C_HASKELL_RUNCONFIG_ID_PREFIX).withSuffix(exe);
- });
+ return parseExecutableNames(projectFilePath()).toList();
}
void HaskellProject::updateFiles()
diff --git a/plugins/haskell/haskellproject.h b/plugins/haskell/haskellproject.h
index cc6e308..e3019d2 100644
--- a/plugins/haskell/haskellproject.h
+++ b/plugins/haskell/haskellproject.h
@@ -47,7 +47,7 @@ public:
static bool isHaskellProject(Project *project);
static HaskellProject *toHaskellProject(Project *project);
- QList<Core::Id> availableRunConfigurationIds() const;
+ QList<QString> availableExecutables() const;
private:
void updateFiles();
diff --git a/plugins/haskell/haskellrunconfiguration.cpp b/plugins/haskell/haskellrunconfiguration.cpp
index dfeee7e..9e7b6ff 100644
--- a/plugins/haskell/haskellrunconfiguration.cpp
+++ b/plugins/haskell/haskellrunconfiguration.cpp
@@ -31,6 +31,7 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/localenvironmentaspect.h>
+#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h>
@@ -43,57 +44,19 @@ using namespace ProjectExplorer;
namespace Haskell {
namespace Internal {
-HaskellRunConfigurationFactory::HaskellRunConfigurationFactory() {}
-
-QList<Core::Id> HaskellRunConfigurationFactory::availableCreationIds(
- Target *parent,
- IRunConfigurationFactory::CreationMode mode) const
-{
- Q_UNUSED(mode)
- const auto project = HaskellProject::toHaskellProject(parent->project());
- if (project)
- return project->availableRunConfigurationIds();
- return {};
-}
-
-QString HaskellRunConfigurationFactory::displayNameForId(Core::Id id) const
-{
- return id.suffixAfter(Constants::C_HASKELL_RUNCONFIG_ID_PREFIX);
-}
-
-bool HaskellRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
-{
- return id.name().startsWith(Constants::C_HASKELL_RUNCONFIG_ID_PREFIX)
- && HaskellProject::isHaskellProject(parent->project());
-}
-
-bool HaskellRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
+HaskellRunConfigurationFactory::HaskellRunConfigurationFactory()
{
- return canCreate(parent, idFromMap(map));
+ registerRunConfiguration<HaskellRunConfiguration>(Constants::C_HASKELL_RUNCONFIG_ID_PREFIX);
+ setSupportedProjectType<HaskellProject>();
+ setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
}
-bool HaskellRunConfigurationFactory::canClone(Target *parent, RunConfiguration *product) const
+QList<QString> HaskellRunConfigurationFactory::availableBuildTargets(
+ Target *parent, IRunConfigurationFactory::CreationMode mode) const
{
- return canCreate(parent, product->id());
-}
-
-RunConfiguration *HaskellRunConfigurationFactory::clone(Target *parent, RunConfiguration *product)
-{
- return cloneHelper<HaskellRunConfiguration>(parent, product);
-}
-
-RunConfiguration *HaskellRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
-{
- QTC_ASSERT(canCreate(parent, id), return nullptr);
- return createHelper<HaskellRunConfiguration>(parent, id);
-}
-
-RunConfiguration *HaskellRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
-{
- QTC_ASSERT(canRestore(parent, map), return nullptr);
- auto config = doCreate(parent, idFromMap(map));
- config->fromMap(map);
- return config;
+ Q_UNUSED(mode)
+ const auto project = HaskellProject::toHaskellProject(parent->project());
+ return project ? project->availableExecutables() : QList<QString>();
}
HaskellRunConfiguration::HaskellRunConfiguration(Target *parent)
diff --git a/plugins/haskell/haskellrunconfiguration.h b/plugins/haskell/haskellrunconfiguration.h
index 44edfe6..e40a9cc 100644
--- a/plugins/haskell/haskellrunconfiguration.h
+++ b/plugins/haskell/haskellrunconfiguration.h
@@ -37,21 +37,8 @@ class HaskellRunConfigurationFactory : public ProjectExplorer::IRunConfiguration
public:
HaskellRunConfigurationFactory();
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent,
+ QList<QString> availableBuildTargets(ProjectExplorer::Target *parent,
CreationMode mode) const override;
- QString displayNameForId(Core::Id id) const override;
- bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
- bool canClone(ProjectExplorer::Target *parent,
- ProjectExplorer::RunConfiguration *product) const override;
- ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
- ProjectExplorer::RunConfiguration *product) override;
-
-private:
- ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent,
- Core::Id id) override;
- ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
- const QVariantMap &map) override;
};
class HaskellRunConfiguration : public ProjectExplorer::RunConfiguration