forked from qt-creator/qt-creator
CMake: Move error and warning handling
... from CMakeBuildConfiguration to CMakeBuildSystem. Less back-and-forth this way. Also, prefer plain buildConfiguration() over cmakeBuildConfiguration() back-pointers. Change-Id: Ie1341302ecc10e53d71ca68b7b6eb5f46cfdad5f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -355,9 +355,11 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
}.setSpacing(0)
|
||||
}.attachTo(details, false);
|
||||
|
||||
auto buildSystem = static_cast<CMakeBuildSystem *>(bc->buildSystem());
|
||||
|
||||
updateAdvancedCheckBox();
|
||||
setError(bc->error());
|
||||
setWarning(bc->warning());
|
||||
setError(buildSystem->error());
|
||||
setWarning(buildSystem->warning());
|
||||
|
||||
connect(bc->buildSystem(), &BuildSystem::parsingStarted, this, [this] {
|
||||
updateButtonState();
|
||||
@@ -388,8 +390,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
updateConfigurationStateSelection();
|
||||
});
|
||||
|
||||
auto cbc = static_cast<CMakeBuildSystem *>(bc->buildSystem());
|
||||
connect(cbc, &CMakeBuildSystem::configurationCleared, this, [this]() {
|
||||
connect(buildSystem, &CMakeBuildSystem::configurationCleared, this, [this]() {
|
||||
updateConfigurationStateSelection();
|
||||
});
|
||||
|
||||
@@ -1424,7 +1425,7 @@ void CMakeBuildConfiguration::setConfigurationChanges(const CMakeConfig &config)
|
||||
// FIXME: Run clean steps when a setting starting with "ANDROID_BUILD_ABI_" is changed.
|
||||
// FIXME: Warn when kit settings are overridden by a project.
|
||||
|
||||
void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)
|
||||
void CMakeBuildSystem::clearError(ForceEnabledChanged fec)
|
||||
{
|
||||
if (!m_error.isEmpty()) {
|
||||
m_error.clear();
|
||||
@@ -1432,7 +1433,7 @@ void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)
|
||||
}
|
||||
if (fec == ForceEnabledChanged::True) {
|
||||
qCDebug(cmakeBuildConfigurationLog) << "Emitting enabledChanged signal";
|
||||
emit enabledChanged();
|
||||
emit buildConfiguration()->enabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1477,7 +1478,7 @@ void CMakeBuildConfiguration::filterConfigArgumentsFromAdditionalCMakeArguments(
|
||||
aspect<AdditionalCMakeOptionsAspect>()->setValue(ProcessArgs::joinArgs(unknownOptions));
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setError(const QString &message)
|
||||
void CMakeBuildSystem::setError(const QString &message)
|
||||
{
|
||||
qCDebug(cmakeBuildConfigurationLog) << "Setting error to" << message;
|
||||
QTC_ASSERT(!message.isEmpty(), return );
|
||||
@@ -1487,27 +1488,27 @@ void CMakeBuildConfiguration::setError(const QString &message)
|
||||
m_error = message;
|
||||
if (oldMessage.isEmpty() != !message.isEmpty()) {
|
||||
qCDebug(cmakeBuildConfigurationLog) << "Emitting enabledChanged signal";
|
||||
emit enabledChanged();
|
||||
emit buildConfiguration()->enabledChanged();
|
||||
}
|
||||
TaskHub::addTask(BuildSystemTask(Task::TaskType::Error, message));
|
||||
emit errorOccurred(m_error);
|
||||
emit cmakeBuildConfiguration()->errorOccurred(m_error);
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setWarning(const QString &message)
|
||||
void CMakeBuildSystem::setWarning(const QString &message)
|
||||
{
|
||||
if (m_warning == message)
|
||||
return;
|
||||
m_warning = message;
|
||||
TaskHub::addTask(BuildSystemTask(Task::TaskType::Warning, message));
|
||||
emit warningOccurred(m_warning);
|
||||
emit cmakeBuildConfiguration()->warningOccurred(m_warning);
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::error() const
|
||||
QString CMakeBuildSystem::error() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::warning() const
|
||||
QString CMakeBuildSystem::warning() const
|
||||
{
|
||||
return m_warning;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user