summaryrefslogtreecommitdiffstats
path: root/src/interfaceframework/qifserviceobject.h
blob: 09aef40ad35210f1586bdbdfd431fa049f42bb7f (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
52
53
54
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QIFSERVICEOBJECT_H
#define QIFSERVICEOBJECT_H

#include <QtCore/QObject>
#include <QtInterfaceFramework/QIfServiceInterface>
#include <QtInterfaceFramework/qtifglobal.h>

QT_BEGIN_NAMESPACE

class Q_QTINTERFACEFRAMEWORK_EXPORT QIfServiceObject : public QObject, public QIfServiceInterface
{
    Q_OBJECT
    QML_NAMED_ELEMENT(ServiceObject)
    QML_UNCREATABLE("ServiceObject needs to be created by IfServiceManager")
    Q_INTERFACES(QIfServiceInterface)

    Q_PROPERTY(QString id READ id CONSTANT FINAL)
    Q_PROPERTY(QString configurationId READ configurationId CONSTANT FINAL REVISION(6, 5))
    Q_PROPERTY(QVariantMap serviceSettings READ serviceSettings WRITE updateServiceSettings NOTIFY serviceSettingsChanged FINAL REVISION(6, 5))

public:
    explicit QIfServiceObject(QObject *parent = nullptr);

    virtual QString id() const override;

    const QVariantMap &serviceSettings() const;
    void updateServiceSettings(const QVariantMap &settings) override;

Q_SIGNALS:
    Q_REVISION(6, 5) void serviceSettingsChanged();

private:
    QString m_id;
    QVariantMap m_serviceSettings;
};

namespace qtif_private {
    class ServiceObjectListRegistration
    {
        Q_GADGET
        QML_FOREIGN(QList<QIfServiceObject *>)
        QML_ANONYMOUS
        QML_SEQUENTIAL_CONTAINER(QIfServiceObject *)
    };
}

QT_END_NAMESPACE

#endif // QIFSERVICEOBJECT_H