summaryrefslogtreecommitdiffstats
path: root/src/core/api/qwebenginedesktopmediarequest.h
blob: ebf66bce4f57137431793522a9189f4ac2f95df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QWEBENGINEDESKTOPMEDIAREQUEST_H
#define QWEBENGINEDESKTOPMEDIAREQUEST_H

#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qobject.h>
#include <QtWebEngineCore/qtwebenginecoreglobal.h>

namespace QtWebEngineCore {
class DesktopMediaController;
}

QT_BEGIN_NAMESPACE
class QWebEnginePagePrivate;
class QQuickWebEngineViewPrivate;
class QWebEngineDesktopMediaRequestPrivate;
QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QWebEngineDesktopMediaRequestPrivate,
                                                 Q_WEBENGINECORE_EXPORT)

class QWebEngineDesktopMediaRequest
{
    Q_GADGET_EXPORT(Q_WEBENGINECORE_EXPORT)
    Q_PROPERTY(QAbstractListModel *screensModel READ screensModel FINAL)
    Q_PROPERTY(QAbstractListModel *windowsModel READ windowsModel FINAL)

public:
    Q_WEBENGINECORE_EXPORT ~QWebEngineDesktopMediaRequest();

    Q_WEBENGINECORE_EXPORT
    QWebEngineDesktopMediaRequest(const QWebEngineDesktopMediaRequest &other) noexcept;
    Q_WEBENGINECORE_EXPORT
    QWebEngineDesktopMediaRequest(QWebEngineDesktopMediaRequest &&other) noexcept;
    Q_WEBENGINECORE_EXPORT
    QWebEngineDesktopMediaRequest &operator=(const QWebEngineDesktopMediaRequest &other) noexcept;
    QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QWebEngineDesktopMediaRequest)
    void swap(QWebEngineDesktopMediaRequest &other) noexcept { d.swap(other.d); }

    Q_WEBENGINECORE_EXPORT QAbstractListModel *screensModel() const;
    Q_WEBENGINECORE_EXPORT QAbstractListModel *windowsModel() const;

    Q_WEBENGINECORE_EXPORT Q_INVOKABLE void selectScreen(const QModelIndex &index) const;
    Q_WEBENGINECORE_EXPORT Q_INVOKABLE void selectWindow(const QModelIndex &index) const;
    Q_WEBENGINECORE_EXPORT Q_INVOKABLE void cancel() const;

private:
    friend class QWebEnginePagePrivate;
    friend class QQuickWebEngineViewPrivate;
    Q_WEBENGINECORE_EXPORT explicit QWebEngineDesktopMediaRequest(
            QtWebEngineCore::DesktopMediaController *controller);
    QExplicitlySharedDataPointer<QWebEngineDesktopMediaRequestPrivate> d;
};
Q_DECLARE_SHARED(QWebEngineDesktopMediaRequest)

QT_END_NAMESPACE

#endif // QWEBENGINEDESKTOPMEDIAREQUEST_H