aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/docker/dockerplugin.cpp
blob: eb4ce5a74680152045d1fd9248c5b61a3c931f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 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 "dockerapi.h"
#include "dockerconstants.h"
#include "dockerdevice.h"

#include <extensionsystem/iplugin.h>

#include <projectexplorer/projectexplorerconstants.h>

#include <utils/fsengine/fsengine.h>

using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;

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()
    {
        FSEngine::registerDeviceScheme(Constants::DOCKER_DEVICE_SCHEME);
    }

private:
    ~DockerPlugin() final
    {
        FSEngine::unregisterDeviceScheme(Constants::DOCKER_DEVICE_SCHEME);
        m_deviceFactory->shutdownExistingDevices();
    }

    void initialize() final
    {
        m_deviceFactory = std::make_unique<DockerDeviceFactory>();
        m_dockerApi = std::make_unique<DockerApi>();
    }

    std::unique_ptr<DockerDeviceFactory> m_deviceFactory;
    std::unique_ptr<DockerApi> m_dockerApi;
};

} // Docker::Internal

#include "dockerplugin.moc"