Changeset View
Changeset View
Standalone View
Standalone View
src/client/screencasting.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
3 | | ||||
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL | ||||
5 | */ | ||||
6 | | ||||
7 | #pragma once | ||||
8 | | ||||
9 | #include <QVector> | ||||
10 | #include <QObject> | ||||
11 | #include <QSharedPointer> | ||||
12 | #include <optional> | ||||
13 | | ||||
14 | #include "registry.h" | ||||
15 | #include <KWayland/Client/kwaylandclient_export.h> | ||||
16 | | ||||
17 | struct zkde_screencast_unstable_v1; | ||||
18 | | ||||
19 | namespace KWayland | ||||
20 | { | ||||
21 | namespace Client | ||||
22 | { | ||||
23 | class EventQueue; | ||||
24 | class ScreencastingPrivate; | ||||
25 | class ScreencastingSourcePrivate; | ||||
26 | class ScreencastingStreamPrivate; | ||||
27 | | ||||
28 | class KWAYLANDCLIENT_EXPORT ScreencastingSource | ||||
29 | { | ||||
30 | Q_GADGET | ||||
31 | public: | ||||
32 | ScreencastingSource(); | ||||
33 | ScreencastingSource(const ScreencastingSource& other); | ||||
34 | virtual ~ScreencastingSource(); | ||||
35 | | ||||
36 | quint32 sourceId() const; | ||||
37 | QString iconName() const; | ||||
38 | QString description() const; | ||||
39 | bool isOutput() const; | ||||
40 | QRect geometry() const; | ||||
41 | QSize size() const; | ||||
42 | | ||||
43 | bool operator!=(const ScreencastingSource& other) const; | ||||
44 | | ||||
45 | protected: | ||||
46 | ScreencastingSource(quint32 sourceId, const QString &description, const QString &iconName, bool isOutput, const QRect &geometry, const QSize &size); | ||||
47 | | ||||
48 | private: | ||||
49 | friend class ScreencastingPrivate; | ||||
50 | QSharedPointer<const ScreencastingSourcePrivate> d; | ||||
51 | }; | ||||
52 | | ||||
53 | class KWAYLANDCLIENT_EXPORT ScreencastingStream : public QObject | ||||
54 | { | ||||
55 | Q_OBJECT | ||||
56 | public: | ||||
57 | ScreencastingStream(QObject* parent); | ||||
58 | ~ScreencastingStream() override; | ||||
59 | | ||||
60 | void close(); | ||||
61 | | ||||
62 | Q_SIGNALS: | ||||
63 | void created(quint32 nodeid); | ||||
64 | void failed(const QString &error); | ||||
65 | void closed(); | ||||
66 | | ||||
67 | private: | ||||
68 | friend class Screencasting; | ||||
69 | QScopedPointer<ScreencastingStreamPrivate> d; | ||||
70 | }; | ||||
71 | | ||||
72 | class KWAYLANDCLIENT_EXPORT Screencasting : public QObject | ||||
73 | { | ||||
74 | Q_OBJECT | ||||
75 | public: | ||||
76 | explicit Screencasting(QObject *parent = nullptr); | ||||
77 | explicit Screencasting(Registry *registry, int id, int version, QObject *parent = nullptr); | ||||
78 | ~Screencasting() override; | ||||
79 | | ||||
80 | QVector<ScreencastingSource> sources() const; | ||||
81 | | ||||
82 | ScreencastingStream* create(const ScreencastingSource& source); | ||||
83 | | ||||
84 | void setEventQueue(EventQueue *queue); | ||||
85 | void setup(zkde_screencast_unstable_v1* screencasting); | ||||
86 | void destroy(); | ||||
87 | | ||||
88 | Q_SIGNALS: | ||||
89 | void initialized(); | ||||
90 | void removed(); | ||||
91 | void sourcesChanged(); | ||||
92 | | ||||
93 | private: | ||||
94 | QScopedPointer<ScreencastingPrivate> d; | ||||
95 | }; | ||||
96 | | ||||
97 | } | ||||
98 | } | ||||
99 | | ||||
100 | Q_DECLARE_METATYPE(KWayland::Client::ScreencastingSource) |