Catch a few common errors for failing .pro parsing

Task-number: QTCREATORBUG-7377

Change-Id: I43e1393acc09ee4fd923d6796b4a0298fb22ea71
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Daniel Teske
2012-05-09 12:44:37 +02:00
parent 33144c12a9
commit d05d697ab3
5 changed files with 27 additions and 6 deletions

View File

@@ -146,9 +146,11 @@ bool Qt4RunConfiguration::isEnabled() const
QString Qt4RunConfiguration::disabledReason() const
{
if (m_parseInProgress)
return tr("The .pro file '%1' is currently being parsed.").arg(QFileInfo(m_proFilePath).fileName());
return tr("The .pro file '%1' is currently being parsed.")
.arg(QFileInfo(m_proFilePath).fileName());
if (!m_parseSuccess)
return tr("The .pro file '%1' could not be parsed.").arg(QFileInfo(m_proFilePath).fileName());
return qt4Target()->qt4Project()->disabledReasonForRunConfiguration(m_proFilePath);
return QString();
}

View File

@@ -142,8 +142,7 @@ QString S60DeviceRunConfiguration::disabledReason() const
return tr("The .pro file '%1' is currently being parsed.")
.arg(QFileInfo(m_proFilePath).fileName());
if (!m_validParse)
return tr("The .pro file '%1' could not be parsed.")
.arg(QFileInfo(m_proFilePath).fileName());
return qt4Target()->qt4Project()->disabledReasonForRunConfiguration(m_proFilePath);
return QString();
}

View File

@@ -1362,6 +1362,23 @@ void Qt4Project::configureAsExampleProject(const QStringList &platforms)
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
}
// All the Qt4 run configurations should share code.
// This is a rather suboptimal way to do that for disabledReason()
// but more pratical then duplicated the code everywhere
QString Qt4Project::disabledReasonForRunConfiguration(const QString &proFilePath)
{
if (!QFileInfo(proFilePath).exists())
return tr("The .pro file '%1' does not exist.")
.arg(QFileInfo(proFilePath).fileName());
if (!m_rootProjectNode->findProFileFor(proFilePath))
return tr("The .pro file '%1' is not part of the project.")
.arg(QFileInfo(proFilePath).fileName());
return tr("The .pro file '%1' could not be parsed.")
.arg(QFileInfo(proFilePath).fileName());
}
} // namespace Qt4ProjectManager
#include "qt4project.moc"

View File

@@ -139,6 +139,9 @@ public:
void configureAsExampleProject(const QStringList &platforms);
/// \internal
QString disabledReasonForRunConfiguration(const QString &proFilePath);
signals:
void proParsingDone();
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);

View File

@@ -162,8 +162,8 @@ bool RemoteLinuxRunConfiguration::isEnabled() const
return false;
}
if (!d->validParse) {
d->disabledReason = tr("The .pro file '%1' could not be parsed.")
.arg(QFileInfo(d->proFilePath).fileName());
Qt4Project *project = qt4Target()->qt4Project();
d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath);
return false;
}
if (!activeQt4BuildConfiguration()) {