Fix maemo tool chain creation on Qt version changes

Make sure the old maemo tool chain is removed before adding it
again.

Change-Id: Iecb77455c21962a25576fca39d32bb35fe638722
Reviewed-on: http://codereview.qt.nokia.com/227
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Tobias Hunger
2011-05-30 14:12:22 +00:00
parent cf62837fab
commit 03047888b5

View File

@@ -304,19 +304,20 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(c
foreach (int i, changes) {
QtSupport::BaseQtVersion *v = vm->version(i);
if (!v || !v->isValid()) {
// remove tool chain:
QList<ProjectExplorer::ToolChain *> toRemove;
foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) {
if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID)))
continue;
MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc);
if (mTc->qtVersionId() == i)
toRemove.append(mTc);
}
foreach (ProjectExplorer::ToolChain *tc, toRemove)
tcm->deregisterToolChain(tc);
} else if (MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(v)) {
// remove tool chain (on removal, change or addition:
QList<ProjectExplorer::ToolChain *> toRemove;
foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) {
if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID)))
continue;
MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc);
if (mTc->qtVersionId() == i)
toRemove.append(mTc);
}
foreach (ProjectExplorer::ToolChain *tc, toRemove)
tcm->deregisterToolChain(tc);
// (Re-)add toolchain:
if (MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(v)) {
// add tool chain:
MaemoToolChain *mTc = new MaemoToolChain(true);
mTc->setQtVersionId(i);