clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 37862e5a766cf657da28aa18b5a9fe23c312ce9a
parent e8e9d69ea5c7962e19b195a7cab4d13895fbc55b
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Mon,  9 Aug 2021 18:03:56 +0200

Show a dial

Diffstat:
Mexamples/gui/application.cc | 21++++++++++-----------
Mexamples/plugins/dc-offset/skin/main.qml | 8+++++---
2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/examples/gui/application.cc b/examples/gui/application.cc @@ -1,7 +1,8 @@ #include <QCommandLineParser> -#include <QQuickView> -#include <QQmlEngine> #include <QQmlContext> +#include <QQmlEngine> +#include <QQuickView> +#include <QQuickItem> #include <QWindow> #include "../io/messages.hh" @@ -34,12 +35,10 @@ Application::Application(int argc, char **argv) auto socket = parser.value(socketOpt).toULongLong(); socketReadNotifier_ = new QSocketNotifier(socket, QSocketNotifier::Read, this); - connect(socketReadNotifier_, - &QSocketNotifier::activated, - [this](QSocketDescriptor socket, QSocketNotifier::Type type) { - printf("ON READ\n"); - remoteChannel_->onRead(); - }); + connect( + socketReadNotifier_, + &QSocketNotifier::activated, + [this](QSocketDescriptor socket, QSocketNotifier::Type type) { remoteChannel_->onRead(); }); socketWriteNotifier_ = new QSocketNotifier(socket, QSocketNotifier::Write, this); connect( @@ -72,7 +71,6 @@ void Application::modifyFd(clap_fd_flags flags) { } void Application::onMessage(const clap::RemoteChannel::Message &msg) { - printf("ON MESSAGE\n"); switch (msg.type) { case clap::messages::kDefineParameterRequest: { clap::messages::DefineParameterRequest rq; @@ -83,8 +81,9 @@ void Application::onMessage(const clap::RemoteChannel::Message &msg) { case clap::messages::kSizeRequest: { clap::messages::SizeResponse rp; - rp.width = 300; //quickView_->width(); - rp.height = 200; //quickView_->height(); + auto rootItem = quickView_->rootObject(); + rp.width = rootItem ? rootItem->width() : 500; + rp.height = rootItem ? rootItem->height() : 300; remoteChannel_->sendResponseAsync(rp, msg.cookie); break; } diff --git a/examples/plugins/dc-offset/skin/main.qml b/examples/plugins/dc-offset/skin/main.qml @@ -1,11 +1,13 @@ -import QtQuick 2.0 +import QtQuick 2.1 +import QtQuick.Controls 2.1 Rectangle { width: 300 height: 200 color: "#224477" - Text { - text: "Hello World!" + Dial { + property QtObject param: plugin.getParam(0) + inputMode: Dial.Vertical } } \ No newline at end of file