forked from qt-creator/qt-creator
ProjectExplorer: Use ids in RunConfigFactory:: setSupportedProjectType
More similar to what build/deploy uses. Change-Id: Icf8bd7031d00a6e2831f8c1f3b1bdcaa8bf259b4 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -238,7 +238,7 @@ CMakeRunConfigurationFactory::CMakeRunConfigurationFactory(QObject *parent) :
|
|||||||
{
|
{
|
||||||
setObjectName("CMakeRunConfigurationFactory");
|
setObjectName("CMakeRunConfigurationFactory");
|
||||||
registerRunConfiguration<CMakeRunConfiguration>(CMAKE_RC_PREFIX);
|
registerRunConfiguration<CMakeRunConfiguration>(CMAKE_RC_PREFIX);
|
||||||
setSupportedProjectType<CMakeProject>();
|
addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> CMakeRunConfigurationFactory::availableBuildTargets(Target *parent, CreationMode) const
|
QList<QString> CMakeRunConfigurationFactory::availableBuildTargets(Target *parent, CreationMode) const
|
||||||
|
|||||||
@@ -30,11 +30,11 @@
|
|||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <qmakeprojectmanager/qmakenodes.h>
|
#include <qmakeprojectmanager/qmakenodes.h>
|
||||||
#include <qmakeprojectmanager/qmakeproject.h>
|
#include <qmakeprojectmanager/qmakeproject.h>
|
||||||
|
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace QmakeProjectManager;
|
using namespace QmakeProjectManager;
|
||||||
@@ -48,7 +48,7 @@ IosRunConfigurationFactory::IosRunConfigurationFactory(QObject *parent)
|
|||||||
setObjectName("IosRunConfigurationFactory");
|
setObjectName("IosRunConfigurationFactory");
|
||||||
registerRunConfiguration<IosRunConfiguration>(Constants::IOS_RC_ID_PREFIX);
|
registerRunConfiguration<IosRunConfiguration>(Constants::IOS_RC_ID_PREFIX);
|
||||||
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
|
setSupportedTargetDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
|
||||||
setSupportedProjectType<QmakeProject>();
|
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
bool IosRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Nim {
|
|||||||
NimRunConfigurationFactory::NimRunConfigurationFactory()
|
NimRunConfigurationFactory::NimRunConfigurationFactory()
|
||||||
{
|
{
|
||||||
registerRunConfiguration<NimRunConfiguration>(Constants::C_NIMRUNCONFIGURATION_ID);
|
registerRunConfiguration<NimRunConfiguration>(Constants::C_NIMRUNCONFIGURATION_ID);
|
||||||
setSupportedProjectType<NimProject>();
|
addSupportedProjectType(Constants::C_NIMPROJECT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> NimRunConfigurationFactory::availableBuildTargets(Target *, CreationMode) const
|
QList<QString> NimRunConfigurationFactory::availableBuildTargets(Target *, CreationMode) const
|
||||||
|
|||||||
@@ -475,17 +475,26 @@ void IRunConfigurationFactory::setSupportedTargetDeviceTypes(const QList<Core::I
|
|||||||
m_supportedTargetDeviceTypes = ids;
|
m_supportedTargetDeviceTypes = ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IRunConfigurationFactory::addSupportedProjectType(Core::Id id)
|
||||||
|
{
|
||||||
|
m_supportedProjectTypes.append(id);
|
||||||
|
}
|
||||||
|
|
||||||
bool IRunConfigurationFactory::canHandle(Target *target) const
|
bool IRunConfigurationFactory::canHandle(Target *target) const
|
||||||
{
|
{
|
||||||
if (m_projectTypeChecker && !m_projectTypeChecker(target->project()))
|
const Project *project = target->project();
|
||||||
|
Kit *kit = target->kit();
|
||||||
|
|
||||||
|
if (!project->supportsKit(kit))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!target->project()->supportsKit(target->kit()))
|
if (!m_supportedProjectTypes.isEmpty())
|
||||||
return false;
|
if (!m_supportedProjectTypes.contains(project->id()))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!m_supportedTargetDeviceTypes.isEmpty())
|
if (!m_supportedTargetDeviceTypes.isEmpty())
|
||||||
if (!m_supportedTargetDeviceTypes.contains(
|
if (!m_supportedTargetDeviceTypes.contains(
|
||||||
DeviceTypeKitInformation::deviceTypeId(target->kit())))
|
DeviceTypeKitInformation::deviceTypeId(kit)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -334,20 +334,13 @@ protected:
|
|||||||
m_runConfigBaseId = runConfigBaseId;
|
m_runConfigBaseId = runConfigBaseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
using ProjectTypeChecker = std::function<bool(Project *)>;
|
void addSupportedProjectType(Core::Id id);
|
||||||
|
|
||||||
template <class ProjectType>
|
|
||||||
void setSupportedProjectType()
|
|
||||||
{
|
|
||||||
m_projectTypeChecker = [](Project *p) { return qobject_cast<ProjectType *>(p) != nullptr; };
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
void setSupportedTargetDeviceTypes(const QList<Core::Id> &ids);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RunConfigurationCreator m_creator;
|
RunConfigurationCreator m_creator;
|
||||||
Core::Id m_runConfigBaseId;
|
Core::Id m_runConfigBaseId;
|
||||||
ProjectTypeChecker m_projectTypeChecker;
|
QList<Core::Id> m_supportedProjectTypes;
|
||||||
QList<Core::Id> m_supportedTargetDeviceTypes;
|
QList<Core::Id> m_supportedTargetDeviceTypes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ public:
|
|||||||
{
|
{
|
||||||
setObjectName("PythonRunConfigurationFactory");
|
setObjectName("PythonRunConfigurationFactory");
|
||||||
registerRunConfiguration<PythonRunConfiguration>(PythonRunConfigurationPrefix);
|
registerRunConfiguration<PythonRunConfiguration>(PythonRunConfigurationPrefix);
|
||||||
setSupportedProjectType<PythonProject>();
|
addSupportedProjectType(PythonProjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> availableBuildTargets(Target *parent, CreationMode mode) const override
|
QList<QString> availableBuildTargets(Target *parent, CreationMode mode) const override
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "qbsrunconfiguration.h"
|
#include "qbsrunconfiguration.h"
|
||||||
|
|
||||||
|
#include "qbsprojectmanagerconstants.h"
|
||||||
#include "qbsdeployconfigurationfactory.h"
|
#include "qbsdeployconfigurationfactory.h"
|
||||||
#include "qbsinstallstep.h"
|
#include "qbsinstallstep.h"
|
||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
@@ -352,8 +353,8 @@ QbsRunConfigurationFactory::QbsRunConfigurationFactory(QObject *parent) :
|
|||||||
{
|
{
|
||||||
setObjectName("QbsRunConfigurationFactory");
|
setObjectName("QbsRunConfigurationFactory");
|
||||||
registerRunConfiguration<QbsRunConfiguration>(QBS_RC_PREFIX);
|
registerRunConfiguration<QbsRunConfiguration>(QBS_RC_PREFIX);
|
||||||
setSupportedProjectType<QbsProject>();
|
addSupportedProjectType(Constants::PROJECT_ID);
|
||||||
setSupportedTargetDeviceTypes({Constants::DESKTOP_DEVICE_TYPE});
|
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
bool QbsRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
||||||
|
|||||||
@@ -31,9 +31,11 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <debugger/debuggerconstants.h>
|
|
||||||
#include <qmakeprojectmanager/qmakeproject.h>
|
|
||||||
#include <qmakeprojectmanager/qmakenodes.h>
|
#include <qmakeprojectmanager/qmakenodes.h>
|
||||||
|
#include <qmakeprojectmanager/qmakeproject.h>
|
||||||
|
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||||
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject
|
|||||||
: IRunConfigurationFactory(parent)
|
: IRunConfigurationFactory(parent)
|
||||||
{
|
{
|
||||||
registerRunConfiguration<QmakeAndroidRunConfiguration>(ANDROID_RC_ID_PREFIX);
|
registerRunConfiguration<QmakeAndroidRunConfiguration>(ANDROID_RC_ID_PREFIX);
|
||||||
setSupportedProjectType<QmakeProject>();
|
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeAndroidRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
QString QmakeAndroidRunConfigurationFactory::displayNameForBuildTarget(const QString &buildTarget) const
|
||||||
|
|||||||
@@ -25,9 +25,10 @@
|
|||||||
|
|
||||||
#include "desktopqmakerunconfiguration.h"
|
#include "desktopqmakerunconfiguration.h"
|
||||||
|
|
||||||
|
#include "qmakebuildconfiguration.h"
|
||||||
#include "qmakenodes.h"
|
#include "qmakenodes.h"
|
||||||
#include "qmakeproject.h"
|
#include "qmakeproject.h"
|
||||||
#include "qmakebuildconfiguration.h"
|
#include "qmakeprojectmanagerconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/variablechooser.h>
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <projectexplorer/localenvironmentaspect.h>
|
#include <projectexplorer/localenvironmentaspect.h>
|
||||||
@@ -441,8 +442,8 @@ DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory(QObject
|
|||||||
{
|
{
|
||||||
setObjectName("DesktopQmakeRunConfigurationFactory");
|
setObjectName("DesktopQmakeRunConfigurationFactory");
|
||||||
registerRunConfiguration<DesktopQmakeRunConfiguration>(QMAKE_RC_PREFIX);
|
registerRunConfiguration<DesktopQmakeRunConfiguration>(QMAKE_RC_PREFIX);
|
||||||
setSupportedProjectType<QmakeProject>();
|
addSupportedProjectType(QmakeProjectManager::Constants::PROJECT_ID);
|
||||||
setSupportedTargetDeviceTypes({Constants::DESKTOP_DEVICE_TYPE});
|
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
bool DesktopQmakeRunConfigurationFactory::canCreateHelper(Target *parent, const QString &buildTarget) const
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "fileformat/qmlprojectitem.h"
|
#include "fileformat/qmlprojectitem.h"
|
||||||
#include "qmlprojectrunconfiguration.h"
|
#include "qmlprojectrunconfiguration.h"
|
||||||
#include "qmlprojectconstants.h"
|
#include "qmlprojectconstants.h"
|
||||||
|
#include "qmlprojectmanagerconstants.h"
|
||||||
#include "qmlprojectnodes.h"
|
#include "qmlprojectnodes.h"
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
@@ -57,7 +58,7 @@ QmlProject::QmlProject(const Utils::FileName &fileName) :
|
|||||||
Project(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName,
|
Project(QString::fromLatin1(Constants::QMLPROJECT_MIMETYPE), fileName,
|
||||||
[this]() { refreshProjectFile(); })
|
[this]() { refreshProjectFile(); })
|
||||||
{
|
{
|
||||||
setId("QmlProjectManager.QmlProject");
|
setId(QmlProjectManager::Constants::QML_PROJECT_ID);
|
||||||
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
||||||
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
|
setProjectLanguages(Context(ProjectExplorer::Constants::QMLJS_LANGUAGE_ID));
|
||||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
setDisplayName(fileName.toFileInfo().completeBaseName());
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
|
const char QML_PROJECT_ID[] = "QmlProjectManager.QmlProject";
|
||||||
const char QML_SCENE_RC_ID[] = "QmlProjectManager.QmlRunConfiguration.QmlScene";
|
const char QML_SCENE_RC_ID[] = "QmlProjectManager.QmlRunConfiguration.QmlScene";
|
||||||
const char QML_VIEWER_ARGUMENTS_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments";
|
const char QML_VIEWER_ARGUMENTS_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments";
|
||||||
const char QML_VIEWER_TARGET_DISPLAY_NAME[] = "QML Viewer";
|
const char QML_VIEWER_TARGET_DISPLAY_NAME[] = "QML Viewer";
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory(QObject *pa
|
|||||||
{
|
{
|
||||||
setObjectName("QmlProjectRunConfigurationFactory");
|
setObjectName("QmlProjectRunConfigurationFactory");
|
||||||
registerRunConfiguration<QmlProjectRunConfiguration>(Constants::QML_SCENE_RC_ID);
|
registerRunConfiguration<QmlProjectRunConfiguration>(Constants::QML_SCENE_RC_ID);
|
||||||
setSupportedProjectType<QmlProject>();
|
addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
|
||||||
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
setSupportedTargetDeviceTypes({ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,11 @@
|
|||||||
#include "winrtruncontrol.h"
|
#include "winrtruncontrol.h"
|
||||||
#include "winrtconstants.h"
|
#include "winrtconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/kit.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <qmakeprojectmanager/qmakeproject.h>
|
#include <qmakeprojectmanager/qmakeproject.h>
|
||||||
|
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using QmakeProjectManager::QmakeProject;
|
using QmakeProjectManager::QmakeProject;
|
||||||
@@ -44,7 +44,7 @@ namespace Internal {
|
|||||||
WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
|
WinRtRunConfigurationFactory::WinRtRunConfigurationFactory()
|
||||||
{
|
{
|
||||||
registerRunConfiguration<WinRtRunConfiguration>(Constants::WINRT_RC_PREFIX);
|
registerRunConfiguration<WinRtRunConfiguration>(Constants::WINRT_RC_PREFIX);
|
||||||
setSupportedProjectType<QmakeProject>();
|
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||||
setSupportedTargetDeviceTypes({Constants::WINRT_DEVICE_TYPE_LOCAL,
|
setSupportedTargetDeviceTypes({Constants::WINRT_DEVICE_TYPE_LOCAL,
|
||||||
Constants::WINRT_DEVICE_TYPE_PHONE,
|
Constants::WINRT_DEVICE_TYPE_PHONE,
|
||||||
Constants::WINRT_DEVICE_TYPE_EMULATOR});
|
Constants::WINRT_DEVICE_TYPE_EMULATOR});
|
||||||
|
|||||||
Reference in New Issue
Block a user