summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/screencapture/screencapturepreview.h
blob: e3ae60711390e81142aa47b9fe89fc07a930b547 (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
60
61
62
63
64
65
66
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef SCREENCAPTUREPREVIEW_H
#define SCREENCAPTUREPREVIEW_H

#include <QScreenCapture>
#include <QWidget>
#include <QModelIndex>

class ScreenListModel;
class WindowListModel;

QT_BEGIN_NAMESPACE
class QListView;
class QMediaCaptureSession;
class QVideoWidget;
class QGridLayout;
class QHBoxLayout;
class QLineEdit;
class QPushButton;
class QLabel;
QT_END_NAMESPACE

QT_USE_NAMESPACE

class ScreenCapturePreview : public QWidget
{
    Q_OBJECT

public:

    ScreenCapturePreview(QWidget *parent = nullptr);
    ~ScreenCapturePreview();

public slots:

    void onScreenSelectionChanged(QModelIndex index);
    void onWindowSelectionChanged(QModelIndex index);
    void onWindowIdSelectionChanged();
    void onScreenCaptureErrorOccured(QScreenCapture::Error error, const QString &errorString);
    void onStartStopButtonClicked();

private:

    ScreenListModel *screenListModel = nullptr;
    WindowListModel *windowListModel = nullptr;
    QListView *screenListView = nullptr;
    QListView *windowListView = nullptr;
    QScreenCapture *screenCapture = nullptr;
    QList<QScreen *> screens = QList<QScreen *>();
    QList<QWindow *> windows = QList<QWindow *>();
    QMediaCaptureSession *mediaCaptureSession = nullptr;
    QVideoWidget *videoWidget = nullptr;
    QGridLayout *gridLayout = nullptr;
    QHBoxLayout *hBoxLayout = nullptr;
    QLineEdit *lineEdit = nullptr;
    QPushButton *wIdButton = nullptr;
    QPushButton *startStopButton = nullptr;
    QLabel *screenLabel = nullptr;
    QLabel *windowLabel = nullptr;
    QLabel *windowIdLabel = nullptr;
    QLabel *videoWidgetLabel = nullptr;

};
#endif // SCREENCAPTUREPREVIEW_H