From patchwork Fri Jul 15 19:13:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16664 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E8780BE173 for ; Fri, 15 Jul 2022 19:14:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C8916332B; Fri, 15 Jul 2022 21:14:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912465; bh=1q3u56hzWWbSwzLVMLWAJHRVN22HxqG+RQBjzFsnxCU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WU5Qvzxd7NRMzVwZ7GnXfGiDxhtRlcEzGMe58bH23LDEv3N5fdGh7iGP/JMExMtcL +pSiSirr787nLgyr1ItURLuE66GCwUo0UN48Y5L2pDaTyDQ1qthDpauXc8gBqaq1IG cUsVBlvycGkvZ1o+sP2KKvskqTE326sy9UW+/hrFPpQ2s/2ngXcsHS38K4C6jaW0o4 FPebRCDOoEy1IRQORBUZ/XepieuEDwQuRy9NMvatnWcKFhRMga8z/sVXvNHxsIO7La WBGGvcPaQUzR3NQqjImqPYk5kLtOqUAsFMJS1kU5nYnCIWQLZuqCU5trvtpwMh2z24 pKeGp79NLXMxw== Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C9FE6331B for ; Fri, 15 Jul 2022 21:14:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b8ghlYVU"; dkim-atps=neutral Received: by mail-pf1-x430.google.com with SMTP id 70so5436131pfx.1 for ; Fri, 15 Jul 2022 12:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FrnYJ61KYCQkWm5zhCQpwLqUo0i4PHJOlAfzOLINGFw=; b=b8ghlYVUBtkRBhMe9Xq0OZzXKzhKXD8W3X28i5Bq1vQcZvPJ0WfvKfjteI6veLDter KQsO3yj9NqpP9H3OD9N022Tm3fALJl5BkXPV/oXm3+4f4scYZHl7xQV9+wHmUUvZl3Gd I1+ambmQK8bJYX7WiM5AWnP3mAs3ms61z9Z8MqCR+6CR6DS28uE4ovtMgJESVKT8Bw5k fF3w8MHtFXl3caSyQMG/c9Hd+h8EfR+igbmuw04nuD9By9KXE3ArsWXK/4IP3eQe6lo9 J2/EmiwzFP1rWaArk6tGXCUYKmq18gghgNlSHJyjRwsx8E+8KWcouU4U+KRX+HUzHt/n EsgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FrnYJ61KYCQkWm5zhCQpwLqUo0i4PHJOlAfzOLINGFw=; b=aF5+LEjjowhdbvWJoKlt069DdgnIhGEquK2C57zmUrIhAdwRAZ3H4AOfjCLaM7In2y WIdTekGtRgltHCX19qOqglVlGI0zQH0llqRfSeBFfto9mVh4Vz2AttUZoItachrZkKHr 3bBC6XxjYXOtctLgUNqQzUztliRAdh0SsRrS+aOooJO8o4EipPW9l3sUfGK5BIFiPH4S o3DT/WA2gRcfarJdr877XQSLYD06YA69I/4oq72fZf1GcuKCq8j/b1vrc5pV9bVVFizM vw5e+XJrjsBUbxJnBsbXBMhZ0lk3Re4xYQv/yQzeE0+EuSYlZyuwmCE1zixf/LVB1Bc4 fSPQ== X-Gm-Message-State: AJIora/2dxhkDD++DIYorGapsSzNcvyoJ4RRQpzLLmK+FgAxj2HD3rda EcWssBQUPzRPiZ/sD7wuQ931B3ngCVMrNA== X-Google-Smtp-Source: AGRyM1tOFJB5LWAbT6/4Q8igDL66WfnffA02pKcylmLocU9JLKgXO0/Pjcx7MpDyu+PAPKQyXcbq+A== X-Received: by 2002:a05:6a00:bc5:b0:52b:49c9:d26c with SMTP id x5-20020a056a000bc500b0052b49c9d26cmr1139935pfu.73.1657912460498; Fri, 15 Jul 2022 12:14:20 -0700 (PDT) Received: from localhost.localdomain ([2406:3003:2005:1c27:d8e8:f9ac:919c:9ac8]) by smtp.gmail.com with ESMTPSA id s10-20020a170903214a00b0016be834d544sm3834315ple.237.2022.07.15.12.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:20 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:58 +0800 Message-Id: <20220715191400.890976-10-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220715191400.890976-1-utkarsh02t@gmail.com> References: <20220715191400.890976-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/11] qcam: ControlFrame: Add GUI interaction to float controls X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the float slider for the float controls to be able to control its value. Also display the current values for the float controls. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/control_frame.cpp | 21 +++++++++++++++++++++ src/qcam/settings/control_frame.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 3ab9fdb4..10dcd05a 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -16,6 +16,8 @@ #include #include +#include "slider.h" + using namespace libcamera; ControlFrame::ControlFrame(const libcamera::ControlId *control, @@ -79,6 +81,19 @@ QWidget *ControlFrame::controlInteraction(QWidget *parent) HCheckBoxLayout->setMargin(0); return containerWidget; } + case ControlTypeFloat: { + floatSlider_ = new FloatSlider; + floatSlider_->setRange(controlInfo_.min().get(), + controlInfo_.max().get()); + floatSlider_->setValue(controlInfo_.def().get()); + floatSlider_->setOrientation(Qt::Orientation::Horizontal); + + connect(floatSlider_, &FloatSlider::valueChanged, + this, &ControlFrame::notifyControlChange); + + SliderLayout *fSliderLayout = new SliderLayout(floatSlider_, this); + return fSliderLayout; + } default: return (new QLabel("Currently Unavailable")); } @@ -114,6 +129,9 @@ void ControlFrame::setCurrentValue(const libcamera::ControlValue controlValue) else currentValue_->setText("False"); break; + case ControlTypeFloat: + currentValue_->setText(QString::number(controlValue.get())); + break; default: break; } @@ -141,6 +159,9 @@ void ControlFrame::notifyControlChange() else controlValue.set(false); + break; + case ControlTypeFloat: + controlValue.set(floatSlider_->value()); break; default: /* Nothing to emit so return */ diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h index 9c3b059b..e9e256aa 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -15,6 +15,8 @@ #include #include +#include "slider.h" + class ControlFrame : public QFrame { Q_OBJECT @@ -44,6 +46,7 @@ private: QCheckBox *controlCheckBox_; QLabel *currentValue_; + FloatSlider *floatSlider_; /* Helper Hunctions */ QString getDefaultValueQStr();