From db6763ba3062253f74e7ef392e974e244d844206 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 25 Jul 2024 13:51:42 +0200 Subject: [PATCH] Axivion: Take version into account for line markers Line markers for issues were fixed to the latest analysis version. Explicitly make use of the analysis version the user selected as end version. Change-Id: I39e95693d4aa7d370447a2bb2b35fb28543a031d Reviewed-by: Jarek Kobus --- src/plugins/axivion/axivionoutputpane.cpp | 7 ++++++- src/plugins/axivion/axivionplugin.cpp | 17 ++++++++++++++++- src/plugins/axivion/axivionplugin.h | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index fa15362e32d..48c612f40ed 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -135,6 +135,7 @@ void DashboardWidget::updateUi() return; const Dto::AnalysisVersionDto &last = info.versions.back(); + setAnalysisVersion(last.date); if (last.linesOfCode.has_value()) m_loc->setText(QString::number(last.linesOfCode.value())); const QDateTime timeStamp = QDateTime::fromString(last.date, Qt::ISODate); @@ -331,7 +332,11 @@ IssuesWidget::IssuesWidget(QWidget *parent) m_versionEnd = new QComboBox(this); m_versionEnd->setMinimumContentsLength(25); - connect(m_versionEnd, &QComboBox::activated, this, &IssuesWidget::onSearchParameterChanged); + connect(m_versionEnd, &QComboBox::activated, this, [this](int index) { + onSearchParameterChanged(); + QTC_ASSERT(index > -1 && index < m_versionDates.size(), return); + setAnalysisVersion(m_versionDates.at(index)); + }); m_addedFilter = new QPushButton(this); m_addedFilter->setIcon(trendIcon(1, 0)); diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index 9cb0f172fc4..c04361959f5 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -234,6 +234,7 @@ public: NetworkAccessManager m_networkAccessManager; std::optional m_dashboardInfo; std::optional m_currentProjectInfo; + std::optional m_analysisVersion; Project *m_project = nullptr; bool m_runningQuery = false; TaskTreeRunner m_taskTreeRunner; @@ -342,6 +343,7 @@ void AxivionPluginPrivate::onStartupProjectChanged(Project *project) m_project = project; clearAllMarks(); m_currentProjectInfo = {}; + m_analysisVersion = {}; updateDashboard(); if (!m_project) { @@ -791,9 +793,10 @@ Group lineMarkerRecipe(const FilePath &filePath, const LineMarkerHandler &handle { QTC_ASSERT(dd->m_currentProjectInfo, return {}); // TODO: Call handler with unexpected? QTC_ASSERT(!filePath.isEmpty(), return {}); // TODO: Call handler with unexpected? + QTC_ASSERT(dd->m_analysisVersion, return {}); // TODO: Call handler with unexpected? const QString fileName = QString::fromUtf8(QUrl::toPercentEncoding(filePath.path())); - const QUrlQuery query({{"filename", fileName}}); + const QUrlQuery query({{"filename", fileName}, {"version", *dd->m_analysisVersion}}); const QUrl url = constructUrl(dd->m_currentProjectInfo.value().name, "files", query); return fetchDataRecipe(url, handler); } @@ -816,6 +819,7 @@ void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName) clearAllMarks(); if (projectName.isEmpty()) { m_currentProjectInfo = {}; + m_analysisVersion = {}; updateDashboard(); return; } @@ -1074,6 +1078,17 @@ const std::optional currentDashboardInfo() return dd->m_dashboardInfo; } +void setAnalysisVersion(const QString &version) +{ + QTC_ASSERT(dd, return); + if (dd->m_analysisVersion.value_or("") == version) + return; + dd->m_analysisVersion = version; + // refetch issues for already opened docs + dd->clearAllMarks(); + dd->handleOpenedDocs(); +} + Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath) { QTC_ASSERT(dd, return {}); diff --git a/src/plugins/axivion/axivionplugin.h b/src/plugins/axivion/axivionplugin.h index 1b25f7a781f..25843090c02 100644 --- a/src/plugins/axivion/axivionplugin.h +++ b/src/plugins/axivion/axivionplugin.h @@ -86,6 +86,7 @@ void fetchIssueInfo(const QString &id); void switchActiveDashboardId(const Utils::Id &toDashboardId); const std::optional currentDashboardInfo(); +void setAnalysisVersion(const QString &version); Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath);