forked from qt-creator/qt-creator
Unify the common part for extracting the Qt project target info.
This code was (more or less) duplicated in 4 places.
This commit is contained in:
@@ -280,54 +280,33 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
{
|
||||
if (m_cachedTargetInformationValid)
|
||||
return;
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
Qt4ProFileNode *proFileNode = qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath);
|
||||
if (!proFileNode) {
|
||||
Qt4TargetInformation info = qt4Project()->targetInformation(qt4Project()->activeQt4BuildConfiguration(),
|
||||
m_proFilePath);
|
||||
if (info.error != Qt4TargetInformation::NoError) {
|
||||
if (info.error == Qt4TargetInformation::ProParserError) {
|
||||
Core::ICore::instance()->messageManager()->printToOutputPane(
|
||||
tr("Could not parse %1. The QtS60 Device run configuration %2 can not be started.")
|
||||
.arg(m_proFilePath).arg(name()));
|
||||
}
|
||||
m_targetName = QString::null;
|
||||
m_baseFileName = QString::null;
|
||||
m_packageTemplateFileName = QString::null;
|
||||
m_platform = QString::null;
|
||||
m_cachedTargetInformationValid = true;
|
||||
emit targetInformationChanged();
|
||||
return;
|
||||
}
|
||||
ProFileReader *reader = qt4Project()->createProFileReader(proFileNode);
|
||||
reader->setCumulative(false);
|
||||
QString workingDir;
|
||||
if (info.hasCustomDestDir)
|
||||
workingDir = info.workingDir;
|
||||
else
|
||||
workingDir = info.baseDestDir;
|
||||
m_targetName = info.target;
|
||||
|
||||
// Find out what flags we pass on to qmake
|
||||
QStringList addedUserConfigArguments;
|
||||
QStringList removedUserConfigArguments;
|
||||
qt4bc->getConfigCommandLineArguments(&addedUserConfigArguments, &removedUserConfigArguments);
|
||||
reader->setConfigCommandLineArguments(addedUserConfigArguments, removedUserConfigArguments);
|
||||
|
||||
if (!reader->readProFile(m_proFilePath)) {
|
||||
qt4Project()->destroyProFileReader(reader);
|
||||
Core::ICore::instance()->messageManager()->printToOutputPane(tr("Could not parse %1. The QtS60 Device run configuration %2 can not be started.").arg(m_proFilePath).arg(name()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract data
|
||||
const QDir baseProjectDirectory = QFileInfo(project()->file()->fileName()).absoluteDir();
|
||||
const QString relSubDir = baseProjectDirectory.relativeFilePath(QFileInfo(m_proFilePath).path());
|
||||
const QDir baseBuildDirectory = qt4bc->buildDirectory();
|
||||
const QString baseDir = baseBuildDirectory.absoluteFilePath(relSubDir);
|
||||
|
||||
// Directory
|
||||
QString m_workingDir;
|
||||
if (reader->contains("DESTDIR")) {
|
||||
m_workingDir = reader->value("DESTDIR");
|
||||
if (QDir::isRelativePath(m_workingDir)) {
|
||||
m_workingDir = baseDir + QLatin1Char('/') + m_workingDir;
|
||||
}
|
||||
} else {
|
||||
m_workingDir = baseDir;
|
||||
}
|
||||
|
||||
m_targetName = reader->value("TARGET");
|
||||
if (m_targetName.isEmpty())
|
||||
m_targetName = QFileInfo(m_proFilePath).baseName();
|
||||
|
||||
m_baseFileName = QDir::cleanPath(m_workingDir + QLatin1Char('/') + m_targetName);
|
||||
m_packageTemplateFileName = QDir::cleanPath(
|
||||
m_workingDir + QLatin1Char('/') + m_targetName + QLatin1String("_template.pkg"));
|
||||
m_baseFileName = workingDir + QLatin1Char('/') + m_targetName;
|
||||
m_packageTemplateFileName = m_baseFileName + QLatin1String("_template.pkg");
|
||||
|
||||
Qt4BuildConfiguration *qt4bc = qt4Project()->activeQt4BuildConfiguration();
|
||||
switch (qt4bc->toolChainType()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
@@ -345,7 +324,7 @@ void S60DeviceRunConfiguration::updateTarget()
|
||||
else
|
||||
m_target = QLatin1String("urel");
|
||||
m_baseFileName += QLatin1Char('_') + m_platform + QLatin1Char('_') + m_target;
|
||||
qt4Project()->destroyProFileReader(reader);
|
||||
|
||||
m_cachedTargetInformationValid = true;
|
||||
emit targetInformationChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user