forked from qt-creator/qt-creator
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -31,20 +31,21 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlprojectmanagerconstants.h"
|
||||
#include "qmlproject.h"
|
||||
#include "qmlprojectrunconfiguration.h"
|
||||
#include "qmlprojectrunconfigurationfactory.h"
|
||||
#include "qmlprojecttarget.h"
|
||||
|
||||
#include <projectexplorer/profileinformation.h>
|
||||
#include <projectexplorer/projectconfiguration.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
namespace QmlProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::IRunConfigurationFactory(parent)
|
||||
{
|
||||
}
|
||||
{ setObjectName(QLatin1String("QmlProjectRunConfigurationFactory")); }
|
||||
|
||||
QmlProjectRunConfigurationFactory::~QmlProjectRunConfigurationFactory()
|
||||
{
|
||||
@@ -52,7 +53,7 @@ QmlProjectRunConfigurationFactory::~QmlProjectRunConfigurationFactory()
|
||||
|
||||
QList<Core::Id> QmlProjectRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!qobject_cast<QmlProjectTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return QList<Core::Id>();
|
||||
return QList<Core::Id>() << Core::Id(Constants::QML_RC_ID);
|
||||
}
|
||||
@@ -66,7 +67,7 @@ QString QmlProjectRunConfigurationFactory::displayNameForId(const Core::Id id) c
|
||||
|
||||
bool QmlProjectRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
|
||||
{
|
||||
if (!qobject_cast<QmlProjectTarget *>(parent))
|
||||
if (!canHandle(parent))
|
||||
return false;
|
||||
return id == Core::Id(Constants::QML_RC_ID);
|
||||
}
|
||||
@@ -75,8 +76,7 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::create(Pro
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
|
||||
return new QmlProjectRunConfiguration(qmlparent);
|
||||
return new QmlProjectRunConfiguration(parent);
|
||||
}
|
||||
|
||||
bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
@@ -88,8 +88,7 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::restore(Pr
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
|
||||
QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(qmlparent);
|
||||
QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(parent);
|
||||
if (rc->fromMap(map))
|
||||
return rc;
|
||||
delete rc;
|
||||
@@ -106,8 +105,17 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::clone(Proj
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
QmlProjectTarget *qmlparent = static_cast<QmlProjectTarget *>(parent);
|
||||
return new QmlProjectRunConfiguration(qmlparent, qobject_cast<QmlProjectRunConfiguration *>(source));
|
||||
return new QmlProjectRunConfiguration(parent, qobject_cast<QmlProjectRunConfiguration *>(source));
|
||||
}
|
||||
|
||||
bool QmlProjectRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||
{
|
||||
if (!parent->project()->supportsProfile(parent->profile()))
|
||||
return false;
|
||||
if (!qobject_cast<QmlProject *>(parent->project()))
|
||||
return false;
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(parent->profile());
|
||||
return deviceType == Core::Id(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user