aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/vcpkg/vcpkgplugin.cpp
blob: 5dc1609c733d0703da9be964fcd2be94d960c2a3 (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifdef WITH_TESTS
#include "vcpkg_test.h"
#endif // WITH_TESTS
#include "vcpkgmanifesteditor.h"
#include "vcpkgsettings.h"

#include <extensionsystem/iplugin.h>

#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>

using namespace ProjectExplorer;

namespace Vcpkg::Internal {

class VcpkgPlugin final : public ExtensionSystem::IPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Vcpkg.json")

public:
    void initialize() final
    {
        setupVcpkgManifestEditor();

#ifdef WITH_TESTS
        addTestCreator(createVcpkgSearchTest);
#endif
    }

    void extensionsInitialized() final
    {
        settings(nullptr)->setVcpkgRootEnvironmentVariable();

        connect(
            ProjectManager::instance(),
            &ProjectManager::startupProjectChanged,
            this,
            [](Project *project) { settings(project)->setVcpkgRootEnvironmentVariable(); });
    }
};

} // namespace Vcpkg::Internal

#include "vcpkgplugin.moc"