Android: Move some unshared code closer to its only place of use

Change-Id: Ieaba2c8f76ee9ac020ebd44712aee593c34e4bf0
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
hjk
2018-04-11 09:06:12 +02:00
parent 84b983617f
commit fb8f007bbb
3 changed files with 17 additions and 25 deletions

View File

@@ -111,8 +111,23 @@ QString QmakeAndroidRunConfiguration::disabledReason() const
return tr("The .pro file \"%1\" is currently being parsed.")
.arg(m_proFilePath.fileName());
if (!qmakeProject()->hasParsingData())
return qmakeProject()->disabledReasonForRunConfiguration(m_proFilePath);
if (!qmakeProject()->hasParsingData()) {
if (!m_proFilePath.exists())
return tr("The .pro file \"%1\" does not exist.")
.arg(m_proFilePath.fileName());
QmakeProjectManager::QmakeProFileNode *rootProjectNode = qmakeProject()->rootProjectNode();
if (!rootProjectNode) // Shutting down
return QString();
if (!rootProjectNode->findProFileFor(m_proFilePath))
return tr("The .pro file \"%1\" is not part of the project.")
.arg(m_proFilePath.fileName());
return tr("The .pro file \"%1\" could not be parsed.")
.arg(m_proFilePath.fileName());
}
return QString();
}

View File

@@ -1019,26 +1019,6 @@ void QmakeProject::configureAsExampleProject(const QSet<Core::Id> &platforms)
qDeleteAll(infoList);
}
// All the Qmake 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 QmakeProject::disabledReasonForRunConfiguration(const FileName &proFilePath)
{
if (!proFilePath.exists())
return tr("The .pro file \"%1\" does not exist.")
.arg(proFilePath.fileName());
if (!rootProjectNode()) // Shutting down
return QString();
if (!rootProjectNode()->findProFileFor(proFilePath))
return tr("The .pro file \"%1\" is not part of the project.")
.arg(proFilePath.fileName());
return tr("The .pro file \"%1\" could not be parsed.")
.arg(proFilePath.fileName());
}
void QmakeProject::updateBuildSystemData()
{
Target *const target = activeTarget();

View File

@@ -101,9 +101,6 @@ public:
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
/// \internal
QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath);
void emitBuildDirectoryInitialized();
static void proFileParseError(const QString &errorMessage);