blob: 4acd3186c67c1959b676a0e34ff09ed9ace63841 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
// 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
#include "qifserviceobject.h"
#include <QUuid>
QT_BEGIN_NAMESPACE
/*!
\class QIfServiceObject
\inmodule QtInterfaceFramework
\brief Provides the connection point to a Backend Service.
QIfServiceObject provides you with a list of interfaces that the Backend implements.
Use interfaceInstance() to obtain a QObject that implements this interface. The
interface returned may contain signals that a Feature implementing this interface
needs to be connected to.
\sa QIfAbstractFeature
*/
/*!
\qmltype ServiceObject
\nativetype QIfServiceObject
\inqmlmodule QtInterfaceFramework
\brief Provides the connection point to a Backend Service.
ServiceObject provides you with a list of interfaces that the Backend implements.
From QML the object is mainly used to assign it manually to a AbstractFeature derived object or
to update the service settings.
*/
/*!
Constructor.
\a parent is passed on to \l QObject.
*/
QIfServiceObject::QIfServiceObject(QObject *parent)
: QObject(parent)
, m_id(QUuid::createUuid().toString())
{
}
/*!
\qmlproperty string ServiceObject::id
\brief A unique ID for the service object instance.
Holds the unique ID of the service object
*/
/*!
\property QIfServiceObject::id
\brief A unique ID for the service object instance.
Each service object has a unique ID. When subclassing, the id()
function can be overloaded to modify how this ID is generated.
*/
/*!
\qmlproperty string ServiceObject::configurationId
\brief Holds the id to determine which configuration this service object belongs to.
\since 6.5
Once the id has been set, it is possible to change certain values using the
\l InterfaceFrameworkConfiguration API.
\note Values set in the matching \l InterfaceFrameworkConfiguration can override the initial
values set during the component creation.
\sa InterfaceFrameworkConfiguration
*/
/*!
\property QIfServiceObject::configurationId
\brief Holds the id to determine which configuration this service object belongs to.
\since 6.5
Once the id has been set, it is possible to change certain values using the
\l QIfConfiguration API.
\note Values set in the matching \l QIfConfiguration can override the initial values
set during the component creation.
\sa QIfConfiguration
*/
/*!
The id() function can be overloaded to modify how the unique ID is generated,
for use by this service object.
By default, QUuid::createUuid() is used.
*/
QString QIfServiceObject::id() const
{
QString id = QIfServiceInterface::id();
if (!id.isEmpty())
return id;
return m_id;
}
/*!
\qmlproperty variant ServiceObject::serviceSettings
\brief The settings for the service object instance.
\since 6.5
The serviceSettings property contains a map of settings for the service object instance.
\sa {Backend specific configuration option}
*/
/*!
\property QIfServiceObject::serviceSettings
\brief The settings for the service object instance.
\since 6.5
The serviceSettings property contains a map of settings for the service object instance.
\sa {Backend specific configuration option}
*/
const QVariantMap &QIfServiceObject::serviceSettings() const
{
return m_serviceSettings;
}
void QIfServiceObject::updateServiceSettings(const QVariantMap &settings)
{
if (m_serviceSettings == settings)
return;
m_serviceSettings = settings;
emit serviceSettingsChanged();
}
QT_END_NAMESPACE
#include "moc_qifserviceobject.cpp"
|