forked from qt-creator/qt-creator
CMake: Make sure BuildConfiguration enabled state is accurate
Make sure the buildconfiguration is disabled while parsing and that it becomes enabled again after an error in CMake is fixed. Change-Id: Iec919e3c74c465a14ebb87adb9af142537823f00 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -77,7 +77,7 @@ CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
|||||||
|
|
||||||
bool CMakeBuildConfiguration::isEnabled() const
|
bool CMakeBuildConfiguration::isEnabled() const
|
||||||
{
|
{
|
||||||
return m_error.isEmpty();
|
return m_error.isEmpty() && !isParsing();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeBuildConfiguration::disabledReason() const
|
QString CMakeBuildConfiguration::disabledReason() const
|
||||||
@@ -145,6 +145,7 @@ void CMakeBuildConfiguration::ctor()
|
|||||||
connect(m_buildDirManager.get(), &BuildDirManager::dataAvailable,
|
connect(m_buildDirManager.get(), &BuildDirManager::dataAvailable,
|
||||||
this, [this, project]() {
|
this, [this, project]() {
|
||||||
project->updateProjectData(this);
|
project->updateProjectData(this);
|
||||||
|
emit enabledChanged();
|
||||||
emit dataAvailable();
|
emit dataAvailable();
|
||||||
});
|
});
|
||||||
connect(m_buildDirManager.get(), &BuildDirManager::errorOccured,
|
connect(m_buildDirManager.get(), &BuildDirManager::errorOccured,
|
||||||
@@ -155,6 +156,7 @@ void CMakeBuildConfiguration::ctor()
|
|||||||
connect(m_buildDirManager.get(), &BuildDirManager::configurationStarted,
|
connect(m_buildDirManager.get(), &BuildDirManager::configurationStarted,
|
||||||
this, [this, project]() {
|
this, [this, project]() {
|
||||||
project->handleParsingStarted();
|
project->handleParsingStarted();
|
||||||
|
emit enabledChanged();
|
||||||
emit parsingStarted();
|
emit parsingStarted();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -166,6 +168,7 @@ void CMakeBuildConfiguration::ctor()
|
|||||||
|
|
||||||
void CMakeBuildConfiguration::maybeForceReparse()
|
void CMakeBuildConfiguration::maybeForceReparse()
|
||||||
{
|
{
|
||||||
|
clearError();
|
||||||
m_buildDirManager->maybeForceReparse();
|
m_buildDirManager->maybeForceReparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +197,7 @@ void CMakeBuildConfiguration::runCMake()
|
|||||||
if (!m_buildDirManager || m_buildDirManager->isParsing())
|
if (!m_buildDirManager || m_buildDirManager->isParsing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
clearError();
|
||||||
m_buildDirManager->forceReparse();
|
m_buildDirManager->forceReparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +343,14 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
|
|||||||
m_buildDirManager->forceReparse();
|
m_buildDirManager->forceReparse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::clearError()
|
||||||
|
{
|
||||||
|
if (!m_error.isEmpty()) {
|
||||||
|
m_error.clear();
|
||||||
|
emit enabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeBuildConfiguration::emitBuildTypeChanged()
|
void CMakeBuildConfiguration::emitBuildTypeChanged()
|
||||||
{
|
{
|
||||||
emit buildTypeChanged();
|
emit buildTypeChanged();
|
||||||
@@ -388,10 +400,11 @@ CMakeConfig CMakeBuildConfiguration::cmakeConfiguration() const
|
|||||||
|
|
||||||
void CMakeBuildConfiguration::setError(const QString &message)
|
void CMakeBuildConfiguration::setError(const QString &message)
|
||||||
{
|
{
|
||||||
if (m_error != message) {
|
QString oldMessage = m_error;
|
||||||
emit enabledChanged();
|
if (m_error != message)
|
||||||
m_error = message;
|
m_error = message;
|
||||||
}
|
if (oldMessage.isEmpty() && !message.isEmpty())
|
||||||
|
emit enabledChanged();
|
||||||
emit errorOccured(m_error);
|
emit errorOccured(m_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -112,6 +112,7 @@ private:
|
|||||||
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
|
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
|
||||||
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
|
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
|
||||||
|
|
||||||
|
void clearError();
|
||||||
void setError(const QString &message);
|
void setError(const QString &message);
|
||||||
void setWarning(const QString &message);
|
void setWarning(const QString &message);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user