From 67438b574a3875c72dc75feec8bed37c797d4894 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Tue, 14 Jul 2009 13:39:47 +0200 Subject: [PATCH] Delete toolchain in more intelligent way. Create a new one and check if it's the same as the old one, has the advantage that cached data doesn't need to be retrieved again. It was that way before tool chain was moved to Qt4Project. --- .../qt4projectmanager/qt-s60/qt-s60-todo.txt | 4 +-- src/plugins/qt4projectmanager/qt4project.cpp | 31 +++++++++++++------ src/plugins/qt4projectmanager/qt4project.h | 1 + 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt b/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt index d7ecd0b2544..45b879216eb 100644 --- a/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt +++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt @@ -13,9 +13,6 @@ * must probably be compiled for different toolchains * Tool chains - * delete toolchain in more intelligent way (create a new one and - check if it's the same as the old one, has the advantage that - cached data doesn't need to be retrieved again) * Qt4Project::setQtVersion should think about tool chains, might be better to remove the magic in toolChainType method * should the default make target be defined by the project @@ -26,6 +23,7 @@ * handling of active run config getting disabled not optimal yet * might be better from a user perspective if the run configuration defines possible tool chains + * auto-create run configurations the first time s60 qt is selected. * Run on device * makesis, signsis and applicationinstaller don't report errors back diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 1e3d7acdb2a..a3ff28a7604 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -274,8 +274,7 @@ void Qt4Project::qtVersionsChanged() m_rootProjectNode->update(); } } - delete m_toolChain; - m_toolChain = 0; + updateToolChain(activeBuildConfiguration()); } void Qt4Project::updateFileList() @@ -388,16 +387,29 @@ void Qt4Project::scheduleUpdateCodeModel(Qt4ProjectManager::Internal::Qt4ProFile ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfiguration) const { if (!m_toolChain) { - m_toolChain = qtVersion(buildConfiguration)->createToolChain(toolChainType(buildConfiguration)); -#ifdef QTCREATOR_WITH_S60 - if (m_toolChain->type() == ToolChain::GCCE) { - static_cast<GCCEToolChain *>(m_toolChain)->setProject(this); - } -#endif + updateToolChain(buildConfiguration); } return m_toolChain; } +void Qt4Project::updateToolChain(const QString &buildConfiguration) const +{ + ProjectExplorer::ToolChain *tempToolChain; + tempToolChain = qtVersion(buildConfiguration)->createToolChain(toolChainType(buildConfiguration)); + if (!ProjectExplorer::ToolChain::equals(m_toolChain, tempToolChain)) { + if (m_toolChain) + delete m_toolChain; + m_toolChain = tempToolChain; + } else { + delete tempToolChain; + } +#ifdef QTCREATOR_WITH_S60 + if (m_toolChain && m_toolChain->type() == ToolChain::GCCE) { + static_cast<GCCEToolChain *>(m_toolChain)->setProject(this); + } +#endif +} + QString Qt4Project::makeCommand(const QString &buildConfiguration) const { ToolChain *tc = toolChain(buildConfiguration); @@ -847,8 +859,7 @@ 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; + updateToolChain(buildConfiguration); updateActiveRunConfiguration(); } diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 56d2c51f23d..073728a4923 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -234,6 +234,7 @@ private: static QString qmakeVarName(ProjectExplorer::FileType type); void updateActiveRunConfiguration(); + void updateToolChain(const QString &buildConfiguration) const; Qt4Manager *m_manager; Internal::Qt4ProFileNode *m_rootProjectNode; -- GitLab