Axivion: Hide plugin class definition in .cpp

This is not meant to be accessed from the outside.

Change-Id: Ieae4d1ef760e1c6829ea8a1c2ae7945198198634
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2024-01-12 08:38:31 +01:00
parent 2a2772ba40
commit cd2068e967
5 changed files with 42 additions and 52 deletions

View File

@@ -94,7 +94,7 @@ void DashboardWidget::updateUi()
delete child->widget();
delete child;
}
std::shared_ptr<const DashboardClient::ProjectInfo> projectInfo = AxivionPlugin::projectInfo();
std::shared_ptr<const DashboardClient::ProjectInfo> projectInfo = Internal::projectInfo();
if (!projectInfo)
return;
const Dto::ProjectInfoDto &info = projectInfo->data;

View File

@@ -17,6 +17,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <extensionsystem/iplugin.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildsystem.h>
@@ -98,35 +99,13 @@ AxivionTextMark::AxivionTextMark(const Utils::FilePath &filePath, const ShortIss
});
}
AxivionPlugin::~AxivionPlugin()
{
AxivionProjectSettings::destroyProjectSettings();
delete dd;
dd = nullptr;
}
void AxivionPlugin::initialize()
{
dd = new AxivionPluginPrivate;
AxivionProjectSettings::setupProjectPanel();
connect(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::ProjectManager::startupProjectChanged,
dd, &AxivionPluginPrivate::onStartupProjectChanged);
connect(Core::EditorManager::instance(), &Core::EditorManager::documentOpened,
dd, &AxivionPluginPrivate::onDocumentOpened);
connect(Core::EditorManager::instance(), &Core::EditorManager::documentClosed,
dd, &AxivionPluginPrivate::onDocumentClosed);
}
void AxivionPlugin::fetchProjectInfo(const QString &projectName)
void fetchProjectInfo(const QString &projectName)
{
QTC_ASSERT(dd, return);
dd->fetchProjectInfo(projectName);
}
std::shared_ptr<const DashboardClient::ProjectInfo> AxivionPlugin::projectInfo()
std::shared_ptr<const DashboardClient::ProjectInfo> projectInfo()
{
QTC_ASSERT(dd, return {});
return dd->m_currentProjectInfo;
@@ -134,7 +113,7 @@ std::shared_ptr<const DashboardClient::ProjectInfo> AxivionPlugin::projectInfo()
// FIXME: extend to give some details?
// FIXME: move when curl is no more in use?
bool AxivionPlugin::handleCertificateIssue()
bool handleCertificateIssue()
{
QTC_ASSERT(dd, return false);
const QString serverHost = QUrl(settings().server.dashboard).host();
@@ -170,7 +149,7 @@ void AxivionPluginPrivate::handleSslErrors(QNetworkReply *reply, const QList<QSs
};
if (Utils::allOf(errors,
[&accepted](const QSslError &e) { return accepted.contains(e.error()); })) {
if (!settings().server.validateCert || AxivionPlugin::handleCertificateIssue())
if (!settings().server.validateCert || handleCertificateIssue())
reply->ignoreSslErrors(errors);
}
#else // ssl
@@ -334,4 +313,34 @@ void AxivionPluginPrivate::handleIssuesForFile(const IssuesList &issues)
}
}
class AxivionPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Axivion.json")
~AxivionPlugin() final
{
AxivionProjectSettings::destroyProjectSettings();
delete dd;
dd = nullptr;
}
void initialize() final
{
dd = new AxivionPluginPrivate;
AxivionProjectSettings::setupProjectPanel();
connect(ProjectExplorer::ProjectManager::instance(),
&ProjectExplorer::ProjectManager::startupProjectChanged,
dd, &AxivionPluginPrivate::onStartupProjectChanged);
connect(Core::EditorManager::instance(), &Core::EditorManager::documentOpened,
dd, &AxivionPluginPrivate::onDocumentOpened);
connect(Core::EditorManager::instance(), &Core::EditorManager::documentClosed,
dd, &AxivionPluginPrivate::onDocumentClosed);
}
};
} // Axivion::Internal
#include "axivionplugin.moc"

View File

@@ -5,34 +5,15 @@
#include "dashboard/dashboardclient.h"
#include <extensionsystem/iplugin.h>
#include <memory>
namespace ProjectExplorer { class Project; }
namespace Axivion::Internal {
class AxivionProjectSettings;
class ProjectInfo;
class AxivionPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Axivion.json")
public:
AxivionPlugin() {}
~AxivionPlugin() final;
static void fetchProjectInfo(const QString &projectName);
static std::shared_ptr<const DashboardClient::ProjectInfo> projectInfo();
static bool handleCertificateIssue();
private:
void initialize() final;
void extensionsInitialized() final {}
};
void fetchProjectInfo(const QString &projectName);
std::shared_ptr<const DashboardClient::ProjectInfo> projectInfo();
bool handleCertificateIssue();
} // Axivion::Internal

View File

@@ -207,7 +207,7 @@ void AxivionProjectSettingsWidget::linkProject()
const QString projectName = selected.first()->text(0);
m_projectSettings->setDashboardProjectName(projectName);
updateUi();
AxivionPlugin::fetchProjectInfo(projectName);
fetchProjectInfo(projectName);
}
void AxivionProjectSettingsWidget::unlinkProject()
@@ -216,7 +216,7 @@ void AxivionProjectSettingsWidget::unlinkProject()
m_projectSettings->setDashboardProjectName({});
updateUi();
AxivionPlugin::fetchProjectInfo({});
fetchProjectInfo({});
}
void AxivionProjectSettingsWidget::updateUi()

View File

@@ -70,7 +70,7 @@ AxivionQueryRunner::AxivionQueryRunner(const AxivionQuery &query, QObject *paren
const int exitCode = m_process.exitCode();
if (m_process.exitStatus() == QProcess::NormalExit
&& (exitCode == 35 || exitCode == 60)
&& AxivionPlugin::handleCertificateIssue()) {
&& handleCertificateIssue()) {
// prepend -k for re-requesting same query
CommandLine cmdline = m_process.commandLine();
cmdline.prependArgs({"-k"});