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