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 org_kde_kwin_screencast_unstable_v1; | ||||
18 | | ||||
19 | namespace KWayland | ||||
20 | { | ||||
21 | namespace Client | ||||
22 | { | ||||
23 | class EventQueue; | ||||
24 | class ScreencastingPrivate; | ||||
25 | class ScreencastingSourcePrivate; | ||||
26 | | ||||
27 | class KWAYLANDCLIENT_EXPORT ScreencastingSource | ||||
28 | { | ||||
29 | Q_GADGET | ||||
30 | public: | ||||
31 | ScreencastingSource(); | ||||
32 | ScreencastingSource(const ScreencastingSource& other); | ||||
33 | virtual ~ScreencastingSource(); | ||||
34 | | ||||
35 | quint32 sourceId() const; | ||||
36 | QString iconName() const; | ||||
37 | QString description() const; | ||||
38 | bool isOutput() const; | ||||
39 | QRect geometry() const; | ||||
40 | | ||||
41 | bool operator!=(const ScreencastingSource& other) const; | ||||
42 | | ||||
43 | protected: | ||||
44 | ScreencastingSource(quint32 sourceId, const QString &description, const QString &iconName, bool isOutput, const QRect &geometry); | ||||
45 | | ||||
46 | private: | ||||
47 | friend class ScreencastingPrivate; | ||||
48 | QSharedPointer<const ScreencastingSourcePrivate> d; | ||||
49 | }; | ||||
50 | | ||||
51 | class KWAYLANDCLIENT_EXPORT Screencasting : public QObject | ||||
52 | { | ||||
53 | Q_OBJECT | ||||
54 | public: | ||||
55 | explicit Screencasting(QObject *parent = nullptr); | ||||
56 | explicit Screencasting(Registry *registry, int id, int version, QObject *parent = nullptr); | ||||
57 | ~Screencasting() override; | ||||
58 | | ||||
59 | QVector<ScreencastingSource> sources() const; | ||||
60 | | ||||
61 | void create(const ScreencastingSource& source); | ||||
62 | void close(quint32 nodeid); | ||||
63 | | ||||
64 | void setEventQueue(EventQueue *queue); | ||||
65 | void setup(org_kde_kwin_screencast_unstable_v1* screencasting); | ||||
66 | void destroy(); | ||||
67 | | ||||
68 | Q_SIGNALS: | ||||
69 | void initialized(); | ||||
70 | void created(const ScreencastingSource& source, quint32 nodeid); | ||||
71 | void failed(const ScreencastingSource& source, const QString &error); | ||||
72 | void closed(quint32 nodeid); | ||||
73 | void removed(); | ||||
74 | void sourcesChanged(); | ||||
75 | | ||||
76 | private: | ||||
77 | QScopedPointer<ScreencastingPrivate> d; | ||||
78 | }; | ||||
79 | | ||||
80 | } | ||||
81 | } | ||||
82 | | ||||
83 | Q_DECLARE_METATYPE(KWayland::Client::ScreencastingSource); |