1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QVIDEOWIDGET_H
41#define QVIDEOWIDGET_H
42
43#include <QtWidgets/qwidget.h>
44
45#include <QtMultimediaWidgets/qtmultimediawidgetdefs.h>
46#include <QtMultimedia/qmediabindableinterface.h>
47
48QT_BEGIN_NAMESPACE
49
50
51class QMediaObject;
52
53class QVideoWidgetPrivate;
54class QAbstractVideoSurface;
55class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidget : public QWidget, public QMediaBindableInterface
56{
57 Q_OBJECT
58 Q_INTERFACES(QMediaBindableInterface)
59 Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject)
60 Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
61 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
62 Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
63 Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
64 Q_PROPERTY(int hue READ hue WRITE setHue NOTIFY hueChanged)
65 Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
66 Q_PROPERTY(QAbstractVideoSurface* videoSurface READ videoSurface CONSTANT)
67
68public:
69 explicit QVideoWidget(QWidget *parent = nullptr);
70 ~QVideoWidget();
71
72 QMediaObject *mediaObject() const override;
73 QAbstractVideoSurface *videoSurface() const;
74
75#ifdef Q_QDOC
76 bool isFullScreen() const;
77#endif
78
79 Qt::AspectRatioMode aspectRatioMode() const;
80
81 int brightness() const;
82 int contrast() const;
83 int hue() const;
84 int saturation() const;
85
86 QSize sizeHint() const override;
87#if defined(Q_OS_WIN)
88# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
89 bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
90# else
91 bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
92# endif
93#endif
94
95public Q_SLOTS:
96 void setFullScreen(bool fullScreen);
97 void setAspectRatioMode(Qt::AspectRatioMode mode);
98 void setBrightness(int brightness);
99 void setContrast(int contrast);
100 void setHue(int hue);
101 void setSaturation(int saturation);
102
103Q_SIGNALS:
104 void fullScreenChanged(bool fullScreen);
105 void brightnessChanged(int brightness);
106 void contrastChanged(int contrast);
107 void hueChanged(int hue);
108 void saturationChanged(int saturation);
109
110protected:
111 bool event(QEvent *event) override;
112 void showEvent(QShowEvent *event) override;
113 void hideEvent(QHideEvent *event) override;
114 void resizeEvent(QResizeEvent *event) override;
115 void moveEvent(QMoveEvent *event) override;
116 void paintEvent(QPaintEvent *event) override;
117
118 bool setMediaObject(QMediaObject *object) override;
119
120 QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent);
121 QVideoWidgetPrivate *d_ptr;
122
123private:
124 Q_DECLARE_PRIVATE(QVideoWidget)
125 Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed())
126 Q_PRIVATE_SLOT(d_func(), void _q_brightnessChanged(int))
127 Q_PRIVATE_SLOT(d_func(), void _q_contrastChanged(int))
128 Q_PRIVATE_SLOT(d_func(), void _q_hueChanged(int))
129 Q_PRIVATE_SLOT(d_func(), void _q_saturationChanged(int))
130 Q_PRIVATE_SLOT(d_func(), void _q_fullScreenChanged(bool))
131 Q_PRIVATE_SLOT(d_func(), void _q_dimensionsChanged())
132};
133
134QT_END_NAMESPACE
135
136
137#endif
138

source code of qtmultimedia/src/multimediawidgets/qvideowidget.h