diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index 092181202cd4c3c0bf8e945a58c0de55280ca84e..451ed52d01886eebdf933cff195a3f2ed409829a 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -308,7 +308,7 @@ MakeStep *QmakeBuildConfiguration::makeStep() const } // Returns true if both are equal. -QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile) +QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile, QString *errorString) { const QLoggingCategory &logs = MakeFileParse::logging(); qCDebug(logs) << "QMakeBuildConfiguration::compareToImport"; @@ -322,6 +322,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF } if (parse.makeFileState() == MakeFileParse::CouldNotParse) { qCDebug(logs) << "**Makefile incompatible"; + if (errorString) + *errorString = tr("Could not parse Makefile."); return MakefileIncompatible; } @@ -339,6 +341,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF if (parse.srcProFile() != qs->project()->projectFilePath().toString()) { qCDebug(logs) << "**Different profile used to generate the Makefile:" << parse.srcProFile() << " expected profile:" << qs->project()->projectFilePath(); + if (errorString) + *errorString = tr("The Makefile is for a different project."); return MakefileIncompatible; } @@ -353,6 +357,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF if (qmakeBuildConfiguration() != buildConfig) { qCDebug(logs) << "**Different qmake buildconfigurations buildconfiguration:" << qmakeBuildConfiguration() << " Makefile:" << buildConfig; + if (errorString) + *errorString = tr("The build type has changed."); return MakefileIncompatible; } @@ -396,12 +402,16 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF actualArgs.sort(); parsedArgs.sort(); if (actualArgs != parsedArgs) { - qCDebug(logs) << "**Mismateched args"; + qCDebug(logs) << "**Mismatched args"; + if (errorString) + *errorString = tr("The qmake arguments have changed."); return MakefileIncompatible; } if (parse.config() != qs->deducedArguments()) { qCDebug(logs) << "**Mismatched config"; + if (errorString) + *errorString = tr("The qmake arguments have changed."); return MakefileIncompatible; } @@ -419,6 +429,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF } qCDebug(logs) << "**Incompatible specs"; + if (errorString) + *errorString = tr("The mkspec has changed."); return MakefileIncompatible; } diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index aa296273d50642c4e7880237afd7af9b9b51753f..f9db785f0804c3e67ba663f793673d54680d4377 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -91,7 +91,7 @@ public: QString makefile() const; enum MakefileState { MakefileMatches, MakefileForWrongProject, MakefileIncompatible, MakefileMissing }; - MakefileState compareToImportFrom(const QString &makefile); + MakefileState compareToImportFrom(const QString &makefile, QString *errorString = 0); static Utils::FileName extractSpecFromArguments(QString *arguments, const QString &directory, const QtSupport::BaseQtVersion *version, QStringList *outArgs = 0); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp index 358dcae5fb38752d8a38e4bb6df9d4cd1b40292d..37d5ec894a1bebb1819b87200379d3e9e6c433c4 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp @@ -213,6 +213,7 @@ void QmakeProjectConfigWidget::updateProblemLabel() bool incompatibleBuild = false; bool allGood = false; // we only show if we actually have a qmake and makestep + QString errorString; if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) { QString makefile = m_buildConfiguration->buildDirectory().toString() + QLatin1Char('/'); if (m_buildConfiguration->makefile().isEmpty()) @@ -220,7 +221,7 @@ void QmakeProjectConfigWidget::updateProblemLabel() else makefile.append(m_buildConfiguration->makefile()); - switch (m_buildConfiguration->compareToImportFrom(makefile)) { + switch (m_buildConfiguration->compareToImportFrom(makefile, &errorString)) { case QmakeBuildConfiguration::MakefileMatches: allGood = true; break; @@ -274,8 +275,9 @@ void QmakeProjectConfigWidget::updateProblemLabel() .arg(m_buildConfiguration->buildDirectory().toUserOutput())); return; } else if (incompatibleBuild) { - setProblemLabel(tr("An incompatible build exists in %1, which will be overwritten.", - "%1 build directory") + setProblemLabel(tr("%1 The build in %2 will be overwritten.", + "%1 error message, %2 build directory") + .arg(errorString) .arg(m_buildConfiguration->buildDirectory().toUserOutput())); return; }