File indexing completed on 2024-04-28 04:58:58

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QSharedPointer>
0011 #include <QVector>
0012 #include <optional>
0013 
0014 struct zkde_screencast_unstable_v1;
0015 
0016 namespace KWayland
0017 {
0018 namespace Client
0019 {
0020 class PlasmaWindow;
0021 class Registry;
0022 class Output;
0023 }
0024 }
0025 
0026 class ScreencastingPrivate;
0027 class ScreencastingSourcePrivate;
0028 class ScreencastingStreamPrivate;
0029 class ScreencastingStream : public QObject
0030 {
0031     Q_OBJECT
0032 public:
0033     ScreencastingStream(QObject *parent);
0034     ~ScreencastingStream() override;
0035 
0036     quint32 nodeId() const;
0037 
0038 Q_SIGNALS:
0039     void created(quint32 nodeid);
0040     void failed(const QString &error);
0041     void closed();
0042 
0043 private:
0044     friend class Screencasting;
0045     QScopedPointer<ScreencastingStreamPrivate> d;
0046 };
0047 
0048 class Screencasting : public QObject
0049 {
0050     Q_OBJECT
0051 public:
0052     explicit Screencasting(QObject *parent = nullptr);
0053     explicit Screencasting(KWayland::Client::Registry *registry, int id, int version, QObject *parent = nullptr);
0054     ~Screencasting() override;
0055 
0056     enum CursorMode {
0057         Hidden = 1,
0058         Embedded = 2,
0059         Metadata = 4,
0060     };
0061     Q_ENUM(CursorMode)
0062 
0063     ScreencastingStream *createVirtualMonitorStream(const QString &name, const QSize &resolution, qreal dpr, CursorMode mode);
0064 
0065     void setup(zkde_screencast_unstable_v1 *screencasting);
0066     void destroy();
0067 
0068 Q_SIGNALS:
0069     void initialized();
0070     void removed();
0071     void sourcesChanged();
0072 
0073 private:
0074     QScopedPointer<ScreencastingPrivate> d;
0075 };