forked from qt-creator/qt-creator
Docker: Simplify plugin definition
Change-Id: If37a8df1292f01f1048549adb135a65fda66a09f Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -8,7 +8,7 @@ add_qtc_plugin(Docker
|
||||
dockerconstants.h
|
||||
dockerdevice.cpp dockerdevice.h
|
||||
dockerdevicewidget.cpp dockerdevicewidget.h
|
||||
dockerplugin.cpp dockerplugin.h
|
||||
dockerplugin.cpp
|
||||
dockersettings.cpp dockersettings.h
|
||||
kitdetector.cpp kitdetector.h
|
||||
)
|
||||
|
@@ -20,7 +20,6 @@ QtcPlugin {
|
||||
"dockerdevicewidget.cpp",
|
||||
"dockerdevicewidget.h",
|
||||
"dockerplugin.cpp",
|
||||
"dockerplugin.h",
|
||||
"dockersettings.cpp",
|
||||
"dockersettings.h",
|
||||
"kitdetector.cpp",
|
||||
|
@@ -1,16 +1,15 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "dockerplugin.h"
|
||||
|
||||
#include "dockerapi.h"
|
||||
#include "dockerconstants.h"
|
||||
#include "dockerdevice.h"
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/fsengine/fsengine.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
@@ -18,32 +17,34 @@ using namespace Utils;
|
||||
|
||||
namespace Docker::Internal {
|
||||
|
||||
class DockerPluginPrivate
|
||||
class DockerPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Docker.json")
|
||||
|
||||
public:
|
||||
~DockerPluginPrivate()
|
||||
{
|
||||
m_deviceFactory.shutdownExistingDevices();
|
||||
}
|
||||
|
||||
DockerDeviceFactory m_deviceFactory;
|
||||
DockerApi m_dockerApi;
|
||||
};
|
||||
|
||||
DockerPlugin::DockerPlugin()
|
||||
DockerPlugin()
|
||||
{
|
||||
FSEngine::registerDeviceScheme(Constants::DOCKER_DEVICE_SCHEME);
|
||||
}
|
||||
|
||||
DockerPlugin::~DockerPlugin()
|
||||
private:
|
||||
~DockerPlugin() final
|
||||
{
|
||||
FSEngine::unregisterDeviceScheme(Constants::DOCKER_DEVICE_SCHEME);
|
||||
delete d;
|
||||
m_deviceFactory->shutdownExistingDevices();
|
||||
}
|
||||
|
||||
void DockerPlugin::initialize()
|
||||
void initialize() final
|
||||
{
|
||||
d = new DockerPluginPrivate;
|
||||
m_deviceFactory = std::make_unique<DockerDeviceFactory>();
|
||||
m_dockerApi = std::make_unique<DockerApi>();
|
||||
}
|
||||
|
||||
} // Docker::Interanl
|
||||
std::unique_ptr<DockerDeviceFactory> m_deviceFactory;
|
||||
std::unique_ptr<DockerApi> m_dockerApi;
|
||||
};
|
||||
|
||||
} // Docker::Internal
|
||||
|
||||
#include "dockerplugin.moc"
|
||||
|
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
namespace Docker::Internal {
|
||||
|
||||
class DockerPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Docker.json")
|
||||
|
||||
public:
|
||||
DockerPlugin();
|
||||
|
||||
private:
|
||||
~DockerPlugin() final;
|
||||
|
||||
void initialize() final;
|
||||
|
||||
class DockerPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // Docker::Internal
|
Reference in New Issue
Block a user