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
|
// 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 QIFABSTRACTFEATURE_H
#define QIFABSTRACTFEATURE_H
#include <QtCore/QObject>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlParserStatus>
#include <QtInterfaceFramework/qtifglobal.h>
QT_BEGIN_NAMESPACE
class QIfServiceObject;
class QIfAbstractFeaturePrivate;
class Q_QTINTERFACEFRAMEWORK_EXPORT QIfAbstractFeature : public QObject, public QQmlParserStatus
{
Q_OBJECT
QML_NAMED_ELEMENT(AbstractFeature)
QML_UNCREATABLE("")
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QIfAbstractFeature::DiscoveryMode discoveryMode READ discoveryMode WRITE setDiscoveryMode NOTIFY discoveryModeChanged)
Q_PROPERTY(QIfAbstractFeature::DiscoveryResult discoveryResult READ discoveryResult NOTIFY discoveryResultChanged)
Q_PROPERTY(QIfServiceObject *serviceObject READ serviceObject WRITE setServiceObject NOTIFY serviceObjectChanged)
Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
Q_PROPERTY(bool isInitialized READ isInitialized NOTIFY isInitializedChanged)
Q_PROPERTY(QString error READ errorMessage NOTIFY errorChanged)
Q_PROPERTY(QString configurationId READ configurationId WRITE setConfigurationId NOTIFY configurationIdChanged REVISION(6, 5))
Q_PROPERTY(QStringList preferredBackends READ preferredBackends WRITE setPreferredBackends NOTIFY preferredBackendsChanged REVISION(6, 5))
public:
enum Error {
NoError,
PermissionDenied,
InvalidOperation,
Timeout,
InvalidZone,
Unknown
};
Q_ENUM(Error)
enum DiscoveryMode {
InvalidAutoDiscovery = -1,
NoAutoDiscovery = 0,
AutoDiscovery,
LoadOnlyProductionBackends,
LoadOnlySimulationBackends
};
Q_ENUM(DiscoveryMode)
enum DiscoveryResult {
NoResult,
ErrorWhileLoading,
ProductionBackendLoaded,
SimulationBackendLoaded
};
Q_ENUM(DiscoveryResult)
explicit QIfAbstractFeature(const QString &interfaceName, QObject *parent = nullptr);
~QIfAbstractFeature() override;
QIfServiceObject *serviceObject() const;
QIfAbstractFeature::DiscoveryMode discoveryMode() const;
QIfAbstractFeature::DiscoveryResult discoveryResult() const;
bool isValid() const;
bool isInitialized() const;
QIfAbstractFeature::Error error() const;
QString errorMessage() const;
QString configurationId() const;
QStringList preferredBackends() const;
public Q_SLOTS:
bool setServiceObject(QIfServiceObject *so);
void setDiscoveryMode(QIfAbstractFeature::DiscoveryMode discoveryMode);
Q_REVISION(6, 5) void setConfigurationId(const QString &configurationId);
Q_REVISION(6, 5) void setPreferredBackends(const QStringList &preferredBackends);
QIfAbstractFeature::DiscoveryResult startAutoDiscovery();
Q_SIGNALS:
void serviceObjectChanged();
void discoveryModeChanged(QIfAbstractFeature::DiscoveryMode discoveryMode);
void discoveryResultChanged(QIfAbstractFeature::DiscoveryResult discoveryResult);
void isValidChanged(bool arg);
void isInitializedChanged(bool isInitialized);
void errorChanged(QIfAbstractFeature::Error error, const QString &message);
Q_REVISION(6, 5) void configurationIdChanged(const QString &configurationId);
Q_REVISION(6, 5) void preferredBackendsChanged(const QStringList &preferredBackends);
protected:
QIfAbstractFeature(QIfAbstractFeaturePrivate &dd, QObject *parent = nullptr);
virtual bool acceptServiceObject(QIfServiceObject*);
virtual void connectToServiceObject(QIfServiceObject*);
virtual void disconnectFromServiceObject(QIfServiceObject*);
virtual void clearServiceObject() = 0;
void classBegin() override;
void componentComplete() override;
QString interfaceName() const;
QString errorText() const;
void setError(QIfAbstractFeature::Error error, const QString &message = QString());
protected Q_SLOTS:
virtual void onErrorChanged(QIfAbstractFeature::Error error, const QString &message = QString());
private Q_SLOTS:
void serviceObjectDestroyed();
private:
Q_DECLARE_PRIVATE(QIfAbstractFeature)
Q_PRIVATE_SLOT(d_func(), void onInitializationDone())
friend class QIfFeatureTester;
friend class QIfHelperFeature;
};
QT_END_NAMESPACE
#endif // QIFABSTRACTFEATURE_H
|