Commit d05d697a authored by Daniel Teske's avatar Daniel Teske

Catch a few common errors for failing .pro parsing

Task-number: QTCREATORBUG-7377

Change-Id: I43e1393acc09ee4fd923d6796b4a0298fb22ea71
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 33144c12
......@@ -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();
}
......
......@@ -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();
}
......
......@@ -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"
......@@ -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);
......
......@@ -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()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment