summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-06-18 08:49:47 +0200
committerLars Knoll <lars.knoll@qt.io>2021-06-18 20:24:08 +0200
commitb9bb2a3cf78102dfcfd6f80a7e96a1aa855c5f7a (patch)
tree3bdc9542029cc3afb7a24a8c359918e43ee9221e
parent5773f7214c7430a98dea3974c0597cb3ee0ea7f5 (diff)
Remove brightness and related properties from QVideoSink and QVideoWidget
We currently do not support those on all platforms and most native APIs do not offer those kind of controls neither anymore. Change-Id: Ifa58d206796fba3b10dfa111be1c6f79a996539a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--examples/multimediawidgets/player/player.cpp51
-rw-r--r--examples/multimediawidgets/player/player.h4
-rw-r--r--src/multimedia/video/qvideosink.cpp2
-rw-r--r--src/multimedia/video/qvideosink.h16
-rw-r--r--src/multimediawidgets/qvideowidget.cpp10
-rw-r--r--src/multimediawidgets/qvideowidget.h17
-rw-r--r--tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp8
7 files changed, 15 insertions, 93 deletions
diff --git a/examples/multimediawidgets/player/player.cpp b/examples/multimediawidgets/player/player.cpp
index 7f374bae6..3005f2e4f 100644
--- a/examples/multimediawidgets/player/player.cpp
+++ b/examples/multimediawidgets/player/player.cpp
@@ -184,9 +184,6 @@ Player::Player(QWidget *parent)
m_fullScreenButton = new QPushButton(tr("FullScreen"), this);
m_fullScreenButton->setCheckable(true);
- m_colorButton = new QPushButton(tr("Color Options..."), this);
- m_colorButton->setEnabled(false);
- connect(m_colorButton, &QPushButton::clicked, this, &Player::showColorDialog);
m_audioOutputCombo = new QComboBox(this);
m_audioOutputCombo->addItem(QString::fromUtf8("Default"), QVariant::fromValue(QAudioDevice()));
@@ -205,7 +202,6 @@ Player::Player(QWidget *parent)
controlLayout->addWidget(controls);
controlLayout->addStretch(1);
controlLayout->addWidget(m_fullScreenButton);
- controlLayout->addWidget(m_colorButton);
controlLayout->addWidget(m_audioOutputCombo);
QBoxLayout *layout = new QVBoxLayout;
@@ -239,7 +235,6 @@ Player::Player(QWidget *parent)
controls->setEnabled(false);
m_playlistView->setEnabled(false);
openButton->setEnabled(false);
- m_colorButton->setEnabled(false);
m_fullScreenButton->setEnabled(false);
}
@@ -464,7 +459,6 @@ void Player::videoAvailableChanged(bool available)
if (m_fullScreenButton->isChecked())
m_videoWidget->setFullScreen(true);
}
- m_colorButton->setEnabled(available);
}
void Player::selectAudioStream()
@@ -538,51 +532,6 @@ void Player::updateDurationInfo(qint64 currentInfo)
m_labelDuration->setText(tStr);
}
-void Player::showColorDialog()
-{
- if (!m_colorDialog) {
- QSlider *brightnessSlider = new QSlider(Qt::Horizontal);
- brightnessSlider->setRange(-100, 100);
- brightnessSlider->setValue(m_videoWidget->brightness());
- connect(brightnessSlider, &QSlider::sliderMoved, [this](int b) { m_videoWidget->setBrightness(b/100.); });
- connect(m_videoWidget, &QVideoWidget::brightnessChanged, brightnessSlider, &QSlider::setValue);
-
- QSlider *contrastSlider = new QSlider(Qt::Horizontal);
- contrastSlider->setRange(-100, 100);
- contrastSlider->setValue(m_videoWidget->contrast());
- connect(contrastSlider, &QSlider::sliderMoved, [this](int c) { m_videoWidget->setContrast(c/100.); });
- connect(m_videoWidget, &QVideoWidget::contrastChanged, contrastSlider, &QSlider::setValue);
-
- QSlider *hueSlider = new QSlider(Qt::Horizontal);
- hueSlider->setRange(-100, 100);
- hueSlider->setValue(m_videoWidget->hue());
- connect(hueSlider, &QSlider::sliderMoved, [this](int h) { m_videoWidget->setHue(h/100.); });
- connect(m_videoWidget, &QVideoWidget::hueChanged, hueSlider, &QSlider::setValue);
-
- QSlider *saturationSlider = new QSlider(Qt::Horizontal);
- saturationSlider->setRange(-100, 100);
- saturationSlider->setValue(m_videoWidget->saturation());
- connect(saturationSlider, &QSlider::sliderMoved, [this](int s) { m_videoWidget->setSaturation(s/100.); });
- connect(m_videoWidget, &QVideoWidget::saturationChanged, saturationSlider, &QSlider::setValue);
-
- QFormLayout *layout = new QFormLayout;
- layout->addRow(tr("Brightness"), brightnessSlider);
- layout->addRow(tr("Contrast"), contrastSlider);
- layout->addRow(tr("Hue"), hueSlider);
- layout->addRow(tr("Saturation"), saturationSlider);
-
- QPushButton *button = new QPushButton(tr("Close"));
- layout->addRow(button);
-
- m_colorDialog = new QDialog(this);
- m_colorDialog->setWindowTitle(tr("Color Options"));
- m_colorDialog->setLayout(layout);
-
- connect(button, &QPushButton::clicked, m_colorDialog, &QDialog::close);
- }
- m_colorDialog->show();
-}
-
void Player::audioOutputChanged(int index)
{
auto device = m_audioOutputCombo->itemData(index).value<QAudioDevice>();
diff --git a/examples/multimediawidgets/player/player.h b/examples/multimediawidgets/player/player.h
index 5dc95cd58..cba34d973 100644
--- a/examples/multimediawidgets/player/player.h
+++ b/examples/multimediawidgets/player/player.h
@@ -110,8 +110,6 @@ private slots:
void displayErrorMessage();
- void showColorDialog();
-
void audioOutputChanged(int);
private:
@@ -128,9 +126,7 @@ private:
QSlider *m_slider = nullptr;
QLabel *m_labelDuration = nullptr;
QPushButton *m_fullScreenButton = nullptr;
- QPushButton *m_colorButton = nullptr;
QComboBox *m_audioOutputCombo = nullptr;
- QDialog *m_colorDialog = nullptr;
QLabel *m_statusLabel = nullptr;
QStatusBar *m_statusBar = nullptr;
diff --git a/src/multimedia/video/qvideosink.cpp b/src/multimedia/video/qvideosink.cpp
index 18afcbfad..6ba4bf6e6 100644
--- a/src/multimedia/video/qvideosink.cpp
+++ b/src/multimedia/video/qvideosink.cpp
@@ -233,6 +233,7 @@ void QVideoSink::setTargetRect(const QRectF &rect)
d->videoSink->setDisplayRect(rect.toRect());
}
+#if 0
float QVideoSink::brightness() const
{
return d->brightness;
@@ -292,6 +293,7 @@ void QVideoSink::setSaturation(float saturation)
d->videoSink->setSaturation(saturation);
emit saturationChanged(saturation);
}
+#endif
Qt::BGMode QVideoSink::backgroundMode() const
{
diff --git a/src/multimedia/video/qvideosink.h b/src/multimedia/video/qvideosink.h
index 93506db37..279f42326 100644
--- a/src/multimedia/video/qvideosink.h
+++ b/src/multimedia/video/qvideosink.h
@@ -77,18 +77,6 @@ public:
QRectF targetRect() const;
void setTargetRect(const QRectF &rect);
- float brightness() const;
- void setBrightness(float brightness);
-
- float contrast() const;
- void setContrast(float contrast);
-
- float hue() const;
- void setHue(float hue);
-
- float saturation() const;
- void setSaturation(float saturation);
-
Qt::BGMode backgroundMode() const;
void setBackgroundMode(Qt::BGMode mode);
@@ -102,10 +90,6 @@ Q_SIGNALS:
void newVideoFrame(const QVideoFrame &frame) const;
void fullScreenChanged(bool fullScreen);
- void brightnessChanged(float brightness);
- void contrastChanged(float contrast);
- void hueChanged(float hue);
- void saturationChanged(float saturation);
void aspectRatioModeChanged(Qt::AspectRatioMode mode);
private:
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
index e3ae2ac08..659c83ece 100644
--- a/src/multimediawidgets/qvideowidget.cpp
+++ b/src/multimediawidgets/qvideowidget.cpp
@@ -112,10 +112,10 @@ QVideoWidget::QVideoWidget(QWidget *parent)
d_ptr->videoSink->setNativeWindowId(winId());
connect(d_ptr->videoSink, SIGNAL(newVideoFrame(const QVideoFrame &)), this, SLOT(_q_newFrame(const QVideoFrame &)));
- connect(d_ptr->videoSink, &QVideoSink::brightnessChanged, this, &QVideoWidget::brightnessChanged);
- connect(d_ptr->videoSink, &QVideoSink::contrastChanged, this, &QVideoWidget::contrastChanged);
- connect(d_ptr->videoSink, &QVideoSink::hueChanged, this, &QVideoWidget::hueChanged);
- connect(d_ptr->videoSink, &QVideoSink::saturationChanged, this, &QVideoWidget::saturationChanged);
+// connect(d_ptr->videoSink, &QVideoSink::brightnessChanged, this, &QVideoWidget::brightnessChanged);
+// connect(d_ptr->videoSink, &QVideoSink::contrastChanged, this, &QVideoWidget::contrastChanged);
+// connect(d_ptr->videoSink, &QVideoSink::hueChanged, this, &QVideoWidget::hueChanged);
+// connect(d_ptr->videoSink, &QVideoSink::saturationChanged, this, &QVideoWidget::saturationChanged);
}
/*!
@@ -189,6 +189,7 @@ void QVideoWidget::setFullScreen(bool fullScreen)
\sa isFullScreen()
*/
+#if 0
/*!
\property QVideoWidget::brightness
\brief an adjustment to the brightness of displayed video.
@@ -300,6 +301,7 @@ void QVideoWidget::setSaturation(float saturation)
\sa saturation()
*/
+#endif
/*!
Returns the size hint for the current back end,
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
index b3e8ff890..57c132b9b 100644
--- a/src/multimediawidgets/qvideowidget.h
+++ b/src/multimediawidgets/qvideowidget.h
@@ -54,10 +54,6 @@ class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidget : public QWidget
Q_OBJECT
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode NOTIFY aspectRatioModeChanged)
- Q_PROPERTY(float brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
- Q_PROPERTY(float contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
- Q_PROPERTY(float hue READ hue WRITE setHue NOTIFY hueChanged)
- Q_PROPERTY(float saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
public:
explicit QVideoWidget(QWidget *parent = nullptr);
@@ -71,11 +67,6 @@ public:
Qt::AspectRatioMode aspectRatioMode() const;
- float brightness() const;
- float contrast() const;
- float hue() const;
- float saturation() const;
-
QSize sizeHint() const override;
#if defined(Q_OS_WIN)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
@@ -84,17 +75,9 @@ public:
public Q_SLOTS:
void setFullScreen(bool fullScreen);
void setAspectRatioMode(Qt::AspectRatioMode mode);
- void setBrightness(float brightness);
- void setContrast(float contrast);
- void setHue(float hue);
- void setSaturation(float saturation);
Q_SIGNALS:
void fullScreenChanged(bool fullScreen);
- void brightnessChanged(float brightness);
- void contrastChanged(float contrast);
- void hueChanged(float hue);
- void saturationChanged(float saturation);
void aspectRatioModeChanged(Qt::AspectRatioMode mode);
protected:
diff --git a/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp b/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
index 382e2b1db..be76575fd 100644
--- a/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
+++ b/tests/auto/unit/multimediawidgets/qvideowidget/tst_qvideowidget.cpp
@@ -55,6 +55,7 @@ private slots:
void aspectRatio();
void sizeHint_data();
void sizeHint();
+#if 0
void brightness_data() { color_data(); }
void brightness();
void contrast_data() { color_data(); }
@@ -63,11 +64,12 @@ private slots:
void hue();
void saturation_data() { color_data(); }
void saturation();
+#endif
void paint();
private:
- void color_data();
+// void color_data();
};
class QtTestVideoWidget : public QVideoWidget
@@ -96,6 +98,7 @@ void tst_QVideoWidget::nullObject()
widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
+#if 0
{
QSignalSpy spy(&widget, SIGNAL(brightnessChanged(float)));
@@ -161,6 +164,7 @@ void tst_QVideoWidget::nullObject()
QCOMPARE(spy.count(), 2);
QCOMPARE(spy.value(1).value(0).toFloat(), -1.);
}
+#endif
}
@@ -325,6 +329,7 @@ void tst_QVideoWidget::fullScreen()
QCOMPARE(spy.count(), 5);
}
+#if 0
void tst_QVideoWidget::color_data()
{
QTest::addColumn<float>("controlValue");
@@ -494,6 +499,7 @@ void tst_QVideoWidget::saturation()
QCOMPARE(spy.count(), 2);
QCOMPARE(spy.value(1).value(0).toFloat(), controlValue);
}
+#endif
static const uchar rgb32ImageData[] =
{