From patchwork Fri Aug 12 12:46:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17105 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 4FF8EBE173 for ; Fri, 12 Aug 2022 12:47:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B08D6333F; Fri, 12 Aug 2022 14:47:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308445; bh=abgtq4SzMVTr1jphCwKu42DVfkAB0i6XzfK3w8OsDFQ=; 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=OUMOdxkRmuv6PiRJibRY2GcQ/dx2N34tmjiS4MJth5EOeBpGnNZlNglGfaKl3sDXE F5xivx/oZV7fvs/Iob7A6ZT8c9AYVdXIF0nIVbx5D+/nexaQrj0g2NdiyTBbJ9/j9r RqOq1EJYaA8Agv35HMYHEWEhBGsGmHyx6VSB4BgrKj8/CiBqr8ndJJMiQJFJq94+a0 ZWbLJVpnGH3ZU0riCTdMoYuO04o7RiYC3ROtWmKMlWF06ZtoxTisPO9LN/PV2DWFmR hIuc4LQ5w3dX6LJsoPj4CM/qIzumh8kUTpUuAYoEEPn72KlrWjjE9X9fZjm0CcqfVr orRCJDpKinWxw== Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BE096333D for ; Fri, 12 Aug 2022 14:47:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E/bo7xDG"; dkim-atps=neutral Received: by mail-pl1-x62d.google.com with SMTP id 13so651094plo.12 for ; Fri, 12 Aug 2022 05:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=sBE+9kgB4qhutisBVU2YWJFcr8eavp0AgoqYuHqJ5/k=; b=E/bo7xDGFyfq+WO/p/UyQyJET1HC+pW5dx7EFGTiVO16FG/FnS4h7mgaHA/QWh8bQp DWUm2usbzUDtxQAQCBoeWEXT1wahQdcGcK/PnwwhpOAPd7jkf/drY93ABuzitepqujBj 6eEZDR2doCtYU0/YhSVPI9L/XG5G4w3OEsXhAEc+8bwn6bWST53q0Y6Mm+9YP25He5Mv qkgMPXeKTXRdTEsblaY6I22e6VnhprqajNkOFYWAvil0qS3HqHzecyCXVVWpIOvN97vj ZEBorXy12AdyutnssNa1Y72byqhgUexMIPheizG2+idqaV2NceKGNTa+OGsmS3q1gurS 91cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=sBE+9kgB4qhutisBVU2YWJFcr8eavp0AgoqYuHqJ5/k=; b=4zMzpA6pkzZ75s4/nkfp+BISSGFWsFYIuew7qooUBRUjnDyDGgcvObqLWok7MUHxSk Zg9oyET+gOX7V2OYZXfAfF3ux7viAezdfuX5nA0Lg3gUj3f1grKoOjRGbOB/kwccEKug 4uIlvVzyk6pRdLQZp1Vz5oDgn7Tvnbh0E7h8sT4K9siI20liB7oLgtFSs2DYw9TiAwPA Z5q+FcmfWm9G+r7GG1xnXQ/PBWmOuglOHpC1FIVCDRDlV/SJskj3PKwnfR5Odngp4HGU h6tZbcTtWp8/HDI3dpS2rr4hW5aKJw+W6MsoHWSPkmVUIYGRkI+lm5PbL6Ebbi0lewZW HASA== X-Gm-Message-State: ACgBeo3eE2BrCLGu0LkoIAeviSaSTUtDbB3FU4Uja+KXLiCap+PWwxcD Lgqg3TD6CHT02DMpoVZI3jmrOEBWx6g= X-Google-Smtp-Source: AA6agR4NQxW40rJJbD9Qj/ktdwVN7mRwsT2psT6Aw1EyvqOSzDZ4/yXdQ18mXQ3hta4s0f9I0dswqQ== X-Received: by 2002:a17:903:2410:b0:171:4bbc:2526 with SMTP id e16-20020a170903241000b001714bbc2526mr3827330plo.62.1660308440934; Fri, 12 Aug 2022 05:47:20 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:dc0d:d8e:96a2:2dbe:5a83]) by smtp.gmail.com with ESMTPSA id e6-20020a17090a728600b001f069352d73sm1431785pjg.25.2022.08.12.05.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:20 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:49 +0530 Message-Id: <20220812124651.27496-10-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220812124651.27496-1-utkarsh02t@gmail.com> References: <20220812124651.27496-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 2554f70d..9e38da37 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 ControlId *control, @@ -78,6 +80,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")); } @@ -113,6 +128,9 @@ void ControlFrame::setCurrentValue(const libcamera::ControlValue controlValue) else currentValue_->setText("False"); break; + case ControlTypeFloat: + currentValue_->setText(QString::number(controlValue.get())); + break; default: break; } @@ -140,6 +158,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();