File indexing completed on 2024-12-01 13:42:52

0001 /*
0002  * SPDX-FileCopyrightText: 2018 Red Hat Inc
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  *
0006  * SPDX-FileCopyrightText: 2018 Jan Grulich <jgrulich@redhat.com>
0007  */
0008 
0009 #ifndef XDG_DESKTOP_PORTAL_KDE_SCREENCAST_H
0010 #define XDG_DESKTOP_PORTAL_KDE_SCREENCAST_H
0011 
0012 #include <QDBusAbstractAdaptor>
0013 #include <QDBusObjectPath>
0014 
0015 class ScreenCastPortal : public QDBusAbstractAdaptor
0016 {
0017     Q_OBJECT
0018     Q_CLASSINFO("D-Bus Interface", "org.freedesktop.impl.portal.ScreenCast")
0019     Q_PROPERTY(uint version READ version CONSTANT)
0020     Q_PROPERTY(uint AvailableSourceTypes READ AvailableSourceTypes CONSTANT)
0021     Q_PROPERTY(uint AvailableCursorModes READ AvailableCursorModes CONSTANT)
0022 public:
0023     enum SourceType {
0024         Any = 0,
0025         Monitor = 1,
0026         Window = 2,
0027         Virtual = 4,
0028     };
0029     Q_ENUM(SourceType)
0030     Q_DECLARE_FLAGS(SourceTypes, SourceType)
0031 
0032     enum CursorModes {
0033         Hidden = 1,
0034         Embedded = 2,
0035         Metadata = 4,
0036     };
0037     Q_ENUM(CursorModes)
0038 
0039     enum PersistMode {
0040         NoPersist = 0,
0041         PersistWhileRunning = 1,
0042         PersistUntilRevoked = 2,
0043     };
0044     Q_ENUM(PersistMode)
0045 
0046     explicit ScreenCastPortal(QObject *parent);
0047     ~ScreenCastPortal() override;
0048 
0049     uint version() const
0050     {
0051         return 4;
0052     }
0053     uint AvailableSourceTypes() const
0054     {
0055         return Monitor | Window;
0056     };
0057     uint AvailableCursorModes() const
0058     {
0059         return Hidden | Embedded | Metadata;
0060     };
0061 
0062 public Q_SLOTS:
0063     uint CreateSession(const QDBusObjectPath &handle,
0064                        const QDBusObjectPath &session_handle,
0065                        const QString &app_id,
0066                        const QVariantMap &options,
0067                        QVariantMap &results);
0068 
0069     uint SelectSources(const QDBusObjectPath &handle,
0070                        const QDBusObjectPath &session_handle,
0071                        const QString &app_id,
0072                        const QVariantMap &options,
0073                        QVariantMap &results);
0074 
0075     uint Start(const QDBusObjectPath &handle,
0076                const QDBusObjectPath &session_handle,
0077                const QString &app_id,
0078                const QString &parent_window,
0079                const QVariantMap &options,
0080                QVariantMap &results);
0081 
0082 private:
0083     bool inhibitionsEnabled() const;
0084 };
0085 
0086 #endif // XDG_DESKTOP_PORTAL_KDE_SCREENCAST_H