From c3db52a0bf0895d29c6d877da63684fdecdc9a86 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Jan 2015 17:35:10 +0100 Subject: DOCS/client_api_examples: qml: add test for gamma control Provides a dumb test for the functionality added in the previous commit. --- DOCS/client_api_examples/qml/main.qml | 33 +++++++++++++++++++--------- DOCS/client_api_examples/qml/mpvrenderer.cpp | 6 ++++- DOCS/client_api_examples/qml/mpvrenderer.h | 1 + 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/DOCS/client_api_examples/qml/main.qml b/DOCS/client_api_examples/qml/main.qml index 4c07351d32..672f8680b1 100644 --- a/DOCS/client_api_examples/qml/main.qml +++ b/DOCS/client_api_examples/qml/main.qml @@ -41,18 +41,31 @@ Item { Click to load ../../../test.mkv" } - CheckBox { - id: checkbox - anchors.margins: 10 - // Heavily filtered means good, right? - text: "Make video looks like on a Smart TV" - onClicked: { - if (checkbox.checked) { - renderer.command(["vo_cmdline", "lscale=sharpen3:lparam1=1.0"]) - } else { - renderer.command(["vo_cmdline", ""]) + // Don't take these controls too seriously. They're for testing. + Column { + CheckBox { + id: checkbox + anchors.margins: 10 + // Heavily filtered means good, right? + text: "Make video look like on a Smart TV" + onClicked: { + if (checkbox.checked) { + renderer.command(["vo_cmdline", "lscale=sharpen3:lparam1=5.0"]) + } else { + renderer.command(["vo_cmdline", ""]) + } } } + Slider { + id: slider + anchors.margins: 10 + anchors.left: checkbox.left + anchors.right: checkbox.right + minimumValue: -100 + maximumValue: 100 + value: 0 + onValueChanged: renderer.setProperty("gamma", slider.value | 0) + } } } } diff --git a/DOCS/client_api_examples/qml/mpvrenderer.cpp b/DOCS/client_api_examples/qml/mpvrenderer.cpp index 07ee360eb3..f24ae42ed3 100644 --- a/DOCS/client_api_examples/qml/mpvrenderer.cpp +++ b/DOCS/client_api_examples/qml/mpvrenderer.cpp @@ -100,10 +100,14 @@ void MpvObject::doUpdate() void MpvObject::command(const QVariant& params) { - //mpv_command_string(mpv, s.toUtf8().data()); mpv::qt::command_variant(mpv, params); } +void MpvObject::setProperty(const QString& name, const QVariant& value) +{ + mpv::qt::set_property_variant(mpv, name, value); +} + QQuickFramebufferObject::Renderer *MpvObject::createRenderer() const { window()->setPersistentOpenGLContext(true); diff --git a/DOCS/client_api_examples/qml/mpvrenderer.h b/DOCS/client_api_examples/qml/mpvrenderer.h index ec7e5c4279..9a65ae5350 100644 --- a/DOCS/client_api_examples/qml/mpvrenderer.h +++ b/DOCS/client_api_examples/qml/mpvrenderer.h @@ -24,6 +24,7 @@ public: virtual Renderer *createRenderer() const; public slots: void command(const QVariant& params); + void setProperty(const QString& name, const QVariant& value); signals: void onUpdate(); private slots: -- cgit v1.2.3