Commit 68a78612 authored by Daniel Teske's avatar Daniel Teske

Qt4Project: Evaluate .pro and update codemodel only on some kit changes

Task-number: QTCREATORBUG-8037

Change-Id: I5c89a712be9429b49d65f6886b5b3b2dade7fc20
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent fbdb1139
......@@ -43,12 +43,14 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/kitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qt4projectmanager/qmakekitinformation.h>
#include <QDebug>
#include <QInputDialog>
......@@ -127,6 +129,12 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
m_lastEmmitedBuildDirectory = buildDirectory();
m_qtVersionSupportsShadowBuilds = supportsShadowBuilds();
m_lastKitState = LastKitState(target()->kit());
connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainUpdated(ProjectExplorer::ToolChain *)),
this, SLOT(toolChainUpdated(ProjectExplorer::ToolChain *)));
connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
return true;
}
......@@ -142,8 +150,27 @@ void Qt4BuildConfiguration::ctor()
void Qt4BuildConfiguration::kitChanged()
{
emitProFileEvaluateNeeded();
emitBuildDirectoryChanged();
LastKitState newState = LastKitState(target()->kit());
if (newState != m_lastKitState) {
// This only checks if the ids have changed!
// For that reason the Qt4BuildConfiguration is also connected
// to the toolchain and qtversion managers
emitProFileEvaluateNeeded();
emitBuildDirectoryChanged();
m_lastKitState = newState;
}
}
void Qt4BuildConfiguration::toolChainUpdated(ProjectExplorer::ToolChain *tc)
{
if (ToolChainKitInformation::toolChain(target()->kit()) == tc)
emitProFileEvaluateNeeded();
}
void Qt4BuildConfiguration::qtVersionsChanged(const QList<int> &,const QList<int> &, const QList<int> &changed)
{
if (changed.contains(QtKitInformation::qtVersionId(target()->kit())))
emitProFileEvaluateNeeded();
}
void Qt4BuildConfiguration::emitBuildDirectoryChanged()
......@@ -751,4 +778,33 @@ Qt4BuildConfiguration *Qt4BuildConfiguration::setup(Target *t, QString defaultDi
return bc;
}
Qt4BuildConfiguration::LastKitState::LastKitState()
{
}
Qt4BuildConfiguration::LastKitState::LastKitState(Kit *k)
: m_qtVersion(QtKitInformation::qtVersionId(k)),
m_sysroot(SysRootKitInformation::sysRoot(k).toString()),
m_mkspec(QmakeKitInformation::mkspec(k).toString())
{
ToolChain *tc = ToolChainKitInformation::toolChain(k);
m_toolchain = tc ? tc->id() : QString();
}
bool Qt4BuildConfiguration::LastKitState::operator ==(const LastKitState &other)
{
return m_qtVersion == other.m_qtVersion
&& m_toolchain == other.m_toolchain
&& m_sysroot == other.m_sysroot
&& m_mkspec == other.m_mkspec;
}
bool Qt4BuildConfiguration::LastKitState::operator !=(const LastKitState &other)
{
return !operator ==(other);
}
} // namespace Qt4ProjectManager
......@@ -127,6 +127,8 @@ signals:
private slots:
void kitChanged();
void toolChainUpdated(ProjectExplorer::ToolChain *tc);
void qtVersionsChanged(const QList<int> &, const QList<int> &, const QList<int> &changed);
void emitBuildDirectoryChanged();
protected:
......@@ -139,6 +141,21 @@ private:
QString rawBuildDirectory() const;
QString defaultShadowBuildDirectory() const;
class LastKitState
{
public:
LastKitState();
explicit LastKitState(ProjectExplorer::Kit *k);
bool operator ==(const LastKitState &other);
bool operator !=(const LastKitState &other);
private:
int m_qtVersion;
QString m_toolchain;
QString m_sysroot;
QString m_mkspec;
};
LastKitState m_lastKitState;
bool m_shadowBuild;
bool m_isEnabled;
QString m_buildDirectory;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment