Commit a9d05dab authored by con's avatar con
Browse files

Move tool chain object from Qt version to project.

parent 07187e0a
......@@ -25,6 +25,7 @@
* Run on device
* makesis, signsis and applicationinstaller don't report errors back
via exit code :-(
* passphrase for signing
* Add compile output parser winscw at least!
......
......@@ -230,7 +230,8 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_nodesWatcher(new Internal::Qt4NodesWatcher(this)),
m_fileInfo(new Qt4ProjectFile(this, fileName, this)),
m_isApplication(true),
m_projectFiles(new Qt4ProjectFiles)
m_projectFiles(new Qt4ProjectFiles),
m_toolChain(0)
{
m_manager->registerProject(this);
......@@ -250,6 +251,7 @@ Qt4Project::~Qt4Project()
{
m_manager->unregisterProject(this);
delete m_projectFiles;
delete m_toolChain;
}
void Qt4Project::defaultQtVersionChanged()
......@@ -268,6 +270,8 @@ void Qt4Project::qtVersionsChanged()
m_rootProjectNode->update();
}
}
delete m_toolChain;
m_toolChain = 0;
}
void Qt4Project::updateFileList()
......@@ -379,7 +383,10 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile
ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const
{
return qtVersion(buildConfiguration)->toolChain(toolChainType(buildConfiguration));
if (!m_toolChain) {
m_toolChain = qtVersion(buildConfiguration)->createToolChain(toolChainType(buildConfiguration));
}
return m_toolChain;
}
QString Qt4Project::makeCommand(const QString &buildConfiguration) const
......@@ -823,6 +830,8 @@ void Qt4Project::setQtVersion(const QString &buildConfiguration, int id)
void Qt4Project::setToolChainType(const QString &buildConfiguration, ProjectExplorer::ToolChain::ToolChainType type)
{
setValue(buildConfiguration, "ToolChain", (int)type);
delete m_toolChain;
m_toolChain = 0;
}
ProjectExplorer::ToolChain::ToolChainType Qt4Project::toolChainType(const QString &buildConfiguration) const
......
......@@ -249,6 +249,7 @@ private:
QList<Qt4ProjectManager::Internal::Qt4ProFileNode *> m_proFilesForCodeModelUpdate;
QMap<QString, Internal::CodeModelInfo> m_codeModelInfo;
mutable ProjectExplorer::ToolChain *m_toolChain;
friend class Qt4ProjectFile;
};
......
......@@ -395,8 +395,7 @@ QtVersion::QtVersion(const QString &name, const QString &path, int id,
m_defaultConfigIsDebugAndRelease(true),
m_hasExamples(false),
m_hasDemos(false),
m_hasDocumentation(false),
m_toolChain(0)
m_hasDocumentation(false)
{
if (id == -1)
m_id = getUniqueId();
......@@ -412,8 +411,7 @@ QtVersion::QtVersion(const QString &name, const QString &path,
m_autodetectionSource(autodetectionSource),
m_hasDebuggingHelper(false),
m_mkspecUpToDate(false),
m_versionInfoUpToDate(false),
m_toolChain(0)
m_versionInfoUpToDate(false)
{
m_id = getUniqueId();
setPath(path);
......@@ -486,7 +484,6 @@ void QtVersion::setPath(const QString &path)
m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty();
m_qmakeCXX = QString::null;
m_qmakeCXXUpToDate = false;
m_toolChainUpToDate = false;
}
void QtVersion::updateSourcePath()
......@@ -885,18 +882,9 @@ void QtVersion::updateQMakeCXX() const
m_qmakeCXXUpToDate = true;
}
ProjectExplorer::ToolChain *QtVersion::toolChain(ProjectExplorer::ToolChain::ToolChainType type) const
ProjectExplorer::ToolChain *QtVersion::createToolChain(ProjectExplorer::ToolChain::ToolChainType type) const
{
updateToolChain(type);
return m_toolChain.data();
}
void QtVersion::updateToolChain(ProjectExplorer::ToolChain::ToolChainType type) const
{
if (m_toolChainUpToDate && m_toolChain
&& m_toolChain.data() && m_toolChain->type() == type)
return;
ProjectExplorer::ToolChain *tempToolchain= 0;
ProjectExplorer::ToolChain *tempToolchain = 0;
if (type == ProjectExplorer::ToolChain::MinGW) {
QString qmake_cxx = qmakeCXX();
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
......@@ -933,14 +921,7 @@ void QtVersion::updateToolChain(ProjectExplorer::ToolChain::ToolChainType type)
qDebug()<<"Could not create ToolChain for"<<mkspec();
qDebug()<<"Qt Creator doesn't know about the system includes, nor the systems defines.";
}
if (ProjectExplorer::ToolChain::equals(tempToolchain, m_toolChain.data())) {
delete tempToolchain;
} else {
m_toolChain = QSharedPointer<ProjectExplorer::ToolChain>(tempToolchain);
}
m_toolChainUpToDate = true;
return tempToolchain;
}
......@@ -1046,7 +1027,6 @@ QString QtVersion::mwcDirectory() const
void QtVersion::setMwcDirectory(const QString &directory)
{
m_mwcDirectory = directory;
m_toolChainUpToDate = false;
}
#endif
......@@ -1058,7 +1038,6 @@ QString QtVersion::mingwDirectory() const
void QtVersion::setMingwDirectory(const QString &directory)
{
m_mingwDirectory = directory;
m_toolChainUpToDate = false;
}
QString QtVersion::msvcVersion() const
......@@ -1075,7 +1054,6 @@ QString QtVersion::wincePlatform() const
void QtVersion::setMsvcVersion(const QString &version)
{
m_msvcVersion = version;
m_toolChainUpToDate = false;
}
void QtVersion::addToEnvironment(ProjectExplorer::Environment &env) const
......@@ -1190,11 +1168,12 @@ QString QtVersion::buildDebuggingHelperLibrary()
addToEnvironment(env);
// TODO: the debugging helper doesn't comply to actual tool chain yet
ProjectExplorer::ToolChain *tc = toolChain(defaultToolchainType());
ProjectExplorer::ToolChain *tc = createToolChain(defaultToolchainType());
tc->addToEnvironment(env);
QString directory = DebuggingHelperLibrary::copyDebuggingHelperLibrary(qtInstallData, path());
QString output = DebuggingHelperLibrary::buildDebuggingHelperLibrary(directory, tc->makeCommand(), qmakeCommand(), mkspec(), env);
m_hasDebuggingHelper = !debuggingHelperLibrary().isEmpty();
delete tc;
return output;
}
......@@ -53,7 +53,7 @@ public:
QtVersion(const QString &name, const QString &path, int id,
bool isAutodetected = false, const QString &autodetectionSource = QString());
QtVersion()
:m_name(QString::null), m_id(-1), m_toolChain(0)
:m_name(QString::null), m_id(-1)
{ setPath(QString::null); }
~QtVersion();
......@@ -74,7 +74,7 @@ public:
QList<ProjectExplorer::ToolChain::ToolChainType> possibleToolChainTypes() const;
QString mkspec() const;
ProjectExplorer::ToolChain::ToolChainType defaultToolchainType() const;
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
ProjectExplorer::ToolChain *createToolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
void setName(const QString &name);
void setPath(const QString &path);
......@@ -128,7 +128,6 @@ private:
void updateMkSpec() const;
void updateVersionInfo() const;
void updateQMakeCXX() const;
void updateToolChain(ProjectExplorer::ToolChain::ToolChainType type) const;
QString qmakeCXX() const;
QString findQtBinary(const QStringList &possibleName) const;
QString m_name;
......@@ -165,9 +164,6 @@ private:
mutable bool m_qmakeCXXUpToDate;
mutable QString m_qmakeCXX;
mutable bool m_toolChainUpToDate;
mutable QSharedPointer<ProjectExplorer::ToolChain> m_toolChain;
};
class QtVersionManager : public QObject
......
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