From 428898e6badc777986422d89d2a6688ad4111bd3 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 24 Jan 2024 00:06:55 +0100 Subject: [PATCH] Axivion: Load projectInfo with taken from DashboardInfo Task tree variant. Change-Id: Ie42573f78caa180ad9669e63bab8a6b920515927 Reviewed-by: Christian Stenger --- src/plugins/axivion/axivionplugin.cpp | 43 ++++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index 56b9be3df33..6225b57d114 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -384,23 +384,38 @@ void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName) return; } - const QUrl url = urlForProject(projectName); + const auto onTaskTreeSetup = [this, projectName](TaskTree &taskTree) { + if (!m_dashboardInfo) + return SetupResult::StopWithError; - const auto handler = [this](const Dto::ProjectInfoDto &data) { - m_currentProjectInfo = data; - m_axivionOutputPane.updateDashboard(); - // handle already opened documents - if (auto buildSystem = ProjectExplorer::ProjectManager::startupBuildSystem(); - !buildSystem || !buildSystem->isParsing()) { - handleOpenedDocs(nullptr); - } else { - connect(ProjectExplorer::ProjectManager::instance(), - &ProjectExplorer::ProjectManager::projectFinishedParsing, - this, &AxivionPluginPrivate::handleOpenedDocs); - } + const auto it = m_dashboardInfo->projectUrls.constFind(projectName); + if (it == m_dashboardInfo->projectUrls.constEnd()) + return SetupResult::StopWithError; + + const auto handler = [this](const Dto::ProjectInfoDto &data) { + m_currentProjectInfo = data; + m_axivionOutputPane.updateDashboard(); + // handle already opened documents + if (auto buildSystem = ProjectExplorer::ProjectManager::startupBuildSystem(); + !buildSystem || !buildSystem->isParsing()) { + handleOpenedDocs(nullptr); + } else { + connect(ProjectExplorer::ProjectManager::instance(), + &ProjectExplorer::ProjectManager::projectFinishedParsing, + this, &AxivionPluginPrivate::handleOpenedDocs); + } + }; + + const QUrl url(settings().server.dashboard); + taskTree.setRecipe(fetchDataRecipe(url.resolved(*it), handler)); + return SetupResult::Continue; }; - m_taskTreeRunner.start(fetchDataRecipe(url, handler)); + const Group root { + dashboardInfoRecipe(), + TaskTreeTask(onTaskTreeSetup) + }; + m_taskTreeRunner.start(root); } void AxivionPluginPrivate::fetchIssueTableLayout(const QString &prefix)