forked from qt-creator/qt-creator
QmakeProjectManager: Improve signalling of parser state
Correctly signal when parsing of a qmake project starts and stops via the build- and runconfigurations. The buildconfigurations are in the picture since they disable the run buttons when the user has selected to build before deploy and deploy before run. Task-number: QTCREATORBUG-16172 Task-number: QTCREATORBUG-15583 Change-Id: I44b5f5ce8e145cb93dc0022f66e1edcc202875e4 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -267,6 +267,7 @@ public:
|
||||
void startupProjectChanged(); // Calls updateRunAction
|
||||
void activeTargetChanged();
|
||||
void activeRunConfigurationChanged();
|
||||
void activeBuildConfigurationChanged();
|
||||
|
||||
void slotUpdateRunActions();
|
||||
|
||||
@@ -2617,13 +2618,18 @@ void ProjectExplorerPluginPrivate::activeTargetChanged()
|
||||
if (previousTarget) {
|
||||
disconnect(previousTarget.data(), &Target::activeRunConfigurationChanged,
|
||||
this, &ProjectExplorerPluginPrivate::activeRunConfigurationChanged);
|
||||
disconnect(previousTarget.data(), &Target::activeBuildConfigurationChanged,
|
||||
this, &ProjectExplorerPluginPrivate::activeBuildConfigurationChanged);
|
||||
}
|
||||
previousTarget = target;
|
||||
if (target) {
|
||||
connect(target, &Target::activeRunConfigurationChanged,
|
||||
this, &ProjectExplorerPluginPrivate::activeRunConfigurationChanged);
|
||||
connect(previousTarget.data(), &Target::activeBuildConfigurationChanged,
|
||||
this, &ProjectExplorerPluginPrivate::activeBuildConfigurationChanged);
|
||||
}
|
||||
|
||||
activeBuildConfigurationChanged();
|
||||
activeRunConfigurationChanged();
|
||||
updateDeployActions();
|
||||
}
|
||||
@@ -2649,6 +2655,27 @@ void ProjectExplorerPluginPrivate::activeRunConfigurationChanged()
|
||||
emit m_instance->updateRunActions();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::activeBuildConfigurationChanged()
|
||||
{
|
||||
static QPointer<BuildConfiguration> previousBuildConfiguration = nullptr;
|
||||
BuildConfiguration *bc = nullptr;
|
||||
Project *startupProject = SessionManager::startupProject();
|
||||
if (startupProject && startupProject->activeTarget())
|
||||
bc = startupProject->activeTarget()->activeBuildConfiguration();
|
||||
if (bc == previousBuildConfiguration)
|
||||
return;
|
||||
if (previousBuildConfiguration) {
|
||||
disconnect(previousBuildConfiguration.data(), &BuildConfiguration::enabledChanged,
|
||||
m_instance, &ProjectExplorerPlugin::updateRunActions);
|
||||
}
|
||||
previousBuildConfiguration = bc;
|
||||
if (bc) {
|
||||
connect(bc, &BuildConfiguration::enabledChanged,
|
||||
m_instance, &ProjectExplorerPlugin::updateRunActions);
|
||||
}
|
||||
emit m_instance->updateRunActions();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::updateDeployActions()
|
||||
{
|
||||
Project *project = SessionManager::startupProject();
|
||||
|
@@ -125,8 +125,8 @@ void DesktopQmakeRunConfiguration::proFileUpdated(QmakeProFileNode *pro, bool su
|
||||
{
|
||||
if (m_proFilePath != pro->filePath())
|
||||
return;
|
||||
bool enabled = isEnabled();
|
||||
QString reason = disabledReason();
|
||||
const bool enabled = isEnabled();
|
||||
const QString reason = disabledReason();
|
||||
m_parseSuccess = success;
|
||||
m_parseInProgress = parseInProgress;
|
||||
if (enabled != isEnabled() || reason != disabledReason())
|
||||
|
@@ -137,7 +137,7 @@ private:
|
||||
LastKitState m_lastKitState;
|
||||
|
||||
bool m_shadowBuild = true;
|
||||
bool m_isEnabled = false;
|
||||
bool m_isEnabled = true;
|
||||
QtSupport::BaseQtVersion::QmakeBuildConfigs m_qmakeBuildConfiguration = 0;
|
||||
QmakeProjectManager::QmakeProFileNode *m_subNodeBuild = nullptr;
|
||||
ProjectExplorer::FileNode *m_fileNodeBuild = nullptr;
|
||||
|
@@ -1322,8 +1322,6 @@ void QmakePriFileNode::save(const QStringList &lines)
|
||||
FileSaver saver(m_projectFilePath.toString(), QIODevice::Text);
|
||||
saver.write(lines.join(QLatin1Char('\n')).toLocal8Bit());
|
||||
saver.finalize(Core::ICore::mainWindow());
|
||||
|
||||
m_project->projectManager()->notifyChanged(m_projectFilePath);
|
||||
}
|
||||
|
||||
// This is a hack.
|
||||
|
@@ -400,7 +400,7 @@ private:
|
||||
static InstallsList installsList(const QtSupport::ProFileReader *reader, const QString &projectFilePath, const QString &projectDir, const QString &buildDir);
|
||||
|
||||
bool m_validParse = false;
|
||||
bool m_parseInProgress = true;
|
||||
bool m_parseInProgress = false;
|
||||
|
||||
QmakeProjectType m_projectType = InvalidProject;
|
||||
QmakeVariablesHash m_varValues;
|
||||
|
@@ -71,25 +71,6 @@ using namespace Utils;
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Helpers:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
|
||||
QmakeBuildConfiguration *enableActiveQmakeBuildConfiguration(Target *t, bool enabled)
|
||||
{
|
||||
if (!t)
|
||||
return 0;
|
||||
QmakeBuildConfiguration *bc = static_cast<QmakeBuildConfiguration *>(t->activeBuildConfiguration());
|
||||
if (!bc)
|
||||
return 0;
|
||||
bc->setEnabled(enabled);
|
||||
return bc;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -603,7 +584,8 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
|
||||
return;
|
||||
}
|
||||
|
||||
enableActiveQmakeBuildConfiguration(activeTarget(), false);
|
||||
node->setParseInProgressRecursive(true);
|
||||
setAllBuildConfigurationsEnabled(false);
|
||||
|
||||
if (m_asyncUpdateState == AsyncFullUpdatePending) {
|
||||
// Just postpone
|
||||
@@ -643,7 +625,6 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode *node, QmakeProFileNode:
|
||||
m_codeModelFuture.cancel();
|
||||
|
||||
startAsyncTimer(delay);
|
||||
|
||||
} else if (m_asyncUpdateState == AsyncUpdateInProgress) {
|
||||
// A update is in progress
|
||||
// And this slot only gets called if a file changed on disc
|
||||
@@ -671,21 +652,21 @@ void QmakeProject::scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay)
|
||||
qDebug()<<" canceling is in progress, doing nothing";
|
||||
return;
|
||||
}
|
||||
|
||||
rootProjectNode()->setParseInProgressRecursive(true);
|
||||
setAllBuildConfigurationsEnabled(false);
|
||||
|
||||
if (m_asyncUpdateState == AsyncUpdateInProgress) {
|
||||
if (debug)
|
||||
qDebug()<<" update in progress, canceling and setting state to full update pending";
|
||||
m_cancelEvaluate = true;
|
||||
m_asyncUpdateState = AsyncFullUpdatePending;
|
||||
enableActiveQmakeBuildConfiguration(activeTarget(), false);
|
||||
rootProjectNode()->setParseInProgressRecursive(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
qDebug()<<" starting timer for full update, setting state to full update pending";
|
||||
m_partialEvaluate.clear();
|
||||
enableActiveQmakeBuildConfiguration(activeTarget(), false);
|
||||
rootProjectNode()->setParseInProgressRecursive(true);
|
||||
m_asyncUpdateState = AsyncFullUpdatePending;
|
||||
|
||||
// Cancel running code model update
|
||||
@@ -734,11 +715,14 @@ void QmakeProject::decrementPendingEvaluateFutures()
|
||||
if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) {
|
||||
if (debug)
|
||||
qDebug()<<" Oh update is pending start the timer";
|
||||
rootProjectNode()->setParseInProgressRecursive(true);
|
||||
setAllBuildConfigurationsEnabled(false);
|
||||
startAsyncTimer(QmakeProFileNode::ParseLater);
|
||||
} else if (m_asyncUpdateState != ShuttingDown){
|
||||
// After being done, we need to call:
|
||||
setAllBuildConfigurationsEnabled(true);
|
||||
|
||||
m_asyncUpdateState = Base;
|
||||
enableActiveQmakeBuildConfiguration(activeTarget(), true);
|
||||
updateFileList();
|
||||
updateCodeModels();
|
||||
updateBuildSystemData();
|
||||
@@ -1071,6 +1055,17 @@ void QmakeProject::activeTargetWasChanged()
|
||||
scheduleAsyncUpdate();
|
||||
}
|
||||
|
||||
void QmakeProject::setAllBuildConfigurationsEnabled(bool enabled)
|
||||
{
|
||||
foreach (Target *t, targets()) {
|
||||
foreach (BuildConfiguration *bc, t->buildConfigurations()) {
|
||||
auto qmakeBc = qobject_cast<QmakeBuildConfiguration *>(bc);
|
||||
if (qmakeBc)
|
||||
qmakeBc->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QmakeProject::hasSubNode(QmakePriFileNode *root, const FileName &path)
|
||||
{
|
||||
if (root->filePath() == path)
|
||||
|
@@ -153,6 +153,8 @@ private:
|
||||
void buildFinished(bool success);
|
||||
void activeTargetWasChanged();
|
||||
|
||||
void setAllBuildConfigurationsEnabled(bool enabled);
|
||||
|
||||
QString executableFor(const QmakeProFileNode *node);
|
||||
void updateRunConfigurations();
|
||||
|
||||
|
Reference in New Issue
Block a user