Commit 0f53e240 authored by Juraj Oravec's avatar Juraj Oravec

CMake: Show project name in showConfigureErrorMessage

Signed-off-by: Juraj Oravec's avatarJuraj Oravec <sgd.orava@gmail.com>
parent 1dda8e10
Pipeline #12002 failed with stage
in 60 minutes and 1 second
......@@ -206,7 +206,7 @@ KJob* CMakeManager::createImportJob(ProjectFolderItem* item)
if (job->error() != 0) {
qCWarning(CMAKE) << "couldn't load project successfully" << project->name();
m_projects.remove(project);
showConfigureErrorMessage(job->errorText());
showConfigureErrorMessage(project->name(), job->errorText());
}
});
......@@ -399,7 +399,7 @@ void CMakeManager::serverResponse(KDevelop::IProject* project, const QJsonObject
} else
qCDebug(CMAKE) << "unhandled signal response..." << project << response;
} else if (response[QStringLiteral("type")] == QLatin1String("error")) {
showConfigureErrorMessage(response[QStringLiteral("errorMessage")].toString());
showConfigureErrorMessage(project->name(), response[QStringLiteral("errorMessage")].toString());
} else if (response[QStringLiteral("type")] == QLatin1String("reply")) {
const auto inReplyTo = response[QStringLiteral("inReplyTo")];
if (inReplyTo == QLatin1String("configure")) {
......@@ -860,19 +860,20 @@ KTextEditor::Range CMakeManager::termRangeAtPosition(const KTextEditor::Document
return KTextEditor::Range(start, end);
}
void CMakeManager::showConfigureErrorMessage(const QString& errorMessage) const
void CMakeManager::showConfigureErrorMessage(const QString& projectName, const QString& errorMessage) const
{
if (!QApplication::activeWindow()) {
// Do not show a message box if there is no active window in order not to block unit tests.
return;
}
KMessageBox::error(QApplication::activeWindow(), i18n(
"Failed to configure the project (error message: %1)."
"Failed to configure project '%1' (error message: %2)."
" As a result, KDevelop's code understanding will likely be broken.\n"
"\n"
"To fix this issue, please ensure that the project's CMakeLists.txt files"
" are correct, and KDevelop is configured to use the correct CMake version and settings."
" Then right-click the project item in the projects tool view and click 'Reload'.", errorMessage));
" Then right-click the project item in the projects tool view and click 'Reload'.",
projectName, errorMessage));
}
QPair<QWidget*, KTextEditor::Range> CMakeManager::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position)
......
......@@ -162,7 +162,7 @@ private:
KTextEditor::Range termRangeAtPosition(const KTextEditor::Document* textDocument,
const KTextEditor::Cursor& position) const;
void showConfigureErrorMessage(const QString& errorMessage) const;
void showConfigureErrorMessage(const QString& projectName, const QString& errorMessage) const;
private:
QHash<KDevelop::IProject*, CMakeProjectData> m_projects;
......
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