aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qbsprojectmanager/qbsprofilemanager.h
blob: cf479b2b01ae4945561e1a77cdf550f70c3d272c (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
51
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "qbsprojectmanager_global.h"

#include <QList>
#include <QVariant>

namespace ProjectExplorer { class Kit; }

namespace QbsProjectManager {
namespace Internal {
class DefaultPropertyProvider;

QString toJSLiteral(const QVariant &val);
QVariant fromJSLiteral(const QString &str);

class QbsProfileManager : public QObject
{
    Q_OBJECT

public:
    QbsProfileManager();
    ~QbsProfileManager() override;

    static QbsProfileManager *instance();

    static QString ensureProfileForKit(const ProjectExplorer::Kit *k);
    static QString profileNameForKit(const ProjectExplorer::Kit *kit);
    static void updateProfileIfNecessary(const ProjectExplorer::Kit *kit);
    enum class QbsConfigOp { Get, Set, Unset, AddProfile };
    static QString runQbsConfig(QbsConfigOp op, const QString &key, const QVariant &value = {});

signals:
    void qbsProfilesUpdated();

private:
    void addProfileFromKit(const ProjectExplorer::Kit *k);
    void updateAllProfiles();

    void handleKitUpdate(ProjectExplorer::Kit *kit);
    void handleKitRemoval(ProjectExplorer::Kit *kit);

    DefaultPropertyProvider *m_defaultPropertyProvider;
    QList<ProjectExplorer::Kit *> m_kitsToBeSetupForQbs;
};

} // namespace Internal
} // namespace QbsProjectManager