diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt b/src/plugins/qt4projectmanager/qt-s60/qt-s60-todo.txt index d7ecd0b2544ecb86417472ca3d4e90c00f88d9c1..45b879216ebeb9a45372981d8922454374e0ac08 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 1e3d7acdb2a28d10ceae1d1c01045498b3a2bc1c..a3ff28a7604c0a1bd396fd317081566959ad17d2 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 56d2c51f23db0d32a9a766f1fcf278cfc454ec21..073728a49231d9ba376b4d4a02cb63f75d6e01fb 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;