forked from qt-creator/qt-creator
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:
@@ -238,6 +238,7 @@ void TargetSetupWidget::update(const Kit::Predicate &predicate)
|
|||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
m_detailsWidget->setIcon(kit()->isValid() ? kit()->icon() : Icons::CRITICAL.icon());
|
m_detailsWidget->setIcon(kit()->isValid() ? kit()->icon() : Icons::CRITICAL.icon());
|
||||||
m_detailsWidget->setToolTip(m_kit->toHtml());
|
m_detailsWidget->setToolTip(m_kit->toHtml());
|
||||||
|
updateDefaultBuildDirectories();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const FilePath &projectPath)
|
const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const FilePath &projectPath)
|
||||||
@@ -270,6 +271,24 @@ void TargetSetupWidget::clear()
|
|||||||
emit selectedToggled();
|
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)
|
void TargetSetupWidget::checkBoxToggled(bool b)
|
||||||
{
|
{
|
||||||
auto box = qobject_cast<QCheckBox *>(sender());
|
auto box = qobject_cast<QCheckBox *>(sender());
|
||||||
@@ -301,6 +320,7 @@ void TargetSetupWidget::pathChanged()
|
|||||||
});
|
});
|
||||||
QTC_ASSERT(it != m_infoStore.end(), return);
|
QTC_ASSERT(it != m_infoStore.end(), return);
|
||||||
it->buildInfo.buildDirectory = pathChooser->fileName();
|
it->buildInfo.buildDirectory = pathChooser->fileName();
|
||||||
|
it->customBuildDir = true;
|
||||||
reportIssues(static_cast<int>(std::distance(m_infoStore.begin(), it)));
|
reportIssues(static_cast<int>(std::distance(m_infoStore.begin(), it)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,6 +86,7 @@ private:
|
|||||||
void reportIssues(int index);
|
void reportIssues(int index);
|
||||||
QPair<Task::TaskType, QString> findIssues(const BuildInfo &info);
|
QPair<Task::TaskType, QString> findIssues(const BuildInfo &info);
|
||||||
void clear();
|
void clear();
|
||||||
|
void updateDefaultBuildDirectories();
|
||||||
|
|
||||||
Kit *m_kit;
|
Kit *m_kit;
|
||||||
Utils::FilePath m_projectPath;
|
Utils::FilePath m_projectPath;
|
||||||
@@ -109,11 +110,12 @@ private:
|
|||||||
Utils::PathChooser *pathChooser = nullptr;
|
Utils::PathChooser *pathChooser = nullptr;
|
||||||
bool isEnabled = false;
|
bool isEnabled = false;
|
||||||
bool hasIssues = false;
|
bool hasIssues = false;
|
||||||
|
bool customBuildDir = false;
|
||||||
};
|
};
|
||||||
std::vector<BuildInfoStore> m_infoStore;
|
std::vector<BuildInfoStore> m_infoStore;
|
||||||
|
|
||||||
bool m_ignoreChange = false;
|
bool m_ignoreChange = false;
|
||||||
int m_selected = 0; // Number of selected "buildconfiguartions"
|
int m_selected = 0; // Number of selected "buildconfigurations"
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user