Axivion: Store origin URL besides payload gotten from Dashboard

This prepares using (relative) URLs gotten from Dashboard instead of using
hard-coded ones.

Change-Id: Iea19c4010eac1e3f30a33d495a738d37738dc083
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Andreas Loth
2023-09-15 14:38:48 +02:00
parent 1439d3170b
commit fc9059d180
5 changed files with 34 additions and 19 deletions

View File

@@ -47,7 +47,7 @@ class AxivionPluginPrivate : public QObject
public:
void onStartupProjectChanged();
void fetchProjectInfo(const QString &projectName);
void handleProjectInfo(Utils::expected_str<Dto::ProjectInfoDto> rawInfo);
void handleProjectInfo(DashboardClient::RawProjectInfo rawInfo);
void handleOpenedDocs(ProjectExplorer::Project *project);
void onDocumentOpened(Core::IDocument *doc);
void onDocumentClosed(Core::IDocument * doc);
@@ -57,7 +57,7 @@ public:
Utils::NetworkAccessManager *m_networkAccessManager = Utils::NetworkAccessManager::instance();
AxivionOutputPane m_axivionOutputPane;
std::shared_ptr<const Dto::ProjectInfoDto> m_currentProjectInfo;
std::shared_ptr<const DashboardClient::ProjectInfo> m_currentProjectInfo;
bool m_runningQuery = false;
};
@@ -122,7 +122,7 @@ void AxivionPlugin::fetchProjectInfo(const QString &projectName)
dd->fetchProjectInfo(projectName);
}
std::shared_ptr<const Dto::ProjectInfoDto> AxivionPlugin::projectInfo()
std::shared_ptr<const DashboardClient::ProjectInfo> AxivionPlugin::projectInfo()
{
QTC_ASSERT(dd, return {});
return dd->m_currentProjectInfo;
@@ -207,14 +207,14 @@ void AxivionPluginPrivate::clearAllMarks()
onDocumentClosed(doc);
}
void AxivionPluginPrivate::handleProjectInfo(Utils::expected_str<Dto::ProjectInfoDto> rawInfo)
void AxivionPluginPrivate::handleProjectInfo(DashboardClient::RawProjectInfo rawInfo)
{
m_runningQuery = false;
if (!rawInfo) {
Core::MessageManager::writeFlashing(QStringLiteral(u"Axivion: ") + rawInfo.error());
return;
}
m_currentProjectInfo = std::make_shared<const Dto::ProjectInfoDto>(std::move(rawInfo.value()));
m_currentProjectInfo = std::make_shared<const DashboardClient::ProjectInfo>(std::move(rawInfo.value()));
m_axivionOutputPane.updateDashboard();
// handle already opened documents
if (auto buildSystem = ProjectExplorer::ProjectManager::startupBuildSystem();
@@ -238,7 +238,7 @@ void AxivionPluginPrivate::onDocumentOpened(Core::IDocument *doc)
Utils::FilePath relative = doc->filePath().relativeChildPath(project->projectDirectory());
// for now only style violations
AxivionQuery query(AxivionQuery::IssuesForFileList, {m_currentProjectInfo->name, "SV",
AxivionQuery query(AxivionQuery::IssuesForFileList, {m_currentProjectInfo->data.name, "SV",
relative.path() } );
AxivionQueryRunner *runner = new AxivionQueryRunner(query, this);
connect(runner, &AxivionQueryRunner::resultRetrieved, this, [this](const QByteArray &result){