forked from qt-creator/qt-creator
ProjectExplorer: Remove ProjectConfiguration base from Target
Targets are different from {Run,Build,Deployment}Configurations,
both regarding the level in the ProjectExplorer hierarchy, and
also by the set of supported operations (e.g. aspects).
Change-Id: Ia8490e2280a9ecc518395c5e48ce2fd5d6d58fd2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -456,6 +456,10 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
|
|||||||
if (pc && pc->isActive())
|
if (pc && pc->isActive())
|
||||||
updateDetails();
|
updateDetails();
|
||||||
});
|
});
|
||||||
|
connect(m_buildStep->project(), &Project::activeTargetChanged, this, [this](Target *target) {
|
||||||
|
if (target && target->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildStepConfigWidget::toolArgumentsEdited()
|
void CMakeBuildStepConfigWidget::toolArgumentsEdited()
|
||||||
|
|||||||
@@ -129,6 +129,10 @@ public:
|
|||||||
if (pc && pc->isActive())
|
if (pc && pc->isActive())
|
||||||
updateDetails();
|
updateDetails();
|
||||||
});
|
});
|
||||||
|
connect(pro, &Project::activeTargetChanged, this, [this](Target *target) {
|
||||||
|
if (target && target->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -255,6 +255,10 @@ IosDsymBuildStepConfigWidget::IosDsymBuildStepConfigWidget(IosDsymBuildStep *bui
|
|||||||
if (pc && pc->isActive())
|
if (pc && pc->isActive())
|
||||||
updateDetails();
|
updateDetails();
|
||||||
});
|
});
|
||||||
|
connect(pro, &Project::activeTargetChanged, this, [this](Target *target) {
|
||||||
|
if (target && target->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDsymBuildStepConfigWidget::~IosDsymBuildStepConfigWidget()
|
IosDsymBuildStepConfigWidget::~IosDsymBuildStepConfigWidget()
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ private:
|
|||||||
Kit(const Kit &other);
|
Kit(const Kit &other);
|
||||||
void operator=(const Kit &other);
|
void operator=(const Kit &other);
|
||||||
|
|
||||||
void kitDisplayNameChanged();
|
|
||||||
void kitUpdated();
|
void kitUpdated();
|
||||||
|
|
||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
|
|||||||
@@ -434,6 +434,10 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
|||||||
updateDetails();
|
updateDetails();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(pro, &Project::activeTargetChanged, this, [this](Target *target) {
|
||||||
|
if (target && target->isActive())
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
|
|
||||||
Core::VariableChooser::addSupportForChildWidgets(this, m_makeStep->macroExpander());
|
Core::VariableChooser::addSupportForChildWidgets(this, m_makeStep->macroExpander());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,27 @@ static bool projectLesserThan(Project *p1, Project *p2)
|
|||||||
return p1 < p2;
|
return p1 < p2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString displayNameFor(QObject *object)
|
||||||
|
{
|
||||||
|
if (auto t = qobject_cast<Target *>(object))
|
||||||
|
return t->displayName();
|
||||||
|
if (auto pc = qobject_cast<ProjectConfiguration *>(object))
|
||||||
|
return pc->displayName();
|
||||||
|
QTC_CHECK(false);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString toolTipFor(QObject *object)
|
||||||
|
{
|
||||||
|
if (auto t = qobject_cast<Target *>(object))
|
||||||
|
return t->toolTip();
|
||||||
|
if (auto pc = qobject_cast<ProjectConfiguration *>(object))
|
||||||
|
return pc->toolTip();
|
||||||
|
QTC_CHECK(false);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// TargetSelectorDelegate
|
// TargetSelectorDelegate
|
||||||
////////
|
////////
|
||||||
@@ -407,22 +428,27 @@ GenericListWidget::GenericListWidget(QWidget *parent)
|
|||||||
this, &GenericListWidget::rowChanged);
|
this, &GenericListWidget::rowChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericListWidget::setProjectConfigurations(const QList<ProjectConfiguration *> &list, ProjectConfiguration *active)
|
void GenericListWidget::setProjectConfigurations(const QList<QObject *> &list, QObject *active)
|
||||||
{
|
{
|
||||||
m_ignoreIndexChange = true;
|
m_ignoreIndexChange = true;
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
|
auto obj = objectAt(i);
|
||||||
disconnect(p, &ProjectConfiguration::displayNameChanged,
|
if (auto t = qobject_cast<Target *>(obj)) {
|
||||||
|
disconnect(t, &Target::kitChanged,
|
||||||
this, &GenericListWidget::displayNameChanged);
|
this, &GenericListWidget::displayNameChanged);
|
||||||
|
} else if (auto pc = qobject_cast<ProjectConfiguration *>(obj)) {
|
||||||
|
disconnect(pc, &ProjectConfiguration::displayNameChanged,
|
||||||
|
this, &GenericListWidget::displayNameChanged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontMetrics fn(font());
|
QFontMetrics fn(font());
|
||||||
int width = 0;
|
int width = 0;
|
||||||
foreach (ProjectConfiguration *pc, list) {
|
for (QObject *pc : list) {
|
||||||
addProjectConfiguration(pc);
|
addProjectConfiguration(pc);
|
||||||
width = qMax(width, fn.horizontalAdvance(pc->displayName()) + padding());
|
width = qMax(width, fn.horizontalAdvance(displayNameFor(pc)) + padding());
|
||||||
}
|
}
|
||||||
setOptimalWidth(width);
|
setOptimalWidth(width);
|
||||||
setActiveProjectConfiguration(active);
|
setActiveProjectConfiguration(active);
|
||||||
@@ -430,57 +456,77 @@ void GenericListWidget::setProjectConfigurations(const QList<ProjectConfiguratio
|
|||||||
m_ignoreIndexChange = false;
|
m_ignoreIndexChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericListWidget::setActiveProjectConfiguration(ProjectConfiguration *active)
|
QObject *GenericListWidget::objectAt(int row) const
|
||||||
|
{
|
||||||
|
return item(row)->data(Qt::UserRole).value<QObject *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GenericListWidget::setActiveProjectConfiguration(QObject *active)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = itemForProjectConfiguration(active);
|
QListWidgetItem *item = itemForProjectConfiguration(active);
|
||||||
setCurrentItem(item);
|
setCurrentItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericListWidget::addProjectConfiguration(ProjectConfiguration *pc)
|
void GenericListWidget::addProjectConfiguration(QObject *obj)
|
||||||
{
|
{
|
||||||
|
const QString displayName = displayNameFor(obj);
|
||||||
|
const QString toolTip = toolTipFor(obj);
|
||||||
|
|
||||||
m_ignoreIndexChange = true;
|
m_ignoreIndexChange = true;
|
||||||
auto lwi = new QListWidgetItem();
|
auto lwi = new QListWidgetItem();
|
||||||
lwi->setText(pc->displayName());
|
lwi->setText(displayName);
|
||||||
lwi->setData(Qt::ToolTipRole, pc->toolTip());
|
lwi->setData(Qt::ToolTipRole, toolTip);
|
||||||
lwi->setData(Qt::UserRole + 1, pc->toolTip());
|
lwi->setData(Qt::UserRole + 1, toolTip);
|
||||||
lwi->setData(Qt::UserRole, QVariant::fromValue(pc));
|
lwi->setData(Qt::UserRole, QVariant::fromValue(obj));
|
||||||
|
|
||||||
// Figure out pos
|
// Figure out pos
|
||||||
int pos = count();
|
int pos = count();
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
|
QObject *p = objectAt(i);
|
||||||
if (caseFriendlyCompare(pc->displayName(), p->displayName()) < 0) {
|
if (caseFriendlyCompare(displayName, displayNameFor(p)) < 0) {
|
||||||
pos = i;
|
pos = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
insertItem(pos, lwi);
|
insertItem(pos, lwi);
|
||||||
|
|
||||||
|
if (auto t = qobject_cast<Target *>(obj)) {
|
||||||
|
connect(t, &Target::kitChanged, this,
|
||||||
|
&GenericListWidget::displayNameChanged);
|
||||||
|
connect(t, &Target::kitChanged, this,
|
||||||
|
&GenericListWidget::toolTipChanged);
|
||||||
|
} else if (auto pc = qobject_cast<ProjectConfiguration *>(obj)) {
|
||||||
connect(pc, &ProjectConfiguration::displayNameChanged,
|
connect(pc, &ProjectConfiguration::displayNameChanged,
|
||||||
this, &GenericListWidget::displayNameChanged);
|
this, &GenericListWidget::displayNameChanged);
|
||||||
connect(pc, &ProjectConfiguration::toolTipChanged, this, &GenericListWidget::toolTipChanged);
|
connect(pc, &ProjectConfiguration::toolTipChanged,
|
||||||
|
this, &GenericListWidget::toolTipChanged);
|
||||||
|
}
|
||||||
|
|
||||||
QFontMetrics fn(font());
|
QFontMetrics fn(font());
|
||||||
int width = fn.horizontalAdvance(pc->displayName()) + padding();
|
int width = fn.horizontalAdvance(displayName) + padding();
|
||||||
if (width > optimalWidth())
|
if (width > optimalWidth())
|
||||||
setOptimalWidth(width);
|
setOptimalWidth(width);
|
||||||
|
|
||||||
m_ignoreIndexChange = false;
|
m_ignoreIndexChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericListWidget::removeProjectConfiguration(ProjectConfiguration *pc)
|
void GenericListWidget::removeProjectConfiguration(QObject *obj)
|
||||||
{
|
{
|
||||||
m_ignoreIndexChange = true;
|
m_ignoreIndexChange = true;
|
||||||
|
if (auto t = qobject_cast<Target *>(obj)) {
|
||||||
|
disconnect(t, &Target::kitChanged,
|
||||||
|
this, &GenericListWidget::displayNameChanged);
|
||||||
|
} else if (auto pc = qobject_cast<ProjectConfiguration *>(obj)) {
|
||||||
disconnect(pc, &ProjectConfiguration::displayNameChanged,
|
disconnect(pc, &ProjectConfiguration::displayNameChanged,
|
||||||
this, &GenericListWidget::displayNameChanged);
|
this, &GenericListWidget::displayNameChanged);
|
||||||
delete itemForProjectConfiguration(pc);
|
}
|
||||||
|
delete itemForProjectConfiguration(obj);
|
||||||
|
|
||||||
QFontMetrics fn(font());
|
QFontMetrics fn(font());
|
||||||
int width = 0;
|
int width = 0;
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i)
|
||||||
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
|
width = qMax(width, fn.horizontalAdvance(displayNameFor(objectAt(i))) + padding());
|
||||||
width = qMax(width, fn.horizontalAdvance(p->displayName()) + padding());
|
|
||||||
}
|
|
||||||
setOptimalWidth(width);
|
setOptimalWidth(width);
|
||||||
|
|
||||||
m_ignoreIndexChange = false;
|
m_ignoreIndexChange = false;
|
||||||
@@ -492,15 +538,15 @@ void GenericListWidget::rowChanged(int index)
|
|||||||
return;
|
return;
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
emit changeActiveProjectConfiguration(item(index)->data(Qt::UserRole).value<ProjectConfiguration *>());
|
emit changeActiveProjectConfiguration(objectAt(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericListWidget::displayNameChanged()
|
void GenericListWidget::displayNameChanged()
|
||||||
{
|
{
|
||||||
m_ignoreIndexChange = true;
|
m_ignoreIndexChange = true;
|
||||||
ProjectConfiguration *activeProjectConfiguration = nullptr;
|
QObject *activeObject = nullptr;
|
||||||
if (currentItem())
|
if (currentItem())
|
||||||
activeProjectConfiguration = currentItem()->data(Qt::UserRole).value<ProjectConfiguration *>();
|
activeObject = currentItem()->data(Qt::UserRole).value<QObject *>();
|
||||||
|
|
||||||
auto *pc = qobject_cast<ProjectConfiguration *>(sender());
|
auto *pc = qobject_cast<ProjectConfiguration *>(sender());
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@@ -518,22 +564,20 @@ void GenericListWidget::displayNameChanged()
|
|||||||
lwi->setText(pc->displayName());
|
lwi->setText(pc->displayName());
|
||||||
int pos = count();
|
int pos = count();
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
|
if (caseFriendlyCompare(displayNameFor(pc), displayNameFor(objectAt(i))) < 0) {
|
||||||
if (caseFriendlyCompare(pc->displayName(), p->displayName()) < 0) {
|
|
||||||
pos = i;
|
pos = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
insertItem(pos, lwi);
|
insertItem(pos, lwi);
|
||||||
if (activeProjectConfiguration)
|
if (activeObject)
|
||||||
setCurrentItem(itemForProjectConfiguration(activeProjectConfiguration));
|
setCurrentItem(itemForProjectConfiguration(activeObject));
|
||||||
|
|
||||||
QFontMetrics fn(font());
|
QFontMetrics fn(font());
|
||||||
int width = 0;
|
int width = 0;
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i)
|
||||||
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
|
width = qMax(width, fn.horizontalAdvance(displayNameFor(objectAt(i))) + padding());
|
||||||
width = qMax(width, fn.horizontalAdvance(p->displayName()) + padding());
|
|
||||||
}
|
|
||||||
setOptimalWidth(width);
|
setOptimalWidth(width);
|
||||||
|
|
||||||
m_ignoreIndexChange = false;
|
m_ignoreIndexChange = false;
|
||||||
@@ -548,11 +592,11 @@ void GenericListWidget::toolTipChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QListWidgetItem *GenericListWidget::itemForProjectConfiguration(ProjectConfiguration *pc)
|
QListWidgetItem *GenericListWidget::itemForProjectConfiguration(QObject *pc)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
QListWidgetItem *lwi = item(i);
|
QListWidgetItem *lwi = item(i);
|
||||||
if (lwi->data(Qt::UserRole).value<ProjectConfiguration *>() == pc)
|
if (lwi->data(Qt::UserRole).value<QObject *>() == pc)
|
||||||
return lwi;
|
return lwi;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -725,21 +769,21 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
|
|||||||
this, &MiniProjectTargetSelector::kitChanged);
|
this, &MiniProjectTargetSelector::kitChanged);
|
||||||
|
|
||||||
connect(m_listWidgets[TARGET], &GenericListWidget::changeActiveProjectConfiguration,
|
connect(m_listWidgets[TARGET], &GenericListWidget::changeActiveProjectConfiguration,
|
||||||
this, [this](ProjectConfiguration *pc) {
|
this, [this](QObject *pc) {
|
||||||
SessionManager::setActiveTarget(m_project, static_cast<Target *>(pc), SetActive::Cascade);
|
SessionManager::setActiveTarget(m_project, static_cast<Target *>(pc), SetActive::Cascade);
|
||||||
});
|
});
|
||||||
connect(m_listWidgets[BUILD], &GenericListWidget::changeActiveProjectConfiguration,
|
connect(m_listWidgets[BUILD], &GenericListWidget::changeActiveProjectConfiguration,
|
||||||
this, [this](ProjectConfiguration *pc) {
|
this, [this](QObject *pc) {
|
||||||
SessionManager::setActiveBuildConfiguration(m_project->activeTarget(),
|
SessionManager::setActiveBuildConfiguration(m_project->activeTarget(),
|
||||||
static_cast<BuildConfiguration *>(pc), SetActive::Cascade);
|
static_cast<BuildConfiguration *>(pc), SetActive::Cascade);
|
||||||
});
|
});
|
||||||
connect(m_listWidgets[DEPLOY], &GenericListWidget::changeActiveProjectConfiguration,
|
connect(m_listWidgets[DEPLOY], &GenericListWidget::changeActiveProjectConfiguration,
|
||||||
this, [this](ProjectConfiguration *pc) {
|
this, [this](QObject *pc) {
|
||||||
SessionManager::setActiveDeployConfiguration(m_project->activeTarget(),
|
SessionManager::setActiveDeployConfiguration(m_project->activeTarget(),
|
||||||
static_cast<DeployConfiguration *>(pc), SetActive::Cascade);
|
static_cast<DeployConfiguration *>(pc), SetActive::Cascade);
|
||||||
});
|
});
|
||||||
connect(m_listWidgets[RUN], &GenericListWidget::changeActiveProjectConfiguration,
|
connect(m_listWidgets[RUN], &GenericListWidget::changeActiveProjectConfiguration,
|
||||||
this, [this](ProjectConfiguration *pc) {
|
this, [this](QObject *pc) {
|
||||||
m_project->activeTarget()->setActiveRunConfiguration(static_cast<RunConfiguration *>(pc));
|
m_project->activeTarget()->setActiveRunConfiguration(static_cast<RunConfiguration *>(pc));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -979,9 +1023,13 @@ void MiniProjectTargetSelector::projectAdded(Project *project)
|
|||||||
{
|
{
|
||||||
connect(project, &Project::addedProjectConfiguration,
|
connect(project, &Project::addedProjectConfiguration,
|
||||||
this, &MiniProjectTargetSelector::handleNewProjectConfiguration);
|
this, &MiniProjectTargetSelector::handleNewProjectConfiguration);
|
||||||
|
connect(project, &Project::addedTarget,
|
||||||
|
this, &MiniProjectTargetSelector::handleNewTarget);
|
||||||
|
|
||||||
connect(project, &Project::removedProjectConfiguration,
|
connect(project, &Project::removedProjectConfiguration,
|
||||||
this, &MiniProjectTargetSelector::handleRemovalOfProjectConfiguration);
|
this, &MiniProjectTargetSelector::handleRemovalOfProjectConfiguration);
|
||||||
|
connect(project, &Project::removedTarget,
|
||||||
|
this, &MiniProjectTargetSelector::handleRemovalOfTarget);
|
||||||
|
|
||||||
foreach (Target *t, project->targets())
|
foreach (Target *t, project->targets())
|
||||||
addedTarget(t);
|
addedTarget(t);
|
||||||
@@ -997,9 +1045,13 @@ void MiniProjectTargetSelector::projectRemoved(Project *project)
|
|||||||
{
|
{
|
||||||
disconnect(project, &Project::addedProjectConfiguration,
|
disconnect(project, &Project::addedProjectConfiguration,
|
||||||
this, &MiniProjectTargetSelector::handleNewProjectConfiguration);
|
this, &MiniProjectTargetSelector::handleNewProjectConfiguration);
|
||||||
|
disconnect(project, &Project::addedTarget,
|
||||||
|
this, &MiniProjectTargetSelector::handleNewTarget);
|
||||||
|
|
||||||
disconnect(project, &Project::removedProjectConfiguration,
|
disconnect(project, &Project::removedProjectConfiguration,
|
||||||
this, &MiniProjectTargetSelector::handleRemovalOfProjectConfiguration);
|
this, &MiniProjectTargetSelector::handleRemovalOfProjectConfiguration);
|
||||||
|
disconnect(project, &Project::removedTarget,
|
||||||
|
this, &MiniProjectTargetSelector::handleRemovalOfTarget);
|
||||||
|
|
||||||
foreach (Target *t, project->targets())
|
foreach (Target *t, project->targets())
|
||||||
removedTarget(t);
|
removedTarget(t);
|
||||||
@@ -1011,16 +1063,17 @@ void MiniProjectTargetSelector::projectRemoved(Project *project)
|
|||||||
updateRunListVisible();
|
updateRunListVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniProjectTargetSelector::handleNewProjectConfiguration(ProjectConfiguration *pc)
|
void MiniProjectTargetSelector::handleNewTarget(Target *target)
|
||||||
{
|
{
|
||||||
if (auto t = qobject_cast<Target *>(pc)) {
|
addedTarget(target);
|
||||||
addedTarget(t);
|
|
||||||
updateTargetListVisible();
|
updateTargetListVisible();
|
||||||
updateBuildListVisible();
|
updateBuildListVisible();
|
||||||
updateDeployListVisible();
|
updateDeployListVisible();
|
||||||
updateRunListVisible();
|
updateRunListVisible();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MiniProjectTargetSelector::handleNewProjectConfiguration(ProjectConfiguration *pc)
|
||||||
|
{
|
||||||
if (auto bc = qobject_cast<BuildConfiguration *>(pc)) {
|
if (auto bc = qobject_cast<BuildConfiguration *>(pc)) {
|
||||||
if (addedBuildConfiguration(bc))
|
if (addedBuildConfiguration(bc))
|
||||||
updateBuildListVisible();
|
updateBuildListVisible();
|
||||||
@@ -1038,17 +1091,18 @@ void MiniProjectTargetSelector::handleNewProjectConfiguration(ProjectConfigurati
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniProjectTargetSelector::handleRemovalOfProjectConfiguration(ProjectConfiguration *pc)
|
void MiniProjectTargetSelector::handleRemovalOfTarget(Target *target)
|
||||||
{
|
{
|
||||||
if (auto t = qobject_cast<Target *>(pc)) {
|
removedTarget(target);
|
||||||
removedTarget(t);
|
|
||||||
|
|
||||||
updateTargetListVisible();
|
updateTargetListVisible();
|
||||||
updateBuildListVisible();
|
updateBuildListVisible();
|
||||||
updateDeployListVisible();
|
updateDeployListVisible();
|
||||||
updateRunListVisible();
|
updateRunListVisible();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MiniProjectTargetSelector::handleRemovalOfProjectConfiguration(ProjectConfiguration *pc)
|
||||||
|
{
|
||||||
if (auto bc = qobject_cast<BuildConfiguration *>(pc)) {
|
if (auto bc = qobject_cast<BuildConfiguration *>(pc)) {
|
||||||
if (removedBuildConfiguration(bc))
|
if (removedBuildConfiguration(bc))
|
||||||
updateBuildListVisible();
|
updateBuildListVisible();
|
||||||
@@ -1232,12 +1286,12 @@ void MiniProjectTargetSelector::changeStartupProject(Project *project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (project) {
|
if (project) {
|
||||||
QList<ProjectConfiguration *> list;
|
QList<QObject *> list;
|
||||||
foreach (Target *t, project->targets())
|
foreach (Target *t, project->targets())
|
||||||
list.append(t);
|
list.append(t);
|
||||||
m_listWidgets[TARGET]->setProjectConfigurations(list, project->activeTarget());
|
m_listWidgets[TARGET]->setProjectConfigurations(list, project->activeTarget());
|
||||||
} else {
|
} else {
|
||||||
m_listWidgets[TARGET]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr);
|
m_listWidgets[TARGET]->setProjectConfigurations(QList<QObject *>(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateActionAndSummary();
|
updateActionAndSummary();
|
||||||
@@ -1246,9 +1300,7 @@ void MiniProjectTargetSelector::changeStartupProject(Project *project)
|
|||||||
void MiniProjectTargetSelector::activeTargetChanged(Target *target)
|
void MiniProjectTargetSelector::activeTargetChanged(Target *target)
|
||||||
{
|
{
|
||||||
if (m_target) {
|
if (m_target) {
|
||||||
disconnect(m_target, &ProjectConfiguration::displayNameChanged,
|
disconnect(m_target, &Target::kitChanged,
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
|
||||||
disconnect(m_target, &Target::toolTipChanged,
|
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
disconnect(m_target, &Target::iconChanged,
|
disconnect(m_target, &Target::iconChanged,
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
@@ -1278,17 +1330,17 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target)
|
|||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
|
|
||||||
if (m_target) {
|
if (m_target) {
|
||||||
QList<ProjectConfiguration *> bl;
|
QList<QObject *> bl;
|
||||||
foreach (BuildConfiguration *bc, target->buildConfigurations())
|
foreach (BuildConfiguration *bc, target->buildConfigurations())
|
||||||
bl.append(bc);
|
bl.append(bc);
|
||||||
m_listWidgets[BUILD]->setProjectConfigurations(bl, target->activeBuildConfiguration());
|
m_listWidgets[BUILD]->setProjectConfigurations(bl, target->activeBuildConfiguration());
|
||||||
|
|
||||||
QList<ProjectConfiguration *> dl;
|
QList<QObject *> dl;
|
||||||
foreach (DeployConfiguration *dc, target->deployConfigurations())
|
foreach (DeployConfiguration *dc, target->deployConfigurations())
|
||||||
dl.append(dc);
|
dl.append(dc);
|
||||||
m_listWidgets[DEPLOY]->setProjectConfigurations(dl, target->activeDeployConfiguration());
|
m_listWidgets[DEPLOY]->setProjectConfigurations(dl, target->activeDeployConfiguration());
|
||||||
|
|
||||||
QList<ProjectConfiguration *> rl;
|
QList<QObject *> rl;
|
||||||
foreach (RunConfiguration *rc, target->runConfigurations())
|
foreach (RunConfiguration *rc, target->runConfigurations())
|
||||||
rl.append(rc);
|
rl.append(rc);
|
||||||
m_listWidgets[RUN]->setProjectConfigurations(rl, target->activeRunConfiguration());
|
m_listWidgets[RUN]->setProjectConfigurations(rl, target->activeRunConfiguration());
|
||||||
@@ -1306,9 +1358,7 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target)
|
|||||||
connect(m_runConfiguration, &ProjectConfiguration::displayNameChanged,
|
connect(m_runConfiguration, &ProjectConfiguration::displayNameChanged,
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
|
|
||||||
connect(m_target, &ProjectConfiguration::displayNameChanged,
|
connect(m_target, &Target::kitChanged,
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
|
||||||
connect(m_target, &Target::toolTipChanged,
|
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
connect(m_target, &Target::iconChanged,
|
connect(m_target, &Target::iconChanged,
|
||||||
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
this, &MiniProjectTargetSelector::updateActionAndSummary);
|
||||||
@@ -1319,9 +1369,9 @@ void MiniProjectTargetSelector::activeTargetChanged(Target *target)
|
|||||||
connect(m_target, &Target::activeRunConfigurationChanged,
|
connect(m_target, &Target::activeRunConfigurationChanged,
|
||||||
this, &MiniProjectTargetSelector::activeRunConfigurationChanged);
|
this, &MiniProjectTargetSelector::activeRunConfigurationChanged);
|
||||||
} else {
|
} else {
|
||||||
m_listWidgets[BUILD]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr);
|
m_listWidgets[BUILD]->setProjectConfigurations(QList<QObject *>(), nullptr);
|
||||||
m_listWidgets[DEPLOY]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr);
|
m_listWidgets[DEPLOY]->setProjectConfigurations(QList<QObject *>(), nullptr);
|
||||||
m_listWidgets[RUN]->setProjectConfigurations(QList<ProjectConfiguration *>(), nullptr);
|
m_listWidgets[RUN]->setProjectConfigurations(QList<QObject *>(), nullptr);
|
||||||
m_buildConfiguration = nullptr;
|
m_buildConfiguration = nullptr;
|
||||||
m_deployConfiguration = nullptr;
|
m_deployConfiguration = nullptr;
|
||||||
m_runConfiguration = nullptr;
|
m_runConfiguration = nullptr;
|
||||||
|
|||||||
@@ -113,19 +113,21 @@ public:
|
|||||||
explicit GenericListWidget(QWidget *parent = nullptr);
|
explicit GenericListWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changeActiveProjectConfiguration(ProjectExplorer::ProjectConfiguration *dc);
|
void changeActiveProjectConfiguration(QObject *dc);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setProjectConfigurations(const QList<ProjectConfiguration *> &list, ProjectConfiguration *active);
|
void setProjectConfigurations(const QList<QObject *> &list, QObject *active);
|
||||||
void setActiveProjectConfiguration(ProjectConfiguration *active);
|
void setActiveProjectConfiguration(QObject *active);
|
||||||
void addProjectConfiguration(ProjectConfiguration *pc);
|
void addProjectConfiguration(QObject *pc);
|
||||||
void removeProjectConfiguration(ProjectConfiguration *pc);
|
void removeProjectConfiguration(QObject *pc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QObject *objectAt(int row) const;
|
||||||
|
|
||||||
void rowChanged(int index);
|
void rowChanged(int index);
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
void toolTipChanged();
|
void toolTipChanged();
|
||||||
QListWidgetItem *itemForProjectConfiguration(ProjectConfiguration *pc);
|
QListWidgetItem *itemForProjectConfiguration(QObject *pc);
|
||||||
bool m_ignoreIndexChange;
|
bool m_ignoreIndexChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -148,8 +150,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
void projectAdded(ProjectExplorer::Project *project);
|
void projectAdded(ProjectExplorer::Project *project);
|
||||||
void projectRemoved(ProjectExplorer::Project *project);
|
void projectRemoved(ProjectExplorer::Project *project);
|
||||||
void handleNewProjectConfiguration(ProjectConfiguration *pc);
|
void handleNewProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc);
|
||||||
void handleRemovalOfProjectConfiguration(ProjectConfiguration *pc);
|
void handleNewTarget(Target *target);
|
||||||
|
void handleRemovalOfProjectConfiguration(ProjectExplorer::ProjectConfiguration *pc);
|
||||||
|
void handleRemovalOfTarget(Target *pc);
|
||||||
|
|
||||||
void changeStartupProject(ProjectExplorer::Project *project);
|
void changeStartupProject(ProjectExplorer::Project *project);
|
||||||
void activeTargetChanged(ProjectExplorer::Target *target);
|
void activeTargetChanged(ProjectExplorer::Target *target);
|
||||||
|
|||||||
@@ -258,15 +258,12 @@ void Project::addTarget(std::unique_ptr<Target> &&t)
|
|||||||
QTC_ASSERT(!target(t->kit()), return);
|
QTC_ASSERT(!target(t->kit()), return);
|
||||||
Q_ASSERT(t->project() == this);
|
Q_ASSERT(t->project() == this);
|
||||||
|
|
||||||
t->setDefaultDisplayName(t->displayName());
|
|
||||||
|
|
||||||
// add it
|
// add it
|
||||||
d->m_targets.emplace_back(std::move(t));
|
d->m_targets.emplace_back(std::move(t));
|
||||||
connect(pointer, &Target::addedProjectConfiguration, this, &Project::addedProjectConfiguration);
|
connect(pointer, &Target::addedProjectConfiguration, this, &Project::addedProjectConfiguration);
|
||||||
connect(pointer, &Target::aboutToRemoveProjectConfiguration, this, &Project::aboutToRemoveProjectConfiguration);
|
connect(pointer, &Target::aboutToRemoveProjectConfiguration, this, &Project::aboutToRemoveProjectConfiguration);
|
||||||
connect(pointer, &Target::removedProjectConfiguration, this, &Project::removedProjectConfiguration);
|
connect(pointer, &Target::removedProjectConfiguration, this, &Project::removedProjectConfiguration);
|
||||||
connect(pointer, &Target::activeProjectConfigurationChanged, this, &Project::activeProjectConfigurationChanged);
|
connect(pointer, &Target::activeProjectConfigurationChanged, this, &Project::activeProjectConfigurationChanged);
|
||||||
emit addedProjectConfiguration(pointer);
|
|
||||||
emit addedTarget(pointer);
|
emit addedTarget(pointer);
|
||||||
|
|
||||||
// check activeTarget:
|
// check activeTarget:
|
||||||
@@ -281,7 +278,6 @@ bool Project::removeTarget(Target *target)
|
|||||||
if (BuildManager::isBuilding(target))
|
if (BuildManager::isBuilding(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
emit aboutToRemoveProjectConfiguration(target);
|
|
||||||
emit aboutToRemoveTarget(target);
|
emit aboutToRemoveTarget(target);
|
||||||
auto keep = Utils::take(d->m_targets, target);
|
auto keep = Utils::take(d->m_targets, target);
|
||||||
if (target == d->m_activeTarget) {
|
if (target == d->m_activeTarget) {
|
||||||
@@ -289,7 +285,6 @@ bool Project::removeTarget(Target *target)
|
|||||||
SessionManager::setActiveTarget(this, newActiveTarget, SetActive::Cascade);
|
SessionManager::setActiveTarget(this, newActiveTarget, SetActive::Cascade);
|
||||||
}
|
}
|
||||||
emit removedTarget(target);
|
emit removedTarget(target);
|
||||||
emit removedProjectConfiguration(target);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -313,7 +308,6 @@ void Project::setActiveTarget(Target *target)
|
|||||||
if ((!target && d->m_targets.size() == 0) ||
|
if ((!target && d->m_targets.size() == 0) ||
|
||||||
(target && Utils::contains(d->m_targets, target))) {
|
(target && Utils::contains(d->m_targets, target))) {
|
||||||
d->m_activeTarget = target;
|
d->m_activeTarget = target;
|
||||||
emit activeProjectConfigurationChanged(d->m_activeTarget);
|
|
||||||
emit activeTargetChanged(d->m_activeTarget);
|
emit activeTargetChanged(d->m_activeTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,11 +92,7 @@ ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id)
|
|||||||
if (m_target != nullptr)
|
if (m_target != nullptr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
QTC_CHECK(m_target);
|
||||||
// FIXME: Below triggers on 'real' Targets with this here a base class as it's
|
|
||||||
// not a real Target at this point of time. Plan is to cut this dependency and
|
|
||||||
// enable the check, for now the item is set manually in the Target ctor.
|
|
||||||
// QTC_CHECK(m_target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectConfiguration::~ProjectConfiguration() = default;
|
ProjectConfiguration::~ProjectConfiguration() = default;
|
||||||
|
|||||||
@@ -53,21 +53,26 @@ void Subscription::subscribe(ProjectConfiguration *pc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
connectTo(pc);
|
connectTo(pc);
|
||||||
|
|
||||||
if (auto t = qobject_cast<Target *>(pc)) {
|
|
||||||
for (ProjectConfiguration *pc : t->projectConfigurations())
|
|
||||||
connectTo(pc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Subscription::subscribeTarget(Target *target)
|
||||||
|
{
|
||||||
|
if (!m_subscriber)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (ProjectConfiguration *pc : target->projectConfigurations())
|
||||||
|
connectTo(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Subscription::unsubscribe(ProjectConfiguration *pc)
|
void Subscription::unsubscribe(ProjectConfiguration *pc)
|
||||||
{
|
{
|
||||||
disconnectFrom(pc);
|
disconnectFrom(pc);
|
||||||
|
|
||||||
if (auto t = qobject_cast<Target *>(pc)) {
|
|
||||||
for (ProjectConfiguration *pc : t->projectConfigurations())
|
|
||||||
disconnectFrom(pc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Subscription::unsubscribeTarget(Target *target)
|
||||||
|
{
|
||||||
|
for (ProjectConfiguration *pc : target->projectConfigurations())
|
||||||
|
disconnectFrom(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Subscription::unsubscribeAll()
|
void Subscription::unsubscribeAll()
|
||||||
@@ -113,13 +118,15 @@ ProjectSubscription::ProjectSubscription(const Subscription::Connector &s, const
|
|||||||
QTC_ASSERT(m_subscriber, return);
|
QTC_ASSERT(m_subscriber, return);
|
||||||
|
|
||||||
for (Target *t : p->targets())
|
for (Target *t : p->targets())
|
||||||
subscribe(t);
|
subscribeTarget(t);
|
||||||
|
|
||||||
// Disconnect on removal of a project, to make it save to remove/add a project:
|
// Disconnect on removal of a project, to make it save to remove/add a project:
|
||||||
connect(SessionManager::instance(), &SessionManager::projectRemoved,
|
connect(SessionManager::instance(), &SessionManager::projectRemoved,
|
||||||
this, [this, p](Project *reported) { if (p == reported) { destroy(); } });
|
this, [this, p](Project *reported) { if (p == reported) { destroy(); } });
|
||||||
connect(p, &Project::addedProjectConfiguration, this, &ProjectSubscription::subscribe);
|
connect(p, &Project::addedProjectConfiguration, this, &ProjectSubscription::subscribe);
|
||||||
|
connect(p, &Project::addedTarget, this, &ProjectSubscription::subscribeTarget);
|
||||||
connect(p, &Project::removedProjectConfiguration, this, &ProjectSubscription::unsubscribe);
|
connect(p, &Project::removedProjectConfiguration, this, &ProjectSubscription::unsubscribe);
|
||||||
|
connect(p, &Project::removedTarget, this, &ProjectSubscription::unsubscribeTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectSubscription::~ProjectSubscription() = default;
|
ProjectSubscription::~ProjectSubscription() = default;
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void subscribe(ProjectConfiguration *pc);
|
void subscribe(ProjectConfiguration *pc);
|
||||||
|
void subscribeTarget(Target *target);
|
||||||
void unsubscribe(ProjectConfiguration *pc);
|
void unsubscribe(ProjectConfiguration *pc);
|
||||||
|
void unsubscribeTarget(Target *target);
|
||||||
|
|
||||||
void unsubscribeAll();
|
void unsubscribeAll();
|
||||||
void connectTo(ProjectConfiguration *pc);
|
void connectTo(ProjectConfiguration *pc);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/macroexpander.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
@@ -56,6 +57,8 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const char ACTIVE_BC_KEY[] = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
const char ACTIVE_BC_KEY[] = "ProjectExplorer.Target.ActiveBuildConfiguration";
|
||||||
const char BC_KEY_PREFIX[] = "ProjectExplorer.Target.BuildConfiguration.";
|
const char BC_KEY_PREFIX[] = "ProjectExplorer.Target.BuildConfiguration.";
|
||||||
@@ -106,6 +109,7 @@ public:
|
|||||||
QVariantMap m_pluginSettings;
|
QVariantMap m_pluginSettings;
|
||||||
|
|
||||||
Kit *const m_kit;
|
Kit *const m_kit;
|
||||||
|
MacroExpander m_macroExpander;
|
||||||
};
|
};
|
||||||
|
|
||||||
TargetPrivate::TargetPrivate(Kit *k) :
|
TargetPrivate::TargetPrivate(Kit *k) :
|
||||||
@@ -113,12 +117,9 @@ TargetPrivate::TargetPrivate(Kit *k) :
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
||||||
ProjectConfiguration(project, k->id()),
|
QObject(project),
|
||||||
d(std::make_unique<TargetPrivate>(k))
|
d(std::make_unique<TargetPrivate>(k))
|
||||||
{
|
{
|
||||||
// FIXME: Remove, see comment in ProjectConfiguration ctor.
|
|
||||||
m_target = this;
|
|
||||||
|
|
||||||
QTC_CHECK(d->m_kit);
|
QTC_CHECK(d->m_kit);
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
||||||
connect(project, &Project::parsingFinished, this, [this](bool success) {
|
connect(project, &Project::parsingFinished, this, [this](bool success) {
|
||||||
@@ -128,9 +129,6 @@ Target::Target(Project *project, Kit *k, _constructor_tag) :
|
|||||||
}
|
}
|
||||||
}, Qt::QueuedConnection); // Must wait for run configs to change their enabled state.
|
}, Qt::QueuedConnection); // Must wait for run configs to change their enabled state.
|
||||||
|
|
||||||
setDisplayName(d->m_kit->displayName());
|
|
||||||
setToolTip(d->m_kit->toHtml());
|
|
||||||
|
|
||||||
KitManager *km = KitManager::instance();
|
KitManager *km = KitManager::instance();
|
||||||
connect(km, &KitManager::kitUpdated, this, &Target::handleKitUpdates);
|
connect(km, &KitManager::kitUpdated, this, &Target::handleKitUpdates);
|
||||||
connect(km, &KitManager::kitRemoved, this, &Target::handleKitRemoval);
|
connect(km, &KitManager::kitRemoved, this, &Target::handleKitRemoval);
|
||||||
@@ -164,10 +162,8 @@ void Target::handleKitUpdates(Kit *k)
|
|||||||
if (k != d->m_kit)
|
if (k != d->m_kit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setDisplayName(k->displayName());
|
|
||||||
updateDefaultDeployConfigurations();
|
updateDefaultDeployConfigurations();
|
||||||
updateDeviceState(); // in case the device changed...
|
updateDeviceState(); // in case the device changed...
|
||||||
setToolTip(k->toHtml());
|
|
||||||
|
|
||||||
emit iconChanged();
|
emit iconChanged();
|
||||||
emit kitChanged();
|
emit kitChanged();
|
||||||
@@ -195,6 +191,21 @@ Kit *Target::kit() const
|
|||||||
return d->m_kit;
|
return d->m_kit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id Target::id() const
|
||||||
|
{
|
||||||
|
return d->m_kit->id();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Target::displayName() const
|
||||||
|
{
|
||||||
|
return d->m_kit->displayName();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Target::toolTip() const
|
||||||
|
{
|
||||||
|
return d->m_kit->toHtml();
|
||||||
|
}
|
||||||
|
|
||||||
void Target::addBuildConfiguration(BuildConfiguration *bc)
|
void Target::addBuildConfiguration(BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(bc && !d->m_buildConfigurations.contains(bc), return);
|
QTC_ASSERT(bc && !d->m_buildConfigurations.contains(bc), return);
|
||||||
@@ -477,7 +488,18 @@ QVariantMap Target::toMap() const
|
|||||||
if (!d->m_kit) // Kit was deleted, target is only around to be copied.
|
if (!d->m_kit) // Kit was deleted, target is only around to be copied.
|
||||||
return QVariantMap();
|
return QVariantMap();
|
||||||
|
|
||||||
QVariantMap map(ProjectConfiguration::toMap());
|
QVariantMap map;
|
||||||
|
|
||||||
|
{
|
||||||
|
// FIXME: For compatibility within the 4.11 cycle, remove this block later.
|
||||||
|
// This is only read by older versions of Creator, but even there not actively used.
|
||||||
|
const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
|
||||||
|
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
||||||
|
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
||||||
|
map.insert(QLatin1String(CONFIGURATION_ID_KEY), id().toSetting());
|
||||||
|
map.insert(QLatin1String(DISPLAY_NAME_KEY), displayName());
|
||||||
|
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), displayName());
|
||||||
|
}
|
||||||
|
|
||||||
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
||||||
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(d->m_activeBuildConfiguration));
|
map.insert(QLatin1String(ACTIVE_BC_KEY), bcs.indexOf(d->m_activeBuildConfiguration));
|
||||||
@@ -701,6 +723,11 @@ MakeInstallCommand Target::makeInstallCommand(const QString &installRoot) const
|
|||||||
return project()->makeInstallCommand(this, installRoot);
|
return project()->makeInstallCommand(this, installRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MacroExpander *Target::macroExpander() const
|
||||||
|
{
|
||||||
|
return &d->m_macroExpander;
|
||||||
|
}
|
||||||
|
|
||||||
void Target::updateDeviceState()
|
void Target::updateDeviceState()
|
||||||
{
|
{
|
||||||
IDevice::ConstPtr current = DeviceKitAspect::device(kit());
|
IDevice::ConstPtr current = DeviceKitAspect::device(kit());
|
||||||
@@ -746,14 +773,8 @@ void Target::setEnabled(bool enabled)
|
|||||||
|
|
||||||
bool Target::fromMap(const QVariantMap &map)
|
bool Target::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!ProjectConfiguration::fromMap(map))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QTC_ASSERT(d->m_kit == KitManager::kit(id()), return false);
|
QTC_ASSERT(d->m_kit == KitManager::kit(id()), return false);
|
||||||
|
|
||||||
setDisplayName(d->m_kit->displayName()); // Overwrite displayname read from file
|
|
||||||
setDefaultDisplayName(d->m_kit->displayName());
|
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
int bcCount = map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok);
|
int bcCount = map.value(QLatin1String(BC_COUNT_KEY), 0).toInt(&ok);
|
||||||
if (!ok || bcCount < 0)
|
if (!ok || bcCount < 0)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class RunConfiguration;
|
|||||||
|
|
||||||
class TargetPrivate;
|
class TargetPrivate;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT Target : public ProjectConfiguration
|
class PROJECTEXPLORER_EXPORT Target : public QObject
|
||||||
{
|
{
|
||||||
friend class SessionManager; // for setActiveBuild and setActiveDeployConfiguration
|
friend class SessionManager; // for setActiveBuild and setActiveDeployConfiguration
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -57,13 +57,15 @@ public:
|
|||||||
Target(Project *parent, Kit *k, _constructor_tag);
|
Target(Project *parent, Kit *k, _constructor_tag);
|
||||||
~Target() override;
|
~Target() override;
|
||||||
|
|
||||||
bool isActive() const final;
|
bool isActive() const;
|
||||||
|
|
||||||
Project *project() const;
|
Project *project() const;
|
||||||
|
|
||||||
// Kit:
|
|
||||||
Kit *kit() const;
|
Kit *kit() const;
|
||||||
|
|
||||||
|
Core::Id id() const;
|
||||||
|
QString displayName() const;
|
||||||
|
QString toolTip() const;
|
||||||
|
|
||||||
// Build configuration
|
// Build configuration
|
||||||
void addBuildConfiguration(BuildConfiguration *bc);
|
void addBuildConfiguration(BuildConfiguration *bc);
|
||||||
bool removeBuildConfiguration(BuildConfiguration *bc);
|
bool removeBuildConfiguration(BuildConfiguration *bc);
|
||||||
@@ -107,7 +109,7 @@ public:
|
|||||||
void setOverlayIcon(const QIcon &icon);
|
void setOverlayIcon(const QIcon &icon);
|
||||||
QString overlayIconToolTip();
|
QString overlayIconToolTip();
|
||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const;
|
||||||
|
|
||||||
void updateDefaultBuildConfigurations();
|
void updateDefaultBuildConfigurations();
|
||||||
void updateDefaultDeployConfigurations();
|
void updateDefaultDeployConfigurations();
|
||||||
@@ -119,6 +121,8 @@ public:
|
|||||||
QVariant additionalData(Core::Id id) const;
|
QVariant additionalData(Core::Id id) const;
|
||||||
MakeInstallCommand makeInstallCommand(const QString &installRoot) const;
|
MakeInstallCommand makeInstallCommand(const QString &installRoot) const;
|
||||||
|
|
||||||
|
Utils::MacroExpander *macroExpander() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void targetEnabled(bool);
|
void targetEnabled(bool);
|
||||||
void iconChanged();
|
void iconChanged();
|
||||||
@@ -153,7 +157,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void setEnabled(bool);
|
void setEnabled(bool);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
void updateDeviceState();
|
void updateDeviceState();
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
|
|||||||
if (pc && pc->isActive())
|
if (pc && pc->isActive())
|
||||||
environmentChanged();
|
environmentChanged();
|
||||||
});
|
});
|
||||||
|
connect(project, &Project::activeTargetChanged, this, [this](Target *target) {
|
||||||
|
if (target && target->isActive())
|
||||||
|
environmentChanged();
|
||||||
|
});
|
||||||
|
|
||||||
auto qmakeProject = static_cast<QmakeProject *>(bc->target()->project());
|
auto qmakeProject = static_cast<QmakeProject *>(bc->target()->project());
|
||||||
connect(qmakeProject, &QmakeProject::buildDirectoryInitialized,
|
connect(qmakeProject, &QmakeProject::buildDirectoryInitialized,
|
||||||
|
|||||||
Reference in New Issue
Block a user