From patchwork Fri Jul 15 19:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16656 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 F09DFBE173 for ; Fri, 15 Jul 2022 19:14:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7CDA763316; Fri, 15 Jul 2022 21:14:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912451; bh=FoKUz+FkkiUIWht5IENjaIF1emvhatvEXA9CQBxsjCM=; 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=yrloO2J2DpJU61T3hF6NGi48wEjj/VUAyxD9DljE8Je0xh5wHT42eiCQ9nKn8UF6r 9zFOBiCfIsjKTqhtyr/hZ69QdTaxbkvJXrimxfyTlXj+At8zbhRU9H8qULXTmS29XN zorOd5OBfCIa2xuihUXaXLpIBjnwcEIaSfWmcuh8DIAa2dj6E9XfcePGcJz0jN09+5 BPZc3cZwbEOSIO4ktapWM8/kaam+miPyEZnGbPsx8RXqEd67WPDNbh+QBPZ7UWbcnR 6Jh8U9tIVQPsIVAddSZTHyh6qZV0w5j/azBMdW5yhL1fmM5mWW9+LWKilpp1n8aiEC JmyMZsl/iF7wg== Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 859F96330E for ; Fri, 15 Jul 2022 21:14:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CAuyIvm2"; dkim-atps=neutral Received: by mail-pg1-x536.google.com with SMTP id e132so5217480pgc.5 for ; Fri, 15 Jul 2022 12:14:09 -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=anyKfc289I3CWaA7uesC5+ilg1UNAagPjTMM2PRc++0=; b=CAuyIvm2H9SA/NNxLDBj2TkddMhHilOJqC4Uhpn9vm0pWZFTZFC7IeuThaw7dDSQTE BGqEvI6sBByj5M9JHPyyRivRLoacibvN8oUjhl88c8BBPXHe/AZ/7y7fjKDvTqBp1tWc 6c0Nrva74lR7Sj9tLHuSBhcstkbXSjveKeQkDxcnpEJLBNC/y4vKqVGn2MF4tl8oddh4 sBGKal5dVagL67kxkivN420r/DtocdisMArBQB6cdDuq886JQ1PW5wJGX8IedkEOA1xR XvUjb1hezQbZrHqzBDa/WYEsqOJ6aWlHa+talrZAFHM8hDDcmse+SuvCXNaodIJOX7pK zImw== 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=anyKfc289I3CWaA7uesC5+ilg1UNAagPjTMM2PRc++0=; b=j2JNpZ9mtjARZFnThoewKJBcu8GYye0amfff7UPJzL7nVw3Ylx5b0Cy8FCLkPLGvth EtlDbgFgaCcU6dkHSFtFtXty1UrLMHc9JzpfMf1CHiZHipU1bX1pRfWq6+Ea71/3hMrt GACxfzXbiFnr0xBilVZbksAy/FoJazZzYVN3LKIEkJFTDTOA9QEFXcM5fSVKhvitMhui uyg1SoTZwnaH72HKqWuOTdjY4jeLpghmO9tfHk7G875jttG8kRKAYw/cxUV7VBk1nsuX zIeZl2+zLlFQ2AIBwbkn/Ez492SBmMTuWbXX4PxjhgDqbBO8A/VhbC9GOP31Vj1lt+5O KUGw== X-Gm-Message-State: AJIora8S1Pu11fgfGl6/ogzE/2+wYrqZXDrwhjPmAsg639PnnxyO5DiB V6HockUZn9w024ra3aH2quY+8dNKGMivhw== X-Google-Smtp-Source: AGRyM1vGgWrtytlofyYBmBopCg/Q4oSWsfRM4PsoMcXXctl//rJ0PiyCPrG+z6ICKY8eJYT54aHQqg== X-Received: by 2002:a63:8341:0:b0:415:c973:18b1 with SMTP id h62-20020a638341000000b00415c97318b1mr13882885pge.292.1657912447875; Fri, 15 Jul 2022 12:14:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:07 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:50 +0800 Message-Id: <20220715191400.890976-2-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 01/11] qcam: Add settings Dialog with Control tab 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" Implement a Settings QDialog and add its buttonon the toolbar. We only create one instance of the SettingsWindow and its created the first time user clicks on the button. This Setting Dialog implements a QTabWidget which resides in a QVBoxLayout so that it spans the whole QDialog. The QTabWidget currently only holds the control tab. This Tab lays out the respective ControlFrames in a QGridLayout listing two controls in each row. ControlFrames handles the UI for each respective controls. It also implements the QVBoxLayout as for future when we want to add more information in each frame. Signed-off-by: Utkarsh Tiwari --- src/qcam/assets/feathericons/feathericons.qrc | 1 + src/qcam/main_window.cpp | 15 +++++++ src/qcam/main_window.h | 4 ++ src/qcam/meson.build | 5 +++ src/qcam/settings/control_frame.cpp | 26 +++++++++++++ src/qcam/settings/control_frame.h | 26 +++++++++++++ src/qcam/settings/controls_tab.cpp | 38 ++++++++++++++++++ src/qcam/settings/controls_tab.h | 24 ++++++++++++ src/qcam/settings/settings_dialog.h | 39 +++++++++++++++++++ 9 files changed, 178 insertions(+) create mode 100644 src/qcam/settings/control_frame.cpp create mode 100644 src/qcam/settings/control_frame.h create mode 100644 src/qcam/settings/controls_tab.cpp create mode 100644 src/qcam/settings/controls_tab.h create mode 100644 src/qcam/settings/settings_dialog.h diff --git a/src/qcam/assets/feathericons/feathericons.qrc b/src/qcam/assets/feathericons/feathericons.qrc index 6b08395a..9dc179bb 100644 --- a/src/qcam/assets/feathericons/feathericons.qrc +++ b/src/qcam/assets/feathericons/feathericons.qrc @@ -6,6 +6,7 @@ file.svg play-circle.svg save.svg + settings.svg stop-circle.svg x-circle.svg x-square.svg diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index d4b3d629..f0916b8e 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -255,6 +255,10 @@ int MainWindow::createToolbars() /* Do not operate directly call toggleScriptAction */ scriptExecAction_ = action; + /* Settings Dialog open action */ + action = toolbar_->addAction(QIcon(":settings.svg"), "Open Settings Window"); + connect(action, &QAction::triggered, this, &MainWindow::openSettingsDialog); + return 0; } @@ -341,6 +345,17 @@ void MainWindow::toggleScriptAction(bool showAvailable) } } +void MainWindow::openSettingsDialog() +{ + if (settingsDialog_) { + settingsDialog_->show(); + return; + } + + settingsDialog_ = std::make_unique(camera_, this); + settingsDialog_->show(); +} + /* ----------------------------------------------------------------------------- * Camera Selection */ diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 6f131b17..e35f9029 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -28,6 +28,7 @@ #include "../cam/capture_script.h" #include "../cam/stream_options.h" +#include "settings/settings_dialog.h" #include "viewfinder.h" class QAction; @@ -89,6 +90,7 @@ private: void processViewfinder(libcamera::FrameBuffer *buffer); void chooseScript(); + void openSettingsDialog(); void toggleScriptAction(bool showAvailable); @@ -106,6 +108,8 @@ private: QString title_; QTimer titleTimer_; + std::unique_ptr settingsDialog_; + /* Options */ const OptionsParser::Options &options_; diff --git a/src/qcam/meson.build b/src/qcam/meson.build index 67074252..b02b216c 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -23,11 +23,16 @@ qcam_sources = files([ 'main.cpp', 'main_window.cpp', 'message_handler.cpp', + 'settings/control_frame.cpp', + 'settings/controls_tab.cpp', 'viewfinder_qt.cpp', ]) qcam_moc_headers = files([ 'main_window.h', + 'settings/control_frame.h', + 'settings/controls_tab.h', + 'settings/settings_dialog.h', 'viewfinder_qt.h', ]) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp new file mode 100644 index 00000000..6f5cba6d --- /dev/null +++ b/src/qcam/settings/control_frame.cpp @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * control_frame.cpp - qcam - Control frame + */ + +#include "control_frame.h" + +#include + +#include +#include +#include +#include + +ControlFrame::ControlFrame(const libcamera::ControlId *control, QWidget *parent) + : QFrame(parent), control_(control) +{ + /* Main layout for the frame */ + QVBoxLayout *frameVLayout = new QVBoxLayout(this); + + frameVLayout->addWidget(new QLabel(QString::fromStdString(control_->name()))); + + setFrameStyle(QFrame::StyledPanel); +} diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h new file mode 100644 index 00000000..10690674 --- /dev/null +++ b/src/qcam/settings/control_frame.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * control_frame.h - qcam - Control frame + */ + +#pragma once + +#include + +#include +#include + +class ControlFrame : public QFrame +{ + Q_OBJECT + +public: + ControlFrame(const libcamera::ControlId *control, + QWidget *parent); + ~ControlFrame() = default; + +private: + const libcamera::ControlId *control_; +}; diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp new file mode 100644 index 00000000..33ed9332 --- /dev/null +++ b/src/qcam/settings/controls_tab.cpp @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * controls_tab.cpp - qcam - Controls Tab + */ + +#include "controls_tab.h" + +#include + +#include + +#include +#include +#include + +#include "control_frame.h" + +ControlsTab::ControlsTab(std::shared_ptr camera_, + QWidget *parent) + : QWidget(parent) +{ + /* Main Layout for the tab */ + QGridLayout *controlGLayout = new QGridLayout(this); + + int controlCount = 0; + for (auto &[control, info] : camera_->controls()) { + ControlFrame *controlFrame = new ControlFrame(control, this); + + controlGLayout->addWidget(controlFrame, controlCount / 2, + controlCount % 2); + controlCount++; + } + + if (controlCount == 0) + controlGLayout->addWidget(new QLabel("No controls available")); +} diff --git a/src/qcam/settings/controls_tab.h b/src/qcam/settings/controls_tab.h new file mode 100644 index 00000000..6a63f334 --- /dev/null +++ b/src/qcam/settings/controls_tab.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * controls_tab.h - qcam - Controls Tab + */ + +#pragma once + +#include + +#include + +#include +#include + +class ControlsTab : public QWidget +{ + Q_OBJECT + +public: + ControlsTab(std::shared_ptr camera_, QWidget *parent); + ~ControlsTab() = default; +}; diff --git a/src/qcam/settings/settings_dialog.h b/src/qcam/settings/settings_dialog.h new file mode 100644 index 00000000..c2fa61ea --- /dev/null +++ b/src/qcam/settings/settings_dialog.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * settings_dialog.h - qcam - Settings Dialog + */ + +#pragma once + +#include + +#include +#include +#include +#include + +#include "controls_tab.h" +class SettingsDialog : public QDialog +{ + Q_OBJECT + +public: + SettingsDialog(std::shared_ptr camera, QWidget *parent) + : QDialog(parent) + { + /*Main layout for dialog */ + QVBoxLayout *settingVLayout = new QVBoxLayout(this); + + /* Main TabWidget which would hold other tabs */ + QTabWidget *settingTabWidget = new QTabWidget; + settingVLayout->addWidget(settingTabWidget); + + ControlsTab *controlsTab = new ControlsTab(camera, this); + settingTabWidget->addTab(controlsTab, "Controls"); + + setWindowTitle("Settings"); + } + ~SettingsDialog() = default; +}; From patchwork Fri Jul 15 19:13:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16657 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 D23DBC3274 for ; Fri, 15 Jul 2022 19:14:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0D24363317; Fri, 15 Jul 2022 21:14:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912452; bh=/qKLkWUUn1tNProfmPvTMn//dPD1XB0Co6XOj+4bWuI=; 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=NRxawFfWv6Pkcio7CEaE4+isT+0jH7tHIR2Y9rPHAUBnR5ZmOj7U4+x1OFz0NyLAR Ea04pAUcpSpnTVrolJ4nJFH5zt5y4puwg9Tv1udS3L6FSatVj1gRhimthaEhDclcLR 010eff3c16nQeJwG1CcddqZcaOImfuNHzNUXC7NvDuSkA8GQJFRdc1issU1BbGRH15 teMDSKuE0/anin5u4vPA/W4+y0P4hrLFiHSjfmKdBrE9TfBNBXWbIbGjjmR7Q5eRd6 FGmiMMPv2D+yT/8wpeWnNoB77tG58W0nMYXS4GktRoPP+T/US3QdCKrCznoaNm0dOr ZbbLLcv7bO9ag== Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 022FA6330F for ; Fri, 15 Jul 2022 21:14:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EwYXvBjM"; dkim-atps=neutral Received: by mail-pj1-x102f.google.com with SMTP id o3-20020a17090a744300b001ef8f7f3dddso7000043pjk.3 for ; Fri, 15 Jul 2022 12:14:10 -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=Uz+u8kCOf37oqVbQNCDdLgtf+EpJ0K3cuUXKTKqQAg0=; b=EwYXvBjMBSKobG77FetoGGWKn5VxcjLK5gYjv2Kdy5tPEk2V+C1QoMzCQNZT2NG5KO Ixvo+FQvQ/IqUUVwpEcRp52h8ynGeXdguOIBbRZRq6gYxO9evO3e8xrsGQwmfrlQlFQg ApUX/QjchhhFB6tgmdgY7VKpQ9j5oFBvv4afa+b9k+ro7Mk5X0Gh6HeKqKnc3hmVPp59 h26pX7SEDuJKnsh/Vbx/s+Iynw/X0bqadF2w6+6cNj7OYEDkcE6ZMapyhwZxcFeeIiI2 UJIxC8j8ATYqGFNlqWptyJWrKiZ8kRQIdpaHH4ggia1gaDIywXWOANiWLauZVTfsw+CD 2AUA== 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=Uz+u8kCOf37oqVbQNCDdLgtf+EpJ0K3cuUXKTKqQAg0=; b=OxFzxfUUq5PAaIjKnkpbFbCRxs/7uA7WFle7Jn29BgUeSCOAO8aRoRnKFcUSRJtI+W KacDjYdo1wb5E0L0y1pZiFzc7KppQLSIJ49siWeVfbairjHuhHjU7K3zk8Sz6ikZbsRG ondsWNoWDQkU7iJXz1eYQsSvLW3JK02z0E/jmjGy98ZuwbCLPOTsI3yzuOQ3n5FSWDnv 2Ztm8H7zxm6Mimz5bfgsedPZzZ3YohDCh43SywbHuJulVZL/SPyYQ/TsIpO7Bcih+Lhq BUOlJIoI3KxWmK7VfU+udRdZgT63fpv+F2w9z/AgLlOPXfoAtklHCWNok11LI7UI4oho +mMg== X-Gm-Message-State: AJIora9ykUud4BO7azS/csMPf6kfDFD5ZJxfxkFC4E/BNrqRsiBx+LmP tfyg7zkuGQ9WLd9614oofsGRS0NuNOk5Og== X-Google-Smtp-Source: AGRyM1u0nrS+1Dj6Sjk7Y48oMRL0pVC8mMzNlYEkwzrXydDB92RheVb5MWVbm2xgaQ/l0v/slpe5rg== X-Received: by 2002:a17:90b:4c48:b0:1ef:c839:c68c with SMTP id np8-20020a17090b4c4800b001efc839c68cmr17232832pjb.233.1657912449285; Fri, 15 Jul 2022 12:14:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:09 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:51 +0800 Message-Id: <20220715191400.890976-3-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 02/11] qcam: ControlFrame: Display defualt value of 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" Display a QLabel below the Control Name showing the default value for the controls. This adds support to Display defualt value for the control types : ControlTypeBool ControlTypeInteger32 ControlTypeInteger64 ControlTypeFloat Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/control_frame.cpp | 52 +++++++++++++++++++++++++++-- src/qcam/settings/control_frame.h | 9 +++++ src/qcam/settings/controls_tab.cpp | 2 +- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 6f5cba6d..785e4040 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -14,13 +14,61 @@ #include #include -ControlFrame::ControlFrame(const libcamera::ControlId *control, QWidget *parent) - : QFrame(parent), control_(control) +using namespace libcamera; + +ControlFrame::ControlFrame(const libcamera::ControlId *control, + const libcamera::ControlInfo &controlInfo, + QWidget *parent) + : QFrame(parent), control_(control), controlInfo_(controlInfo) { /* Main layout for the frame */ QVBoxLayout *frameVLayout = new QVBoxLayout(this); frameVLayout->addWidget(new QLabel(QString::fromStdString(control_->name()))); + /* + * No need to pass parents to widgets, + * as QVBoxLayout transfers ownership to + * its parent widget. + */ + frameVLayout->addWidget(defaultValueLabel()); + setFrameStyle(QFrame::StyledPanel); } + +/* ----------------------------------------------------------------------------- + * Widgets + */ + +QLabel *ControlFrame::defaultValueLabel(QWidget *parent) +{ + QLabel *defaultValLabel = new QLabel(parent); + + defaultValLabel->setText("Default Value: " + getDefaultValueQStr()); + + return defaultValLabel; +} + +/* ----------------------------------------------------------------------------- + * Helpers + */ + +QString ControlFrame::getDefaultValueQStr() +{ + switch (control_->type()) { + case ControlTypeBool: + if (controlInfo_.def().get()) { + return QString("True"); + } else { + return QString("False"); + } + case ControlTypeInteger32: + return QString::number(controlInfo_.def().get()); + case ControlTypeInteger64: + return QString::number(controlInfo_.def().get()); + case ControlTypeFloat: + return QString::number(controlInfo_.def().get()); + default: + return QString("Unavailable"); + } +} diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h index 10690674..884feb6b 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -9,6 +9,7 @@ #include +#include #include #include @@ -18,9 +19,17 @@ class ControlFrame : public QFrame public: ControlFrame(const libcamera::ControlId *control, + const libcamera::ControlInfo &controlInfo, QWidget *parent); ~ControlFrame() = default; private: const libcamera::ControlId *control_; + const libcamera::ControlInfo &controlInfo_; + + /* Widgets */ + QLabel *defaultValueLabel(QWidget *parent = nullptr); + + /* Helper Hunctions */ + QString getDefaultValueQStr(); }; diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp index 33ed9332..adc24326 100644 --- a/src/qcam/settings/controls_tab.cpp +++ b/src/qcam/settings/controls_tab.cpp @@ -26,7 +26,7 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, int controlCount = 0; for (auto &[control, info] : camera_->controls()) { - ControlFrame *controlFrame = new ControlFrame(control, this); + ControlFrame *controlFrame = new ControlFrame(control, info, this); controlGLayout->addWidget(controlFrame, controlCount / 2, controlCount % 2); From patchwork Fri Jul 15 19:13:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16658 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 9CA16BE173 for ; Fri, 15 Jul 2022 19:14:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6565A6331C; Fri, 15 Jul 2022 21:14:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912454; bh=D4tPv2pcGoac+7pJ3/rPN0x+tV79NXmrCX7NjS6peAs=; 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=u3lgv6uUInx9vAvqm6LQ9OA619ED0H4kUe1/gRQZpBlMohDADMsvyf1Hce6yS2Rh0 qp/64ovoLlmw2lmhNlcLyg+QejrdeIXp12zjAjzyDrWvd+YHD5UupAziHZ7TcraPL3 +HWjhP5Ur2AH+LE+wHfEMWKuVz/qFyYMJXIQskfP8YA77PLhnqGirgTiLDpj7u/Uzb hqOlZIEGW4RXShi6QXeytJlnL3wg5GNGf6srvX8O2xL82qnYCAI6KqP+Y1g5l8v0XW E826DGk4kAZD1WxsnqAOu0uhgSbUN05pnSRiyW1P64C1U4hOSgb+Lc2kFHZiLMUunA wfs5sEi8ryBJA== Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E25B663312 for ; Fri, 15 Jul 2022 21:14:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CI9b4HGt"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id o15so6466186pjh.1 for ; Fri, 15 Jul 2022 12:14:12 -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=0MiMzge+VGNgCec63JdCht73U4viSdAiz/rpsk0XHS0=; b=CI9b4HGt6ltItBk+B0dmlTgmhkn2c79IB31QPwOMd2RX2reTudkOt/T8HlhnAOEnPq NaOvVWgqHzzz5nEGmFgFprT4lY30E7nIgQHK6Q5T0L+1uHR5B2OrvGSfG37s+Ys8XfKh GwIa+JovYfHqFBfTn5AdPQMpaFv3qiWkh0QXGl1LH3h7DkidnvrkLLMLafm5Xr+i0BMY z8c4A98AvVaSYmB9A6FMAMu+Rdg3or1+OfEEAj722wzEsf3R+BqfNdhjGlPe0BvLPa9t wU+bIaNew5mR5OFaX9NvWtjg7rV3wk8lpkSxonFXxE8GybjVtHoYwtjbVeWesVXv2IrN VoWg== 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=0MiMzge+VGNgCec63JdCht73U4viSdAiz/rpsk0XHS0=; b=xzNm1FZ45aLcrPqKQIhMQY5kfhV8pB/BSAlRbl/bLPRrWIOi1sXWDS2jYDgx3X/VaH D0QMUNefS1vajDlCz6kFNUpl+H5oECj4lLeWobzmCYhRIG2Iy+UPJrQ35RaqfhsO5QIz GDiKu/kMnJg3NeZb7YpRIr5HWU3SHFE3W7z9UF9LuSr272Xj0cVHOQXpNY14lvbM4wIe +Cf+t8EnatRvSATy8hSz55wL568DRuPbXBNr1APU70RrN1RJKLIW8bVzGAzAt1UBCGbI ZM41Lq4Cu06R765FICK14ymgAMQ8ADtKmL0p1tUtviur+HTy3u01uje+pDhr/unEgnRX 2Rcg== X-Gm-Message-State: AJIora+Dcgq/gvOwcEc4pD+MJXWb9FkGqAQNAkNhmMqHbfMoywjs9lNi NfKjGsR4Qsn+xluX1DkLPFRuCzB99CtDUg== X-Google-Smtp-Source: AGRyM1twThedweFcFymnbjvdQBXXJynqBaK1yRYSTRtvopNSni5T8JkmWNfpBdNVMwVmnX/lg/TrGg== X-Received: by 2002:a17:90b:4f85:b0:1f0:95d:c02b with SMTP id qe5-20020a17090b4f8500b001f0095dc02bmr23410718pjb.89.1657912450844; Fri, 15 Jul 2022 12:14:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:10 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:52 +0800 Message-Id: <20220715191400.890976-4-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 03/11] qcam: Add GUI way to change control values 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" Introduce GUI ability to change control values currently only for boolean control types. Each of the ControlFrame first identifies the type of control it is and then accordingly constructs the widget that would help the user to interact with it. The current model of connecting the controls change info to the MaindWindow is as follows. +-----------+ |Main Window| +-----^-----+ | | +-------+-------+ |Settings Dialog| +--^----^------^+ | | | +------+ | +-----+ | | | +-----+---+ +----+----+ +----+----+ |Various | | Tabs | | ... | ++---+----+ +---+---+-+ ++--+--+--+ | | | | | | | | | | | | | | | | | | | | | Implement a controlLatch mechanism to update thec ontrolList. As the Settings QDialog and ControlFrame processing the change in control lie in the same thread there would be no race to access the ControlList. This allows us to use to shared_ptr to the ControlList to help us the same function from MaindWindow::queueRequest() and the controlListChanged() signal. We clear the controlList_ in MainWindow::queueRequest() and not in the MainWindow::controlListLatch() because when in controlListLatch() we need to clear it when we don't have script nor the alerted by the signal. But what Can happen is that we have controlListLatch() is triggered by the signal and then immediately called by the queueRequest() which would clear the controlList and it would not end up getting set. Signed-off-by: Utkarsh Tiwari --- src/qcam/main_window.cpp | 38 +++++++++++++-- src/qcam/main_window.h | 4 ++ src/qcam/settings/control_frame.cpp | 75 +++++++++++++++++++++++++++-- src/qcam/settings/control_frame.h | 13 ++++- src/qcam/settings/controls_tab.cpp | 19 +++++++- src/qcam/settings/controls_tab.h | 10 ++++ src/qcam/settings/settings_dialog.h | 5 ++ 7 files changed, 156 insertions(+), 8 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index f0916b8e..5d11ef98 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -98,7 +98,7 @@ private: MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) : saveRaw_(nullptr), options_(options), cm_(cm), allocator_(nullptr), - isCapturing_(false), captureRaw_(false) + isCapturing_(false), captureRaw_(false), controlList_(ControlList()) { int ret; @@ -353,6 +353,8 @@ void MainWindow::openSettingsDialog() } settingsDialog_ = std::make_unique(camera_, this); + connect(settingsDialog_.get(), &SettingsDialog::controlListChanged, + this, &MainWindow::controlListLatch); settingsDialog_->show(); } @@ -891,10 +893,40 @@ void MainWindow::renderComplete(FrameBuffer *buffer) int MainWindow::queueRequest(Request *request) { - if (script_) - request->controls() = script_->frameControls(queueCount_); + /* + * Call the controlListLatch with a nullptr to indicate that it + * has been called by us and not by the signal. + */ + + controlListLatch(nullptr); + request->controls() = controlList_; + + /* Clear controlList_ to remove old controls that have been set.*/ + if (controlList_.size()) + controlList_.clear(); queueCount_++; return camera_->queueRequest(request); } + +void MainWindow::controlListLatch(std::shared_ptr controlList) +{ + /* + * If we have been given a non-null shared_ptr then it means we + * have been alerted by the SettingsWindow::controlListChanged signal. + */ + + if (controlList) { + controlList_ = *(controlList); + + /* Shut down the capture script */ + if (script_) + toggleScriptAction(true); + + return; + } + + if (script_) + controlList_ = script_->frameControls(queueCount_); +} diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index e35f9029..05207023 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -71,6 +71,8 @@ private Q_SLOTS: void renderComplete(libcamera::FrameBuffer *buffer); + void controlListLatch(std::shared_ptr controlList); + private: int createToolbars(); @@ -139,4 +141,6 @@ private: std::vector> requests_; std::unique_ptr script_; + + libcamera::ControlList controlList_; }; diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 785e4040..e335d373 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -9,7 +9,9 @@ #include +#include #include +#include #include #include #include @@ -27,11 +29,11 @@ ControlFrame::ControlFrame(const libcamera::ControlId *control, frameVLayout->addWidget(new QLabel(QString::fromStdString(control_->name()))); /* - * No need to pass parents to widgets, - * as QVBoxLayout transfers ownership to - * its parent widget. + * No need to pass parents to widgets, as QVBoxLayout transfers + * ownership to its parent widget. */ frameVLayout->addWidget(defaultValueLabel()); + frameVLayout->addWidget(controlInteraction()); setFrameStyle(QFrame::StyledPanel); } @@ -49,6 +51,73 @@ QLabel *ControlFrame::defaultValueLabel(QWidget *parent) return defaultValLabel; } +QWidget *ControlFrame::controlInteraction(QWidget *parent) +{ + QWidget *containerWidget = new QWidget(parent); + + switch (control_->type()) { + case ControlTypeBool: { + QHBoxLayout *HCheckBoxLayout = new QHBoxLayout(containerWidget); + + HCheckBoxLayout->addWidget(new QLabel("Enabled :")); + + controlCheckBox_ = new QCheckBox; + /* + * In the start we are not sure what is exactly the state of + * the control. Do not assume. Set in partially checked state. + */ + controlCheckBox_->setCheckState(Qt::PartiallyChecked); + + connect(controlCheckBox_, &QCheckBox::stateChanged, + this, &ControlFrame::notifyControlChange); + + HCheckBoxLayout->addWidget(controlCheckBox_); + + /* Align it with the name of the control. */ + HCheckBoxLayout->setAlignment(Qt::AlignLeft); + HCheckBoxLayout->setMargin(0); + return containerWidget; + } + default: + return (new QLabel("Currently Unavailable")); + } +} + +/* ----------------------------------------------------------------------------- + * Qt Slots + */ + +void ControlFrame::notifyControlChange() +{ + ControlValue controlValue = ControlValue(); + + switch (control_->type()) { + case ControlTypeBool: + + /* + * When clicked for the first time, the switch comes from a + * partially checked state. Turn the triset off so we can have + * only enabled and disabled states. + */ + controlCheckBox_->setTristate(false); + /* + * When this function is invoked, the checkbox can only be in + * the Checked or Unchecked State (after the first time). + */ + if (controlCheckBox_->checkState() == Qt::CheckState::Checked) + controlValue.set(true); + else + controlValue.set(false); + + break; + default: + /* Nothing to emit so return */ + return; + } + + Q_EMIT controlChanged(control_, controlValue); +} + /* ----------------------------------------------------------------------------- * Helpers */ diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h index 884feb6b..61005ea5 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -9,8 +9,9 @@ #include -#include +#include #include +#include #include class ControlFrame : public QFrame @@ -23,13 +24,23 @@ public: QWidget *parent); ~ControlFrame() = default; +Q_SIGNALS: + void controlChanged(const libcamera::ControlId *controlId, + const libcamera::ControlValue); + +private Q_SLOTS: + void notifyControlChange(); + private: const libcamera::ControlId *control_; const libcamera::ControlInfo &controlInfo_; /* Widgets */ + QWidget *controlInteraction(QWidget *parent = nullptr); QLabel *defaultValueLabel(QWidget *parent = nullptr); + QCheckBox *controlCheckBox_; + /* Helper Hunctions */ QString getDefaultValueQStr(); }; diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp index adc24326..0777d708 100644 --- a/src/qcam/settings/controls_tab.cpp +++ b/src/qcam/settings/controls_tab.cpp @@ -17,9 +17,11 @@ #include "control_frame.h" +using namespace libcamera; + ControlsTab::ControlsTab(std::shared_ptr camera_, QWidget *parent) - : QWidget(parent) + : QWidget(parent), controlList_(std::make_shared()) { /* Main Layout for the tab */ QGridLayout *controlGLayout = new QGridLayout(this); @@ -27,6 +29,8 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, int controlCount = 0; for (auto &[control, info] : camera_->controls()) { ControlFrame *controlFrame = new ControlFrame(control, info, this); + connect(controlFrame, &ControlFrame::controlChanged, + this, &ControlsTab::controlChanged); controlGLayout->addWidget(controlFrame, controlCount / 2, controlCount % 2); @@ -36,3 +40,16 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, if (controlCount == 0) controlGLayout->addWidget(new QLabel("No controls available")); } + +/* ----------------------------------------------------------------------------- + * Qt Slots + */ + +void ControlsTab::controlChanged(const libcamera::ControlId *controlId, + const libcamera::ControlValue controlValue) +{ + controlList_->clear(); + + controlList_->set(controlId->id(), controlValue); + Q_EMIT controlListChanged(controlList_); +} diff --git a/src/qcam/settings/controls_tab.h b/src/qcam/settings/controls_tab.h index 6a63f334..5bac7d48 100644 --- a/src/qcam/settings/controls_tab.h +++ b/src/qcam/settings/controls_tab.h @@ -21,4 +21,14 @@ class ControlsTab : public QWidget public: ControlsTab(std::shared_ptr camera_, QWidget *parent); ~ControlsTab() = default; + +Q_SIGNALS: + void controlListChanged(const std::shared_ptr); + +public Q_SLOTS: + void controlChanged(const libcamera::ControlId *controlId, + const libcamera::ControlValue controlValue); + +private: + std::shared_ptr controlList_; }; diff --git a/src/qcam/settings/settings_dialog.h b/src/qcam/settings/settings_dialog.h index c2fa61ea..e6efd876 100644 --- a/src/qcam/settings/settings_dialog.h +++ b/src/qcam/settings/settings_dialog.h @@ -32,8 +32,13 @@ public: ControlsTab *controlsTab = new ControlsTab(camera, this); settingTabWidget->addTab(controlsTab, "Controls"); + connect(controlsTab, &ControlsTab::controlListChanged, + this, &SettingsDialog::controlListChanged); setWindowTitle("Settings"); } ~SettingsDialog() = default; + +Q_SIGNALS: + void controlListChanged(std::shared_ptr); }; From patchwork Fri Jul 15 19:13:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16659 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 633F0BE173 for ; Fri, 15 Jul 2022 19:14:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 12ACB6331F; Fri, 15 Jul 2022 21:14:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912456; bh=3mc+syPrI82F4rhVHk8MS62FrCry/Q0jomW8Ex+wT7c=; 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=0lVFQJdGUgEs/w3ezmkBqtEJReR7h1oct7xIMImV7z76PYtCSVvBc2goetsAfUIMm OrKbw1ZMRsIljd3JGreq44AqM8LHGABi9JwCI1TrixqDju+mnJhLPnd/EadYDddyMf 3z6Kt7buZjhI4rIdxQ0qIskGafSaLM8OwFp4c3ZD2dvtI37Ix0Qu1y6+48DyiBFMtI QGQwXrd6adKmARnroD7bKmqnccEMZiETtzAkyxyaaTjtm44S7uDQwWnatyqVXgGvQV sZiEoiMBc0xs8nUVcOxBRi0vqtmV8VxOeJ3Tx7bsBUwBxQkCGs3kSOJJ+YGQalnKGi DExNZpqWLnSEg== Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 061F36330F for ; Fri, 15 Jul 2022 21:14:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c8nnjqr/"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id q5-20020a17090a304500b001efcc885cc4so6986807pjl.4 for ; Fri, 15 Jul 2022 12:14:13 -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=CcoTbYUj3cSt0YMH+9NqHU45gZLE6JusliHQMFRScRI=; b=c8nnjqr/6QhoQyHyftjONYBBPk/QegLJX35iEnEI2whK+y/UBVAiijTyu8p2GpcsGQ JtnTzXmkYTidnKq1/Okov8vOKl62PFh0qWE8eV8ldmbyx+L4bEM/dkF727WTsqOZNZ6k HcB+lXkSKTUUvLFsCst7vNA2MjX0SwKBdLUK01MIhMfvpiyItgt5kIrvJE/uZjtubyZY BanvYCAVO5SXzanTeX0UeYXupySY80kodqbkaqWgGi4k9i7D9g2VumVzAsha7iMDyHeG zUgYZ/R5b7vF5GeGQh2E2Z/vpdxsmcUlrobIK1IuE76bYiQpulM5keZxWUNByy3rbrMh ue8g== 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=CcoTbYUj3cSt0YMH+9NqHU45gZLE6JusliHQMFRScRI=; b=CI63XLfXdC0lBPo+qYEWZd2lFHh2E8yfc+3w3fl22BF7gXO8osnuuQmPIqs/jsrOQw wHeGY7PN6xme57kmicxc0VElE8alfkzdGBgzr+k7z7U49ssIqvpcaqUfZj4Mlev4aV7e K+5sH1lqRDZRE7TparieS5nhS1D/wtQKnvND+jdfpz9jOwfs18Cm+ToW77lkIF47kcpI SkagBc9fQM7oeHTce7TRw0UDLZ7voGGCAnT/TkT0o90BzQrdScDw28MjF7KxUsRz5bHn 3/TDpMv8jajG5LiW5+XAb/14erZfX500kOT6ZVHwqQMbEwnoU9e18s0kOZVXuqahrJFs fU6g== X-Gm-Message-State: AJIora/oSsoq0A2a7YnS/AMJsVqLtwVqy6COClAphJmyLU/xujCf3ws/ I+fFjalErOPqox45FDRAudsDPsBJU493Tw== X-Google-Smtp-Source: AGRyM1ts4KofZ4srBp/IWk50Gjzv2erxS9lTF69z2ha2MOlFul/Xgof2lCdzx1oMT1grkW9qyLy0Fw== X-Received: by 2002:a17:902:aa06:b0:16c:cf06:c2d0 with SMTP id be6-20020a170902aa0600b0016ccf06c2d0mr2549587plb.117.1657912452320; Fri, 15 Jul 2022 12:14:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:12 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:53 +0800 Message-Id: <20220715191400.890976-5-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 04/11] qcam: ControlsTab: Implement QScrollArea 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" If the camera has lots of controls it can overrun the screen. Fix this by using a QScrollArea. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/controls_tab.cpp | 9 +++++++-- src/qcam/settings/controls_tab.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp index 0777d708..30899783 100644 --- a/src/qcam/settings/controls_tab.cpp +++ b/src/qcam/settings/controls_tab.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include "control_frame.h" @@ -21,10 +22,11 @@ using namespace libcamera; ControlsTab::ControlsTab(std::shared_ptr camera_, QWidget *parent) - : QWidget(parent), controlList_(std::make_shared()) + : QScrollArea(parent), controlList_(std::make_shared()) { + QWidget *containerWidget = new QWidget(this); /* Main Layout for the tab */ - QGridLayout *controlGLayout = new QGridLayout(this); + QGridLayout *controlGLayout = new QGridLayout(containerWidget); int controlCount = 0; for (auto &[control, info] : camera_->controls()) { @@ -39,6 +41,9 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, if (controlCount == 0) controlGLayout->addWidget(new QLabel("No controls available")); + + /* Set widget and policies for the scrollarea */ + setWidget(containerWidget); } /* ----------------------------------------------------------------------------- diff --git a/src/qcam/settings/controls_tab.h b/src/qcam/settings/controls_tab.h index 5bac7d48..28efd35e 100644 --- a/src/qcam/settings/controls_tab.h +++ b/src/qcam/settings/controls_tab.h @@ -11,10 +11,11 @@ #include +#include #include #include -class ControlsTab : public QWidget +class ControlsTab : public QScrollArea { Q_OBJECT From patchwork Fri Jul 15 19:13:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16660 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 33F3BBE173 for ; Fri, 15 Jul 2022 19:14:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D12A663323; Fri, 15 Jul 2022 21:14:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912458; bh=64RGzpjifWEuiuyqgxIJ9ekMYjRUd4lZwAYHLgeqNFA=; 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=Lmou+qHTXkeMkSdteH9OoNTBsDVpGMU9oTdsrou43tGrR+YeNllbmmdAOy1SPwBqb eF2sfZc9hW2PuqI2lkxJ6A3vlR1APQ5/I32OVd0u+YLjYHhjGL/7d3Ue/u1i175El8 cKnhd4RPqfYbfACiu9TRBWz633Ol8fUYXuyeeUOd2zqkuWlg8I54fKlqhUX8wf/cG+ LepFoU1oIuah4XcQeUApqBacizzgqdXVANbdnEO9Y4Tx6KsZmby+v2KXFnGw2ER/6Y dKMFJsknBcHZ8NMMBv4jwzAlPY8k2OvMzclV5+ffwMItrt12eyhgyx6u6gc6jxL14f F9bBOvAkqNpgw== Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B0F36331B for ; Fri, 15 Jul 2022 21:14:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="M55oUzei"; dkim-atps=neutral Received: by mail-pj1-x1034.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so12403808pjo.3 for ; Fri, 15 Jul 2022 12:14:15 -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=3lwUKm2bjTO3FJ8fuxAP9NamN7+Q/GTWJKHWvQehhm4=; b=M55oUzei/NUGXvb45cuubQiLunJOzk1temixX8aOf1RREHj0rPk0hZkDMGQTuWyTus wbtvz+PjKlvqhDZopZIcN7D8w8m6un4QDRbHhuT37bQBXL/IwfKHRaZcV48iu6FdRAKY O3XdPSldv3ToleACdn0VvBML/r+5/RveWGCR41a4EO/DcrlXCRRJIiLK0t0aLbCWDn4A 6qfq24xUw0Pa6xSl5eucLo5SeRE9OwuNRCdt8GxBKbR92BxhStEQq4mm7p2KA9aYvTAR dIs6lsYqzKw9pfjou7rWwLRtT+GRsz+Ed76YH9pzvHkYvI3/IRWxw/Maeu2FYXVq8WMD /FJg== 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=3lwUKm2bjTO3FJ8fuxAP9NamN7+Q/GTWJKHWvQehhm4=; b=cVkCkgnR2/uZyFJHzIrF6fJbg9efZTiDuO/Cu3UfhUxXP+Dlf2RIoUFM9mIx6B65Hs 0cxuonX3SGo1FmhIf8O+LUZN4XBc8iqmm8inbu/pq2fchB/ccUEwy1ZqUXW88da+aoxq KSGmDrXqec3oDSxZHIFdIOZtKhLod47vtziWmKpDz5v5+6OC+mBZviL69JC7obEuKS5P OavQUOIbJle2ZCfuhSfu7tQ26ZvDD8fwfOtz5yslsbn1VVTJIIc00Zb9piLX3fAP2Y/N Z1ovPfTmm53SWjuBdIR3tCUtXQh+f1ZB2vAPWqo2NOgaMZ8+s1ReWfKsb2dG/Bs9TDov 5OGg== X-Gm-Message-State: AJIora9I+ixS6p6dbe28HsRjDBPBlnTgeg5IoV94B87Un5RVxlk3oetW 3Vxv91yHu7iEFpMK9G15OARGBJt6s2Brlg== X-Google-Smtp-Source: AGRyM1uF7YzO3R/xyOEF6TNgDy8IM3W4Immj8YOVoE/2RGHyyFwnO5IEtVgV6zfKdZmEjziMG8cmuw== X-Received: by 2002:a17:902:dac1:b0:16c:6988:d226 with SMTP id q1-20020a170902dac100b0016c6988d226mr14958252plx.39.1657912454182; Fri, 15 Jul 2022 12:14:14 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:13 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:54 +0800 Message-Id: <20220715191400.890976-6-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 05/11] qcam: ControlFrame: Add Current Value label 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 a QLabel which displays the Current value of the control. Currently this only supports ControlTypeBool. At start do not display any Current value as we cannot be sure of the starting conditions and the controls that have been applied. When a request completes succesfully completes, we use its ControlList to update the currentValue. The current model for sending the controlValue is : MainWindow -> Settings -> Control Tab -> Control Frame Signed-off-by: Utkarsh Tiwari --- src/qcam/main_window.cpp | 10 +++++++++ src/qcam/main_window.h | 4 ++++ src/qcam/settings/control_frame.cpp | 32 +++++++++++++++++++++++++++++ src/qcam/settings/control_frame.h | 4 ++++ src/qcam/settings/controls_tab.cpp | 7 +++++++ src/qcam/settings/controls_tab.h | 5 +++++ src/qcam/settings/settings_dialog.h | 3 +++ 7 files changed, 65 insertions(+) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 5d11ef98..0dc72f3c 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -355,6 +355,8 @@ void MainWindow::openSettingsDialog() settingsDialog_ = std::make_unique(camera_, this); connect(settingsDialog_.get(), &SettingsDialog::controlListChanged, this, &MainWindow::controlListLatch); + connect(this, &MainWindow::processControls, + settingsDialog_.get(), &SettingsDialog::processControls); settingsDialog_->show(); } @@ -823,6 +825,14 @@ void MainWindow::processCapture() request = doneQueue_.dequeue(); } + /* Process controlList for current values. */ + if (settingsDialog_) { + if (settingsDialog_->isVisible()) { + controlListShared_ = std::make_shared(request->controls()); + Q_EMIT processControls(controlListShared_); + } + } + /* Process buffers. */ if (request->buffers().count(vfStream_)) processViewfinder(request->buffers().at(vfStream_)); diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 05207023..97234d2e 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -57,6 +57,9 @@ public: bool event(QEvent *e) override; +Q_SIGNALS: + void processControls(std::shared_ptr); + private Q_SLOTS: void quit(); void updateTitle(); @@ -143,4 +146,5 @@ private: std::unique_ptr script_; libcamera::ControlList controlList_; + std::shared_ptr controlListShared_; }; diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index e335d373..3ab9fdb4 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -33,6 +33,7 @@ ControlFrame::ControlFrame(const libcamera::ControlId *control, * ownership to its parent widget. */ frameVLayout->addWidget(defaultValueLabel()); + frameVLayout->addWidget(currentValueLabel()); frameVLayout->addWidget(controlInteraction()); setFrameStyle(QFrame::StyledPanel); @@ -83,10 +84,41 @@ QWidget *ControlFrame::controlInteraction(QWidget *parent) } } +QWidget *ControlFrame::currentValueLabel(QWidget *parent) +{ + QWidget *containerWidget = new QWidget(parent); + + QHBoxLayout *HCurrentValueLayout = new QHBoxLayout(containerWidget); + + currentValue_ = new QLabel; + + HCurrentValueLayout->addWidget(new QLabel("Current Value: ")); + HCurrentValueLayout->addWidget(currentValue_); + + /* Align with ControlName. */ + HCurrentValueLayout->setAlignment(Qt::AlignLeft); + HCurrentValueLayout->setMargin(0); + + return containerWidget; +} /* ----------------------------------------------------------------------------- * Qt Slots */ +void ControlFrame::setCurrentValue(const libcamera::ControlValue controlValue) +{ + switch (control_->type()) { + case ControlTypeBool: + if (controlValue.get()) + currentValue_->setText("True"); + else + currentValue_->setText("False"); + break; + default: + break; + } +} + void ControlFrame::notifyControlChange() { ControlValue controlValue = ControlValue(); diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h index 61005ea5..9c3b059b 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -12,6 +12,7 @@ #include #include #include +#include #include class ControlFrame : public QFrame @@ -24,6 +25,7 @@ public: QWidget *parent); ~ControlFrame() = default; + void setCurrentValue(const libcamera::ControlValue controlValue); Q_SIGNALS: void controlChanged(const libcamera::ControlId *controlId, const libcamera::ControlValue); @@ -37,9 +39,11 @@ private: /* Widgets */ QWidget *controlInteraction(QWidget *parent = nullptr); + QWidget *currentValueLabel(QWidget *parent = nullptr); QLabel *defaultValueLabel(QWidget *parent = nullptr); QCheckBox *controlCheckBox_; + QLabel *currentValue_; /* Helper Hunctions */ QString getDefaultValueQStr(); diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp index 30899783..496b5d3b 100644 --- a/src/qcam/settings/controls_tab.cpp +++ b/src/qcam/settings/controls_tab.cpp @@ -31,6 +31,7 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, int controlCount = 0; for (auto &[control, info] : camera_->controls()) { ControlFrame *controlFrame = new ControlFrame(control, info, this); + controlFrameMap_[control->id()] = controlFrame; connect(controlFrame, &ControlFrame::controlChanged, this, &ControlsTab::controlChanged); @@ -50,6 +51,12 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, * Qt Slots */ +void ControlsTab::notifyControlFrame(std::shared_ptr controlList) +{ + for (auto &[id, controlValue] : *(controlList)) + controlFrameMap_[id]->setCurrentValue(controlValue); +} + void ControlsTab::controlChanged(const libcamera::ControlId *controlId, const libcamera::ControlValue controlValue) { diff --git a/src/qcam/settings/controls_tab.h b/src/qcam/settings/controls_tab.h index 28efd35e..215c41fd 100644 --- a/src/qcam/settings/controls_tab.h +++ b/src/qcam/settings/controls_tab.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -15,6 +16,8 @@ #include #include +#include "control_frame.h" + class ControlsTab : public QScrollArea { Q_OBJECT @@ -29,7 +32,9 @@ Q_SIGNALS: public Q_SLOTS: void controlChanged(const libcamera::ControlId *controlId, const libcamera::ControlValue controlValue); + void notifyControlFrame(std::shared_ptr controlList); private: std::shared_ptr controlList_; + std::map controlFrameMap_; }; diff --git a/src/qcam/settings/settings_dialog.h b/src/qcam/settings/settings_dialog.h index e6efd876..f0462d89 100644 --- a/src/qcam/settings/settings_dialog.h +++ b/src/qcam/settings/settings_dialog.h @@ -34,6 +34,8 @@ public: settingTabWidget->addTab(controlsTab, "Controls"); connect(controlsTab, &ControlsTab::controlListChanged, this, &SettingsDialog::controlListChanged); + connect(this, &SettingsDialog::processControls, + controlsTab, &ControlsTab::notifyControlFrame); setWindowTitle("Settings"); } @@ -41,4 +43,5 @@ public: Q_SIGNALS: void controlListChanged(std::shared_ptr); + void processControls(std::shared_ptr); }; From patchwork Fri Jul 15 19:13:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16661 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 F0153BE173 for ; Fri, 15 Jul 2022 19:14:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 830CD63325; Fri, 15 Jul 2022 21:14:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912459; bh=8QNVASaiFR/bPAyGn5OpZsRUR8WjnFbq4S4G/LhKEoU=; 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=Ov6w+cfQzkUkU3EBB29seRVctpLJtuEiNpYxJ8VDIMQ/2AOkkSbVtPXUZDfw0aewR xU3HX9SVKqn+kI3kZ61h+HteJOxitMsxludylu4TzaCmkpL6KxTynh+UdrHGnuGKA1 6c/aat7Kqda4cDTQj5tFlVYeWxoinN+KDQ+f18qqy6iB1O9qALzeA/QbYMjeB4XjwK en4PVtW0AfQiNVFdEGTdJsYta9q2oiFz93M3o/lsMxlbGe1oCUZKqPSWAPfYh/3mbD oAeNDasLpwztKTXvxZOAZZFXnmaqVsi0y73o/1jWMDBDaug3xiutslO1cgMr56Myoo mhhI22DZxGtIg== Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 95A7063312 for ; Fri, 15 Jul 2022 21:14:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B+1sTFTx"; dkim-atps=neutral Received: by mail-pl1-x631.google.com with SMTP id b2so3959994plx.7 for ; Fri, 15 Jul 2022 12:14:17 -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=bI6WmK2jLSNOYBVCWyPjEwrk9dOF4rDXl614lJRsC6g=; b=B+1sTFTxZKoO6OAOHr0+PCyqqRDim8dl6iehqunUv6iyINWxKKA9qnKkQDfbNdFBNH yJ+qOsLTO7FDthoKhlnsErHGTKF8LS/zxXkYNyfzDe+P9X9KgSEs2MLdnRAog7OozGUw varx74lOybBwC7qVvfLcAezOYQ6cxPIBZ8zah2V1+2orHFLqFu72e5lqBLIHNa6qdLPP LZH/W33u6PRjDRGAZ4pSwwm+9QboNK5YEhlTq20nLUHzpWJDUrp0dw94v8jcI5Ua1ipA axUiqrlI9L7WjyiNYuHLsKYEmcdscduC57gVuKMN1pOrIosG1G70zYXHZLm8F+hcDlLT El9A== 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=bI6WmK2jLSNOYBVCWyPjEwrk9dOF4rDXl614lJRsC6g=; b=YKAhvSZwqwO4AMjWy8mOomVgACeA/PISXMD5E7P4SAZG8lITOH1edOVsQT3XUTcFpt 2envR4F2qtDUaxRwQCkT0NXxhc0Gc6WhmlJkVXKHGmult3peSEG8cN/mefARN6kebDy3 8ZSmaxlgAtA4JGhmPcmv4vnhNALlz/huLGqL+emYXPx9I8/UzYEo6DEAPt77bTNwgr9e E5WTBP8YEgaMkG49MUb9ry6JmAiu4pz487z3HopEYSHaPb1bDaVLUxw2AT3eUPgk3OB9 SZuizVToAWBH0D1zdKpSH/VElsuEWTuV8X52DsSCAz5osQVm0A8NiGbXfCBAEz3LJCmH dHqA== X-Gm-Message-State: AJIora+xwM9+HnMdZ/PC3srSkcR8vnE6ll6Ppt1JLMxtl/1vKO8u6MYY mBfHlH+QWdWL/ateA6XuqG4Ah2YegwFJcg== X-Google-Smtp-Source: AGRyM1udEBuwkq1ylpBULagSCPRy4T82gKpFx3jXyzbowMUgUlglO5rUKya9MDa7rn3W50UZeR44lQ== X-Received: by 2002:a17:902:ee42:b0:16b:e518:d894 with SMTP id 2-20020a170902ee4200b0016be518d894mr15017871plo.5.1657912455933; Fri, 15 Jul 2022 12:14:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:15 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:55 +0800 Message-Id: <20220715191400.890976-7-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 06/11] qcam: Add Float Slider 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" Qt doesn't support float value sliders. Implement a float slider to help implementing intereactive controls GUI for ControlTypeFloat Signed-off-by: Utkarsh Tiwari --- src/qcam/meson.build | 1 + src/qcam/settings/slider.h | 63 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/qcam/settings/slider.h diff --git a/src/qcam/meson.build b/src/qcam/meson.build index b02b216c..5c4f0552 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -33,6 +33,7 @@ qcam_moc_headers = files([ 'settings/control_frame.h', 'settings/controls_tab.h', 'settings/settings_dialog.h', + 'settings/slider.h', 'viewfinder_qt.h', ]) diff --git a/src/qcam/settings/slider.h b/src/qcam/settings/slider.h new file mode 100644 index 00000000..f4a4825c --- /dev/null +++ b/src/qcam/settings/slider.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2022, Utkarsh Tiwari + * + * slider.h - qcam - Slider + */ + +#pragma once + +#include +#include + +class FloatSlider : public QSlider +{ + Q_OBJECT + + const float INT_TO_FLOAT = 100.0; + +public: + FloatSlider(QWidget *parent) + : QSlider(parent) + { + connect(this, &QSlider::valueChanged, + this, &FloatSlider::notifyValueChanged); + } + + ~FloatSlider() = default; + + void setValue(float value) + { + QSlider::setValue(value * INT_TO_FLOAT); + } + + void setRange(float min, float max) + { + QSlider::setRange(min * INT_TO_FLOAT, max * INT_TO_FLOAT); + } + + float minimum() + { + return QSlider::minimum() / INT_TO_FLOAT; + } + + float maximum() + { + return QSlider::maximum() / INT_TO_FLOAT; + } + + float value() + { + return QSlider::value() / INT_TO_FLOAT; + } + +Q_SIGNALS: + void valueChanged(float value); + +public Q_SLOTS: + void notifyValueChanged(int value) + { + float floatVal = value / INT_TO_FLOAT; + Q_EMIT valueChanged(floatVal); + } +}; From patchwork Fri Jul 15 19:13:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16662 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 7A27DBE173 for ; Fri, 15 Jul 2022 19:14:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2A3A963322; Fri, 15 Jul 2022 21:14:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912461; bh=ElMvh5HqKigp+v0NP59wRUksIO/4XokrGNUsbl0dO7U=; 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=TP1KdlYFyr8FV+p00FJ8TUElIX5CWtzCOJtXD5Y7aPur8ZU1WI+oDdzU4TQlcNKdb ERCqSVLs9OR6ws3pY85jfeDmwpGNLH3BHQlKtw3eDqJ5J8MUf2C2sM1PjKPTVDp+IE ShqT7ia6aBkoUqCj2fmp+ypOhttZ/fXCFq7aSC8HmisJBRqnZdMj0FgkUUAK3+WWcz 2wE+A2ANL66pDaGeLziaQeofcvRooPsYZpKdIfopYrGXId2GcQ0vhm64B366Xgctvw jcM+M2L7jA7BHhCvnLPawzQnceT0BlEGJYmvKN3RJjA0xQKiFlBw0eNjvgwsdpuSxN tUDOdCu/wmtaQ== Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27F246331B for ; Fri, 15 Jul 2022 21:14:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kS3uw4GZ"; dkim-atps=neutral Received: by mail-pj1-x1030.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so7020861pjf.2 for ; Fri, 15 Jul 2022 12:14:19 -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=H6Q3a3MyWxu+j9oPQ0Vx1yJWr4fzvLodrhiRMAc7T4c=; b=kS3uw4GZYWL9laWZ3f8tdkQ/RtKOY2Rox2am7CIsJzdV22UcB5wf4pPZD0WRMHJc5p O4leo2S1qUEcoi32HCj94p7RGwgkwkGXUgmWuxBtC9lJg90wp4l+K+Z8ZRo7iwFwm9xL 6rZBozu1QF2ZDiI9O1Be2BFZ/vVrnu732y5qRfC61JSd1Rp5pJVxsbvHlRRAeIZfUt7z 8hy/hwz9LRAgyRXF2AL0b+u3c7xxHG47tgEV4OtANBzPCtbiZdTYbQS1896xux6xgPUn fyNt5xhZT+VFl7WQ+ZJb2uCeLbSsruQgvPhnU1+WqPEwNfYfDBHMKNmcKIEKwM5TiQJ2 zH9A== 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=H6Q3a3MyWxu+j9oPQ0Vx1yJWr4fzvLodrhiRMAc7T4c=; b=lxezBLcxja0uqkYe1NNflEnM/9kPHXyUmK8lTL5EUWCPBSFe86OrxTF1u+6fXMxbTp 5fOUd4tj8uffyBzBylHlqimSEINH1sOzJRh613wnAzbDSGQ/sDMmR0ximvfHf+gt3Fw6 jkNERuSTReZIp7LRfB4Cmsdc2IP81vEvyljoMYfmGLy9JBmhDdEHAjgd3kIZ3WtdhVXx Pi/dq5+cJBtTbYa6XPlkHfNUUc/2IcVq+nDfAFzYe6Ieeo+bEEs953xi6UnMaFc8x2wO 0n5s7IDJpFQQevyzEarwFpbdvMznSQK004Pn1zvlfywBefnvAKajLgkvgcO3D5L30vLl xzzg== X-Gm-Message-State: AJIora/IvcvPSlmeiRyL9kRprLNddBOwjQ2lZjSj5+FEUxTVkAyN10Kl LdLtv9SnTqcCv2Cuwztvl+bDmk5Bhk5ugw== X-Google-Smtp-Source: AGRyM1srF8wBGx6y07Soqn5dwzWy1jugISSr3Ltb1SKajJ8qVREQMBdLjGGrw37NmQgVNZq658V3uw== X-Received: by 2002:a17:903:120e:b0:16b:8167:e39e with SMTP id l14-20020a170903120e00b0016b8167e39emr14925490plh.165.1657912457431; Fri, 15 Jul 2022 12:14:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:17 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:56 +0800 Message-Id: <20220715191400.890976-8-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 07/11] qcam: Slider: Add SliderLayout to display value 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" Implement SliderLayout which displays minimum Value, maximum Value, currentValue of the slider. The currentValue may not reflect the immediate current value of the control. The SliderLayout is inherits the Slider type so it can support both floatSlider and integer sliders. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/slider.h | 81 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/src/qcam/settings/slider.h b/src/qcam/settings/slider.h index f4a4825c..008c746c 100644 --- a/src/qcam/settings/slider.h +++ b/src/qcam/settings/slider.h @@ -7,18 +7,46 @@ #pragma once +#include +#include #include +#include #include -class FloatSlider : public QSlider +class Slider : public QSlider +{ + Q_OBJECT + +public: + Slider(QWidget *parent = nullptr) + : QSlider(parent){}; + ~Slider() = default; + + virtual QString maximumValueStr() + { + return QString::number(maximum()); + } + + virtual QString minimumValueStr() + { + return QString::number(minimum()); + } + + virtual QString currValueStr() + { + return QString::number(value()); + } +}; + +class FloatSlider : public Slider { Q_OBJECT const float INT_TO_FLOAT = 100.0; public: - FloatSlider(QWidget *parent) - : QSlider(parent) + FloatSlider(QWidget *parent = nullptr) + : Slider(parent) { connect(this, &QSlider::valueChanged, this, &FloatSlider::notifyValueChanged); @@ -51,6 +79,21 @@ public: return QSlider::value() / INT_TO_FLOAT; } + QString maximumValueStr() override + { + return QString::number(maximum()); + } + + QString minimumValueStr() override + { + return QString::number(minimum()); + } + + QString currValueStr() override + { + return QString::number(value()); + } + Q_SIGNALS: void valueChanged(float value); @@ -61,3 +104,35 @@ public Q_SLOTS: Q_EMIT valueChanged(floatVal); } }; + +class SliderLayout : public QWidget +{ + Q_OBJECT + +public: + SliderLayout(Slider *slider, QWidget *parent = nullptr) + : QWidget(parent) + { + QVBoxLayout *mainVLayout = new QVBoxLayout(this); + + QHBoxLayout *labelHLayout = new QHBoxLayout; + + QLabel *minLabel = new QLabel(slider->minimumValueStr()); + QLabel *currValueLabel = new QLabel(slider->currValueStr()); + QLabel *maxLabel = new QLabel(slider->maximumValueStr()); + + connect(slider, &Slider::valueChanged, + this, [currValueLabel, slider]() { + currValueLabel->setText(slider->currValueStr()); + }); + + labelHLayout->addWidget(minLabel); + labelHLayout->addStretch(); + labelHLayout->addWidget(currValueLabel); + labelHLayout->addStretch(); + labelHLayout->addWidget(maxLabel); + + mainVLayout->addLayout(labelHLayout); + mainVLayout->addWidget(slider); + } +}; From patchwork Fri Jul 15 19:13:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16663 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 3AC70BE173 for ; Fri, 15 Jul 2022 19:14:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C358A63329; Fri, 15 Jul 2022 21:14:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912462; bh=JhiSF5d0NB3t37fn65lXbj8c4vWCMyyRUF5KMfFffNo=; 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=Jj0Sw+/J7AHwA7iVNOwmIqhn2zxGS27ECerzAyjfGHWArsf2b5pEqx4ojwyYGhjkf BbfYgTORAPKk2YBURfBDWUrhcBNMLidOr9tSiOpwgQ8V6Y4/eyifTLI0yvCFXcqP6o 5L6u+nWwVHwRosGDd2YfM8qIuFup1lB9jWfxHDsurzIc/hXGWRDWlFPUddgSI6au6K ltbCmb4XbQ4QOzpyMnbm/x8CXAVldiMKqhKPdtawSY9X+kU00p6iwwQUAJ3vf5Yq0C HFFcloUC5HGuj2kW/63qYcsY71uqd0YedYf/WZdygIWadTN0PyYPb1gHHfqc+MdWR+ Q6wZJShLB4pRA== Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC7C963319 for ; Fri, 15 Jul 2022 21:14:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="njm4WjH+"; dkim-atps=neutral Received: by mail-pg1-x52c.google.com with SMTP id bf13so5201548pgb.11 for ; Fri, 15 Jul 2022 12:14:20 -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=tOMvEb8+jW2LNCQnAUQ+tjZmiR2dUmv6UZKwe1iyfwE=; b=njm4WjH+1frFSZXo4jc5pZHzoMEdd5xt7dLBIDvroLLHkmDX2GXhdMG9+6ociM2Tld iKJbK/XpP4j9K+JmRngiMWiRJu57BuN5dAK52tVrSYiufWgYWJHSFi/4gfjANwQQ/HoT Tpa+lt7adnetcvWafeZshnVK3AsVcXGTjdDyEF0s73498zdqOkb21fGTfKUS+UloxaIi osey5egFv3A668U80HZ2Hz5uH3UusGOORfDkhng0LQpYaM3ZlqZpgk2/5kbgE4o1y6ae tedYl80jsNcMQoj7JzSRYs9vGZ+4JIUfDsQ8M92BiHJxN9roh5DyueTj5bnm3c7mzSCn uPEw== 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=tOMvEb8+jW2LNCQnAUQ+tjZmiR2dUmv6UZKwe1iyfwE=; b=DcHL/vvB3CLx+SDWjZ9LoTTrcBZadZYUNSnKvzS5TnQMCeQknttQZMrgkMRIlKUZtj pRPuQyHHBwSQ5fmTIGRczsf8/Uk1qk6zz75DiL8+QD/HrfHFW4AUoj+KAxBePPwEXsA5 fXVoyw4IP7q8HQI5ZSS9el7Qc9zcVZmgOpukd5lk90UPOegUJh4cGR37p4d5sKlUMAQ0 OSsMDf0pns4KNGGqa3Ru2/lAvhKn8PlSY6e+D2nVBvdad2zQKlk45m+bPSLHX/avxc4Q aaeyn/ZmfQweCFB04qYFOU4Bi3E6QQixnHpYVHfN/w7Krc1mgSRHbaNPMXQ+cWOFPAtg bTzA== X-Gm-Message-State: AJIora/ljn504YKGI0dtVn3canuoMKnKMmMcHfLiMiRtvSNoN+1ErDMw YJ3NCa+dxnckn9ywBYFtoinE7SAsXQro7Q== X-Google-Smtp-Source: AGRyM1tSY01Rdk/FbplsAMGPR1zaiXM8whTLz47at5aWlWQVaAxmoGdP0WmT/nPFkm6/rodzD4p97A== X-Received: by 2002:a63:ea55:0:b0:412:290c:9694 with SMTP id l21-20020a63ea55000000b00412290c9694mr13681723pgk.39.1657912459060; Fri, 15 Jul 2022 12:14:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:18 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:57 +0800 Message-Id: <20220715191400.890976-9-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 08/11] qcam: ControlsTab: Allow widget to resizeable 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" In QScrollArea by default the widgets are not resizeable. This means when the user extends the QDialog the widgets don't resize to fill the space. Allow them to be resizeable. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/controls_tab.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp index 496b5d3b..98962f3c 100644 --- a/src/qcam/settings/controls_tab.cpp +++ b/src/qcam/settings/controls_tab.cpp @@ -45,6 +45,7 @@ ControlsTab::ControlsTab(std::shared_ptr camera_, /* Set widget and policies for the scrollarea */ setWidget(containerWidget); + setWidgetResizable(true); } /* ----------------------------------------------------------------------------- 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(); From patchwork Fri Jul 15 19:13:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16665 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 0E1D9BE173 for ; Fri, 15 Jul 2022 19:14:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B1E9463316; Fri, 15 Jul 2022 21:14:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912466; bh=M/bGKICe+abowWk3enf/2u14NjFcx2yU0xmzMayWrY0=; 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=toEPvn2Y2+5rP1MOHWqkrP/LWFplwbYgUwMSG/qeE26Jed0flDeoIrfxyMqHe7rdg 33TiCT0o+Vycg0DUvA6S7i+MGFJf48oZZen31RlchYOgj1pNURxjw0lIxV8BzYYd6U KbNp5TE8M6cEjhjfhIKpU370fZL1+WsC0QPAqdHlN+q2wRnLE5ZE4zxAMt5xwOEWQI sgu+MgVCyWqX2DRTv4j36QXvGbDXmA7jAqG5Zr8xpcPLsZYEu12C3szDVjmYXF5YVD wBGWAMIx9PRKCiRaBrCFUMsTkZ+46oTh9X/rS9L3CCaxeobBycBTcJpyRXmT0cDMbd iLUpTlehTcFtQ== Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A4DB46331B 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="pmE4IXLF"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id o15so6466540pjh.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=h3ZqblOF9y1/2pt7SDzz4eO84BlwOPFX1e1bby5aPGw=; b=pmE4IXLF5sRND4BjxT5oqXIZb1+Eb6FpwUTgvSUaoYANXTgIbYAgHwAIErQLsDDLpe qPi9YS4CeHU7ntVtgckW2HUGQRo7sbIeUSCxA2i8uNwYpZfg0rXLIjHzQ3QrBIF5S+ug ceAvFrZXiF6fBPER/umlPyMZ5djj3Xc/899tD7Xa6C5HaZp9ad4/8h8CsSySEbOJu5a8 cC2fG/8147/KikmsGI61wlpLvV2atSKLwS3L2TLSwqS3xVO6oUHC7tRJU7zqL/mC4ZqM TiN2ZgT3J4L9kHJX7B4njFnjozjR870Ytp/TX6oKLzr/dTyy5JQkBAXOVTvibIrNAUXB 9BHw== 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=h3ZqblOF9y1/2pt7SDzz4eO84BlwOPFX1e1bby5aPGw=; b=x6paNRmYoWtT0IYdWXmNV2KAekHAamtu40TpgBcMizXukOPMYNf++ZHtTR7aos7bny ifxKJ1IL2HbrlNg+isBdmHNo1/GdRREFPxy6yHh17Rzgyky+u8dvP/zesg13xdQ6EQP3 EiRp2MWKbzX8LElj7lXMh/a7F3P4kumVGYgw2rIgR0tNenybk9B6b9GtjgmgeqtagTRW vJMWmNl0Z7uqo3nmFSXLZ7TFgW2vBbQXHHjslGY650lrsMz3Vl/+K78gVqp1Mz8aZcoQ PeRqdEraeuzYrW+ExFrMPLoqMb4OyPpToHKZ9ygN1ApaagtP9ojhqWDqdtEuaPFXI90f IqFQ== X-Gm-Message-State: AJIora+g0zm/wY+C9RsViUyH76S3xIimaFmgHkgLbL9kkEmxOijs+kiO wi1IM1o/VuZA3GKWMnkcKtUYdf9A65Pwjw== X-Google-Smtp-Source: AGRyM1ueWhsBaD8haQW6xuvTmLmaEiaXu41tEqdvLi34xkJXMgG5ZpZRZRO0MM519asqpMGXnz4bag== X-Received: by 2002:a17:90b:3008:b0:1ef:86a3:3699 with SMTP id hg8-20020a17090b300800b001ef86a33699mr23900996pjb.240.1657912462072; Fri, 15 Jul 2022 12:14:22 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:21 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:13:59 +0800 Message-Id: <20220715191400.890976-11-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 10/11] qcam: ControlFrame: Add GUI way to interact with ControlTypeIntger32 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 an integer slider for ControlTypeIntger32 control types. The default value on the slider is the default value for the control and it may not be the current value for the control. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/control_frame.cpp | 16 ++++++++++++++++ src/qcam/settings/control_frame.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 10dcd05a..5a3258d6 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -94,6 +94,19 @@ QWidget *ControlFrame::controlInteraction(QWidget *parent) SliderLayout *fSliderLayout = new SliderLayout(floatSlider_, this); return fSliderLayout; } + case ControlTypeInteger32: { + intSlider_ = new Slider(this); + intSlider_->setRange(controlInfo_.min().get(), + controlInfo_.max().get()); + intSlider_->setValue(controlInfo_.def().get()); + intSlider_->setOrientation(Qt::Orientation::Horizontal); + + connect(intSlider_, &Slider::valueChanged, + this, &ControlFrame::notifyControlChange); + + SliderLayout *iSliderLayout = new SliderLayout(intSlider_, this); + return iSliderLayout; + } default: return (new QLabel("Currently Unavailable")); } @@ -163,6 +176,9 @@ void ControlFrame::notifyControlChange() case ControlTypeFloat: controlValue.set(floatSlider_->value()); break; + case ControlTypeInteger32: + controlValue.set(intSlider_->value()); + break; default: /* Nothing to emit so return */ return; diff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h index e9e256aa..205bb96b 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -47,6 +47,7 @@ private: QCheckBox *controlCheckBox_; QLabel *currentValue_; FloatSlider *floatSlider_; + Slider *intSlider_; /* Helper Hunctions */ QString getDefaultValueQStr(); From patchwork Fri Jul 15 19:14:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16666 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 94E26BE173 for ; Fri, 15 Jul 2022 19:14:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4D48C63328; Fri, 15 Jul 2022 21:14:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657912468; bh=/JCMD0mwYyA2QECknrNwTcd4lGH7281d5bwgsp2FC9g=; 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=D9SW6qEAsDw7XxJ1BU6b7n9xM+L3GrwdQsAJL/4ZZLNUVWqmYF6IiOzxXzKFzgKHp l+MqpEpLgyqH/x5dOgd1OvaoCxaMxmTXykjw9THQCXegHIagUpV0rjp+EC6E1t+6Bg A/DiPebSJ2rsCmT4kqilIdD3Yit60sg6UNHaQoPbGglfplL96UPS+Zafv9wQ9neA2/ rWZ8a2N469J3EPvhYTj7oo1rNgu7sDEMLby2oBRAlTTiaZE3FiwBH5T4memMmuck4X x3rHGVrHs0lZ+XD6j3LBNh4P4tRxw2mesvGkuFNmpxFqR6zZTpG7VdvMqaRNCdA6Rh 4kTxYB07E5Dew== Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 13C5363324 for ; Fri, 15 Jul 2022 21:14:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IZopM592"; dkim-atps=neutral Received: by mail-pg1-x535.google.com with SMTP id 23so5209940pgc.8 for ; Fri, 15 Jul 2022 12:14:25 -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=IGJijfawr5Y5FiaVYzXJ8nbkbwI0CYU0bLaNr1QCpOM=; b=IZopM592l8SPUQUkc1ENJ+O7bMKdJTMX+IRbjpB5H/oxeJMt4HNs7lU9mkPV2xWqzR TDIAbdkRZ3ruECszg7HzyHWwTH6nlUvfcS9WY77T2FgdiilBdqzh/OaBJ1Qo7apnf+SK sTQ1pBFT5xhvSZ3Ejz19KXJAQcWPsUvG+e2afpGjOT2EtrEtJVXg+QkWOOBmucE7WLUK B/Km9udD3BsRgzQKBBoGZxy0alDLvsFo/rWJuU8doN9HdNieqYdEqhjs4Ar3Vh2IYwSS DrJOeLOknYw6CpfZvx76K5azPWuuzuSM+OAve0+nNvFGtjQFBeQrr/dZTEs9k1cJS9DO dMKg== 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=IGJijfawr5Y5FiaVYzXJ8nbkbwI0CYU0bLaNr1QCpOM=; b=Fye/zPN2AjcT9ufEgl0mTPPenHJyss768Ie4c/hMj14R61BkafBr9WUW1UK7Ix/ldK F+67KJw6gXiN6JLmFL4OW5oxo1VYSqhtVeR4ruHZrCi1KtQ9sZMp/tFTvMruVG2AJ2kW Pg/xJzFoLX/3D2tBnel3Niqa2pV4aIg5i42WArYzWLOeVbL0C5DHuOvq3+Bdm9uyOvTL /4TWKh2lroC6dxoBEnNVV/aJxCu9bG3NtR88R3RuodDCc75vrn3a/hSzqKMFn8+6q+MT CmP410m7AANEOvIn0n8wQ/BakBrxCQPNEIfdSN0JlBL+Yai76qq/AgtxtvhFJMi6G2Rp HsMg== X-Gm-Message-State: AJIora8x0WqqzfMPz5pi+aPiuqphGkmOhcVQmf2jDsUh8/iKaXXBFGr0 OuxmWUD7CFudQ7Y3X0adl4P/J0i3dv1Giw== X-Google-Smtp-Source: AGRyM1sffzI3A8eWI4U/FhidUYbD1zS3wQX8OFb8ms+6uaGBu9L4wHmW1X3yVvS276INaQuPezbv+Q== X-Received: by 2002:a05:6a00:238c:b0:52a:dcad:7847 with SMTP id f12-20020a056a00238c00b0052adcad7847mr15680279pfc.8.1657912463495; Fri, 15 Jul 2022 12:14:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 12:14:23 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sat, 16 Jul 2022 03:14:00 +0800 Message-Id: <20220715191400.890976-12-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 11/11] qcam: ControlFrame: Implement Current Values for integer types 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" Display the Current values for ControlTypeInteger32 and ControlTypeInteger64. Signed-off-by: Utkarsh Tiwari --- src/qcam/settings/control_frame.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 5a3258d6..928807b8 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -145,6 +145,12 @@ void ControlFrame::setCurrentValue(const libcamera::ControlValue controlValue) case ControlTypeFloat: currentValue_->setText(QString::number(controlValue.get())); break; + case ControlTypeInteger32: + currentValue_->setText(QString::number(controlValue.get())); + break; + case ControlTypeInteger64: + currentValue_->setText(QString::number(controlValue.get())); + break; default: break; }