forked from qt-creator/qt-creator
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:
@@ -146,9 +146,11 @@ bool Qt4RunConfiguration::isEnabled() const
|
|||||||
QString Qt4RunConfiguration::disabledReason() const
|
QString Qt4RunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
if (m_parseInProgress)
|
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)
|
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();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,8 +142,7 @@ QString S60DeviceRunConfiguration::disabledReason() const
|
|||||||
return tr("The .pro file '%1' is currently being parsed.")
|
return tr("The .pro file '%1' is currently being parsed.")
|
||||||
.arg(QFileInfo(m_proFilePath).fileName());
|
.arg(QFileInfo(m_proFilePath).fileName());
|
||||||
if (!m_validParse)
|
if (!m_validParse)
|
||||||
return tr("The .pro file '%1' could not be parsed.")
|
return qt4Target()->qt4Project()->disabledReasonForRunConfiguration(m_proFilePath);
|
||||||
.arg(QFileInfo(m_proFilePath).fileName());
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1362,6 +1362,23 @@ void Qt4Project::configureAsExampleProject(const QStringList &platforms)
|
|||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
|
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
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
#include "qt4project.moc"
|
#include "qt4project.moc"
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ public:
|
|||||||
|
|
||||||
void configureAsExampleProject(const QStringList &platforms);
|
void configureAsExampleProject(const QStringList &platforms);
|
||||||
|
|
||||||
|
/// \internal
|
||||||
|
QString disabledReasonForRunConfiguration(const QString &proFilePath);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void proParsingDone();
|
void proParsingDone();
|
||||||
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
|
void proFileUpdated(Qt4ProjectManager::Qt4ProFileNode *node, bool, bool);
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ bool RemoteLinuxRunConfiguration::isEnabled() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!d->validParse) {
|
if (!d->validParse) {
|
||||||
d->disabledReason = tr("The .pro file '%1' could not be parsed.")
|
Qt4Project *project = qt4Target()->qt4Project();
|
||||||
.arg(QFileInfo(d->proFilePath).fileName());
|
d->disabledReason = project->disabledReasonForRunConfiguration(d->proFilePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!activeQt4BuildConfiguration()) {
|
if (!activeQt4BuildConfiguration()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user