forked from qt-creator/qt-creator
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 <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -135,6 +135,7 @@ void DashboardWidget::updateUi()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const Dto::AnalysisVersionDto &last = info.versions.back();
|
const Dto::AnalysisVersionDto &last = info.versions.back();
|
||||||
|
setAnalysisVersion(last.date);
|
||||||
if (last.linesOfCode.has_value())
|
if (last.linesOfCode.has_value())
|
||||||
m_loc->setText(QString::number(last.linesOfCode.value()));
|
m_loc->setText(QString::number(last.linesOfCode.value()));
|
||||||
const QDateTime timeStamp = QDateTime::fromString(last.date, Qt::ISODate);
|
const QDateTime timeStamp = QDateTime::fromString(last.date, Qt::ISODate);
|
||||||
@@ -331,7 +332,11 @@ IssuesWidget::IssuesWidget(QWidget *parent)
|
|||||||
|
|
||||||
m_versionEnd = new QComboBox(this);
|
m_versionEnd = new QComboBox(this);
|
||||||
m_versionEnd->setMinimumContentsLength(25);
|
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 = new QPushButton(this);
|
||||||
m_addedFilter->setIcon(trendIcon(1, 0));
|
m_addedFilter->setIcon(trendIcon(1, 0));
|
||||||
|
@@ -234,6 +234,7 @@ public:
|
|||||||
NetworkAccessManager m_networkAccessManager;
|
NetworkAccessManager m_networkAccessManager;
|
||||||
std::optional<DashboardInfo> m_dashboardInfo;
|
std::optional<DashboardInfo> m_dashboardInfo;
|
||||||
std::optional<Dto::ProjectInfoDto> m_currentProjectInfo;
|
std::optional<Dto::ProjectInfoDto> m_currentProjectInfo;
|
||||||
|
std::optional<QString> m_analysisVersion;
|
||||||
Project *m_project = nullptr;
|
Project *m_project = nullptr;
|
||||||
bool m_runningQuery = false;
|
bool m_runningQuery = false;
|
||||||
TaskTreeRunner m_taskTreeRunner;
|
TaskTreeRunner m_taskTreeRunner;
|
||||||
@@ -342,6 +343,7 @@ void AxivionPluginPrivate::onStartupProjectChanged(Project *project)
|
|||||||
m_project = project;
|
m_project = project;
|
||||||
clearAllMarks();
|
clearAllMarks();
|
||||||
m_currentProjectInfo = {};
|
m_currentProjectInfo = {};
|
||||||
|
m_analysisVersion = {};
|
||||||
updateDashboard();
|
updateDashboard();
|
||||||
|
|
||||||
if (!m_project) {
|
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(dd->m_currentProjectInfo, return {}); // TODO: Call handler with unexpected?
|
||||||
QTC_ASSERT(!filePath.isEmpty(), 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 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);
|
const QUrl url = constructUrl(dd->m_currentProjectInfo.value().name, "files", query);
|
||||||
return fetchDataRecipe<Dto::FileViewDto>(url, handler);
|
return fetchDataRecipe<Dto::FileViewDto>(url, handler);
|
||||||
}
|
}
|
||||||
@@ -816,6 +819,7 @@ void AxivionPluginPrivate::fetchProjectInfo(const QString &projectName)
|
|||||||
clearAllMarks();
|
clearAllMarks();
|
||||||
if (projectName.isEmpty()) {
|
if (projectName.isEmpty()) {
|
||||||
m_currentProjectInfo = {};
|
m_currentProjectInfo = {};
|
||||||
|
m_analysisVersion = {};
|
||||||
updateDashboard();
|
updateDashboard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1074,6 +1078,17 @@ const std::optional<DashboardInfo> currentDashboardInfo()
|
|||||||
return dd->m_dashboardInfo;
|
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)
|
Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(dd, return {});
|
QTC_ASSERT(dd, return {});
|
||||||
|
@@ -86,6 +86,7 @@ void fetchIssueInfo(const QString &id);
|
|||||||
|
|
||||||
void switchActiveDashboardId(const Utils::Id &toDashboardId);
|
void switchActiveDashboardId(const Utils::Id &toDashboardId);
|
||||||
const std::optional<DashboardInfo> currentDashboardInfo();
|
const std::optional<DashboardInfo> currentDashboardInfo();
|
||||||
|
void setAnalysisVersion(const QString &version);
|
||||||
|
|
||||||
Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath);
|
Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user