File indexing completed on 2024-12-01 11:07:07
0001 /* 0002 SPDX-FileCopyrightText: 2022 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 <QDBusObjectPath> 0010 #include <QObject> 0011 #include <QRect> 0012 #include <screencasting.h> 0013 0014 class QQmlApplicationEngine; 0015 class QTimer; 0016 class Screencasting; 0017 0018 namespace KWayland { 0019 namespace Client { 0020 class Registry; 0021 class PlasmaWindowManagement; 0022 class Output; 0023 class XdgOutputManager; 0024 } 0025 } 0026 class ScreencastingStream; 0027 class OrgFreedesktopPortalScreenCastInterface; 0028 0029 class PlasmaRecordMe : public QObject 0030 { 0031 Q_OBJECT 0032 public: 0033 PlasmaRecordMe(Screencasting::CursorMode cursorMode, const QString &source, QObject *parent = nullptr); 0034 ~PlasmaRecordMe() override; 0035 0036 void setDuration(int duration); 0037 0038 Q_SCRIPTABLE void createVirtualMonitor(); 0039 0040 Q_SIGNALS: 0041 void cursorModeChanged(Screencasting::CursorMode cursorMode); 0042 void workspaceChanged(); 0043 0044 private: 0045 void start(ScreencastingStream* stream); 0046 0047 const Screencasting::CursorMode m_cursorMode; 0048 QTimer* const m_durationTimer; 0049 const QString m_sourceName; 0050 QVector<std::function<void()>> m_delayed; 0051 KWayland::Client::PlasmaWindowManagement* m_management = nullptr; 0052 Screencasting* m_screencasting = nullptr; 0053 QQmlApplicationEngine* m_engine; 0054 ScreencastingStream *m_workspaceStream = nullptr; 0055 QRect m_workspace; 0056 };