Maemo: Only add target deployment for the current toolchain.

Task-number: QTCREATORBUG-3222
This commit is contained in:
Christian Kandeler
2010-11-30 18:10:40 +01:00
parent cead4f3974
commit 5466766819
2 changed files with 14 additions and 21 deletions

View File

@@ -76,27 +76,11 @@ bool MaemoDeployableListModel::buildModel()
const QString remoteDirSuffix
= QLatin1String(m_projectType == LibraryTemplate
? "/lib" : "/bin");
const QString remoteDirMaemo5
= QLatin1String("/opt/usr") + remoteDirSuffix;
const QString remoteDirMaemo6
= QLatin1String("/usr/local") + remoteDirSuffix;
m_deployables.prepend(MaemoDeployable(localExecutableFilePath(),
remoteDirMaemo5));
QFile projectFile(m_proFilePath);
if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
qWarning("Error updating .pro file.");
return false;
}
QString proFileTemplate = QLatin1String("\nunix:!symbian {\n"
" maemo5 {\n target.path = maemo5path\n } else {\n"
" target.path = maemo6path\n }\n"
" INSTALLS += target\n}");
proFileTemplate.replace(QLatin1String("maemo5path"), remoteDirMaemo5);
proFileTemplate.replace(QLatin1String("maemo6path"), remoteDirMaemo6);
if (!projectFile.write(proFileTemplate.toLocal8Bit())) {
qWarning("Error updating .pro file.");
return false;
}
const QString remoteDir = QLatin1String("target.path = ")
+ installPrefix() + remoteDirSuffix;
const QStringList deployInfo = QStringList() << remoteDir
<< QLatin1String("INSTALLS += target");
return addLinesToProFile(deployInfo);
} else {
m_deployables.prepend(MaemoDeployable(localExecutableFilePath(),
m_installsList.targetPath));
@@ -370,5 +354,13 @@ QString MaemoDeployableListModel::proFileScope() const
? "maemo5" : "unix:!symbian:!maemo5");
}
QString MaemoDeployableListModel::installPrefix() const
{
const MaemoToolChain *const tc = maemoToolchain();
QTC_ASSERT(tc, return QString());
return QLatin1String(tc->version() == MaemoToolChain::Maemo5
? "/opt/usr" : "/usr/local");
}
} // namespace Qt4ProjectManager
} // namespace Internal

View File

@@ -95,6 +95,7 @@ private:
bool addLinesToProFile(const QStringList &lines);
const MaemoToolChain *maemoToolchain() const;
QString proFileScope() const;
QString installPrefix() const;
const Qt4ProjectType m_projectType;
const QString m_proFilePath;