File indexing completed on 2024-04-14 15:33:31
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 <QObject> 0010 #include <QDBusObjectPath> 0011 0012 class QTimer; 0013 class QQmlApplicationEngine; 0014 0015 struct Stream { 0016 uint id; 0017 QVariantMap opts; 0018 }; 0019 0020 class OrgFreedesktopPortalScreenCastInterface; 0021 0022 class RecordMe : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 RecordMe(QObject* parent = nullptr); 0027 ~RecordMe() override; 0028 0029 enum CursorModes { 0030 Hidden = 1, 0031 Embedded = 2, 0032 Metadata = 4 0033 }; 0034 Q_ENUM(CursorModes); 0035 0036 enum SourceTypes { 0037 Monitor = 1, 0038 Window = 2 0039 }; 0040 Q_ENUM(SourceTypes); 0041 0042 void setDuration(int duration); 0043 0044 public Q_SLOTS: 0045 void response(uint code, const QVariantMap& results); 0046 0047 private: 0048 void init(const QDBusObjectPath &path); 0049 void handleStreams(const QVector<Stream> &streams); 0050 void start(); 0051 0052 OrgFreedesktopPortalScreenCastInterface *iface; 0053 QDBusObjectPath m_path; 0054 QTimer* const m_durationTimer; 0055 const QString m_handleToken; 0056 QQmlApplicationEngine* m_engine; 0057 };