forked from qt-creator/qt-creator
Axivion: Partially redo handling project selection
If we cannot find the preferred project inside the selected dashboard we just dropped out with an error message which could easily be missed. Anyhow we should fetch the first available project in that case to refill other filter controls if the dashboard contains any. Only if the dashboard has no configured projects drop out early. Change-Id: Iff72ccb79b9ec3e11620ae435c5322f40269c9ef Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Mohammad Mehdi Salem Naraghi <mehdi.salem@qt.io>
This commit is contained in:
@@ -798,22 +798,12 @@ Group projectInfoRecipe(const QString &projectName)
|
||||
return SetupResult::StopWithError;
|
||||
}
|
||||
|
||||
const QString targetProjectName
|
||||
= (projectName.isEmpty() && !dd->m_dashboardInfo->projects.isEmpty())
|
||||
? dd->m_dashboardInfo->projects.first() : projectName;
|
||||
|
||||
if (targetProjectName.isEmpty()) {
|
||||
if (dd->m_dashboardInfo->projects.isEmpty()) {
|
||||
updatePerspectiveToolbar();
|
||||
updateDashboard();
|
||||
return SetupResult::StopWithSuccess;
|
||||
}
|
||||
|
||||
const auto it = dd->m_dashboardInfo->projectUrls.constFind(targetProjectName);
|
||||
if (it == dd->m_dashboardInfo->projectUrls.constEnd()) {
|
||||
MessageManager::writeDisrupting(QString("Axivion: %1")
|
||||
.arg(Tr::tr("The DashboardInfo doesn't contain project \"%1\".").arg(targetProjectName)));
|
||||
return SetupResult::StopWithError;
|
||||
}
|
||||
|
||||
const auto handler = [](const Dto::ProjectInfoDto &data) {
|
||||
dd->m_currentProjectInfo = data;
|
||||
if (!dd->m_currentProjectInfo->versions.empty())
|
||||
@@ -822,6 +812,11 @@ Group projectInfoRecipe(const QString &projectName)
|
||||
updateDashboard();
|
||||
};
|
||||
|
||||
const QString targetProjectName = projectName.isEmpty()
|
||||
? dd->m_dashboardInfo->projects.first() : projectName;
|
||||
auto it = dd->m_dashboardInfo->projectUrls.constFind(targetProjectName);
|
||||
if (it == dd->m_dashboardInfo->projectUrls.constEnd())
|
||||
it = dd->m_dashboardInfo->projectUrls.constBegin();
|
||||
taskTree.setRecipe(
|
||||
fetchDataRecipe<Dto::ProjectInfoDto>(dd->m_dashboardInfo->source.resolved(*it), handler));
|
||||
return SetupResult::Continue;
|
||||
|
Reference in New Issue
Block a user