ProjectExplorer: Update build directories in target setup page

... on a kit update.
Our default build directory template references the kit name, so changes
to the name should update the default value.

Fixes: QTCREATORBUG-19453
Change-Id: Iffbdd95043be5137696e5af021d4735f494d47d7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-08-22 13:52:10 +02:00
parent 5ba05d9f79
commit dcea77f2dd
2 changed files with 23 additions and 1 deletions

View File

@@ -238,6 +238,7 @@ void TargetSetupWidget::update(const Kit::Predicate &predicate)
setEnabled(true);
m_detailsWidget->setIcon(kit()->isValid() ? kit()->icon() : Icons::CRITICAL.icon());
m_detailsWidget->setToolTip(m_kit->toHtml());
updateDefaultBuildDirectories();
}
const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const FilePath &projectPath)
@@ -270,6 +271,24 @@ void TargetSetupWidget::clear()
emit selectedToggled();
}
void TargetSetupWidget::updateDefaultBuildDirectories()
{
for (const BuildInfo &buildInfo : buildInfoList(m_kit, m_projectPath)) {
if (!buildInfo.factory())
continue;
for (BuildInfoStore &buildInfoStore : m_infoStore) {
if (buildInfoStore.buildInfo.buildType == buildInfo.buildType) {
if (!buildInfoStore.customBuildDir) {
m_ignoreChange = true;
buildInfoStore.pathChooser->setFileName(buildInfo.buildDirectory);
m_ignoreChange = false;
}
break;
}
}
}
}
void TargetSetupWidget::checkBoxToggled(bool b)
{
auto box = qobject_cast<QCheckBox *>(sender());
@@ -301,6 +320,7 @@ void TargetSetupWidget::pathChanged()
});
QTC_ASSERT(it != m_infoStore.end(), return);
it->buildInfo.buildDirectory = pathChooser->fileName();
it->customBuildDir = true;
reportIssues(static_cast<int>(std::distance(m_infoStore.begin(), it)));
}

View File

@@ -86,6 +86,7 @@ private:
void reportIssues(int index);
QPair<Task::TaskType, QString> findIssues(const BuildInfo &info);
void clear();
void updateDefaultBuildDirectories();
Kit *m_kit;
Utils::FilePath m_projectPath;
@@ -109,11 +110,12 @@ private:
Utils::PathChooser *pathChooser = nullptr;
bool isEnabled = false;
bool hasIssues = false;
bool customBuildDir = false;
};
std::vector<BuildInfoStore> m_infoStore;
bool m_ignoreChange = false;
int m_selected = 0; // Number of selected "buildconfiguartions"
int m_selected = 0; // Number of selected "buildconfigurations"
};
} // namespace Internal