1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQMLGRPCHTTP2CHANNEL_H
5#define QQMLGRPCHTTP2CHANNEL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGrpcQuick/private/qqmlgrpcchanneloptions_p.h>
19#include <QtGrpcQuick/qqmlabstractgrpcchannel.h>
20#include <QtGrpcQuick/qtgrpcquickexports.h>
21
22#include <QtQmlIntegration/qqmlintegration.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlGrpcHttp2ChannelPrivate;
27class Q_GRPCQUICK_EXPORT QQmlGrpcHttp2Channel : public QQmlAbstractGrpcChannel
28{
29 Q_OBJECT
30 QML_NAMED_ELEMENT(GrpcHttp2Channel)
31 QML_ADDED_IN_VERSION(6, 7)
32 Q_PROPERTY(QUrl hostUri READ hostUri WRITE setHostUri NOTIFY hostUriChanged REQUIRED)
33 Q_PROPERTY(QQmlGrpcChannelOptions *options READ options WRITE setOptions NOTIFY optionsChanged)
34 Q_PROPERTY(std::shared_ptr<QAbstractGrpcChannel> channel READ channel NOTIFY channelUpdated)
35
36public:
37 explicit QQmlGrpcHttp2Channel(QObject *parent = nullptr);
38 ~QQmlGrpcHttp2Channel() override;
39
40 std::shared_ptr<QAbstractGrpcChannel> channel() const final;
41
42 QQmlGrpcChannelOptions *options() const noexcept;
43 void setOptions(QQmlGrpcChannelOptions *options);
44
45 QUrl hostUri() const noexcept;
46 void setHostUri(const QUrl &hostUri);
47
48Q_SIGNALS:
49 void optionsChanged();
50 void channelUpdated();
51 void hostUriChanged();
52
53private:
54 void updateChannel();
55
56 Q_DECLARE_PRIVATE(QQmlGrpcHttp2Channel)
57};
58
59QT_END_NAMESPACE
60
61#endif // QQMLGRPCHTTP2CHANNEL_H
62

source code of qtgrpc/src/grpcquick/qqmlgrpchttp2channel_p.h