From patchwork Fri Aug 12 12:46:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17097 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 01179BE173 for ; Fri, 12 Aug 2022 12:47:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC1726332E; Fri, 12 Aug 2022 14:47:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308427; bh=Sh+PbJ25NGs5XtqHcyTP5/e6EJXtbdiJeMXGsUegKo8=; 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=LyUTI1481ONyMmu4NmhEEBHGg9IaMQq2v6FZTpnxc1+TFY/lr8lCf+MtZA9m9CAfT AhmFX5nntFy2PvjPBCeOB3LHQAZ4Xl4Td7Cqk8UwbCvwd4hYx3d+m1EgAg9vXW7iqy QY/mBshDGzV7fRLW89ZrGYF3wn2Ml2QZDutUGVYFErxEUfzJ9A6I3tc+veGsR87Rmz bad2UZguO3lfB4bBinsNJKCF199gx2XMdj4P5XKT64VZgKD61HvTdUUcneUs+ynPK1 ytJbJbf9b9F2vob7h9C8VcdGpHYvJV4vwc8B2qoxA8Kb8h/BUgsKrdg5tUv1x6WfP+ NnvQPJ5a9hW1w== Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3DDF461FAB for ; Fri, 12 Aug 2022 14:47:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Bm7+LoY9"; dkim-atps=neutral Received: by mail-pf1-x435.google.com with SMTP id p125so875940pfp.2 for ; Fri, 12 Aug 2022 05:47:06 -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=eeJ4uOdVqbzxkSFHFCXGMxTFRLSE3n1n+dHzSj9VE/E=; b=Bm7+LoY9c1lUNU/1vkojGV0aUrgRnwJnriny5NEuE4mgaXuTrW2S+5wNv5+v4kOOK9 jPcP8HMHFTXMZT73ZpugyeguQReZm7bcEpnabT7HqwVemrg+bvxJkADR8Pdlxjvn7FaW 6wbgN+PDJzwFKa0H/shUTck8FbuBmrcIUYVvpZGP4EplIEJd2W4I37iDMwhT5PAVVBtg ddjo/w4kiErzJxpsahLxDqn9QUud2mVvIrKb7yLp1B7ekQA28aKdaV6iZOVFGJDi468d jhJe9lfnEpkzOujyqAhLuopG8LIe/1MnegKbsCFpX80xv0GS5a384QFQCEgXFt9Z6Aus s08A== 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=eeJ4uOdVqbzxkSFHFCXGMxTFRLSE3n1n+dHzSj9VE/E=; b=UqHKj1r+K6IAFz2X3sDhLhs0+ub74U45gqoU0Rb9DVPn2H5aF0Sh8TqfUrhVC+xWuM 0EP7J3S8CjivsaX8LLranTtzHEME5cKyiyvriStaJLnHoyxa5LcTPmkq/Gzs1os92RTz MQ1SXvdPfNnWymPZNezBiTBfrycpHRENGshwfluwcwuDwv1NvAMEpU8k74APwcVQL4q+ tioReBl1mS2JdwdnOdr2bR3+R7dHWA9tEaB7f5X3fqnANEOmZBKW2BgFipI5a1HG0CwW wPds3Z6XrcAQgze5ifHi66BoeprzYre4KgXO4MQUXloYB/BcPOItt3u9iUAC3Nud1UZ9 avbQ== X-Gm-Message-State: ACgBeo0ab2ZXdT63lYK6qU7ghhNkBLiKkQOveGz2PmL+3L8XhUCcMny2 2B5OSmP2q1jt7HHdNhmzn9iAX3Iqjuo= X-Google-Smtp-Source: AA6agR58QvAdVytHfSsb79qeBK8yWxTdX04YMSM0V0xj/oEVSJPxBIxVHhVNM1j/ituuZkAlV1k17g== X-Received: by 2002:a63:4d1a:0:b0:41b:d319:d8ad with SMTP id a26-20020a634d1a000000b0041bd319d8admr2959828pgb.613.1660308424431; Fri, 12 Aug 2022 05:47:04 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:04 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:41 +0530 Message-Id: <20220812124651.27496-2-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 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. We check its existence with QPointer. 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 --- Difference from v1: 1. Settings dialog now primarily uses QIcon::fromTheme("preferences-system") 2. using namespace libcamera; added in ControlFrame src/qcam/assets/feathericons/feathericons.qrc | 1 + src/qcam/main_window.cpp | 17 ++++++++ src/qcam/main_window.h | 5 +++ src/qcam/meson.build | 5 +++ src/qcam/settings/control_frame.cpp | 28 +++++++++++++ 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, 183 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 c5302040..3078c26f 100644 --- a/src/qcam/assets/feathericons/feathericons.qrc +++ b/src/qcam/assets/feathericons/feathericons.qrc @@ -5,6 +5,7 @@ camera-off.svg play-circle.svg save.svg + settings.svg stop-circle.svg x-circle.svg diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index ce70cc02..7861c34b 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -239,6 +239,12 @@ int MainWindow::createToolbars() saveRaw_ = action; #endif + /* Settings Dialog open action */ + action = toolbar_->addAction(QIcon::fromTheme("preferences-system", + QIcon(":settings.svg")), + "Open Settings Window"); + connect(action, &QAction::triggered, this, &MainWindow::openSettingsDialog); + return 0; } @@ -262,6 +268,17 @@ void MainWindow::updateTitle() setWindowTitle(title_ + " : " + QString::number(fps, 'f', 2) + " fps"); } +void MainWindow::openSettingsDialog() +{ + if (settingsDialog_) { + settingsDialog_->show(); + return; + } + + settingsDialog_ = new SettingsDialog(camera_, this); + settingsDialog_->show(); +} + /* ----------------------------------------------------------------------------- * Camera Selection */ diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index c7cba5e9..856a71b1 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -23,12 +23,14 @@ #include #include #include +#include #include #include #include #include "../cam/capture_script.h" #include "../cam/stream_options.h" +#include "settings/settings_dialog.h" #include "cam_select_dialog.h" #include "viewfinder.h" @@ -94,6 +96,8 @@ private: void loadCaptureScript(); void stopCaptureScript(); + void openSettingsDialog(); + /* UI elements */ QToolBar *toolbar_; QAction *startStopAction_; @@ -108,6 +112,7 @@ private: QTimer titleTimer_; CameraSelectorDialog *cameraSelectorDialog_; + QPointer settingsDialog_; /* Options */ const OptionsParser::Options &options_; diff --git a/src/qcam/meson.build b/src/qcam/meson.build index 70a18d7e..7a785fd0 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -24,12 +24,17 @@ 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([ 'cam_select_dialog.h', '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..8b1162db --- /dev/null +++ b/src/qcam/settings/control_frame.cpp @@ -0,0 +1,28 @@ +/* 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 + +using namespace libcamera; + +ControlFrame::ControlFrame(const 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 Aug 12 12:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17098 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 71B1CBE173 for ; Fri, 12 Aug 2022 12:47:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2C75061FAB; Fri, 12 Aug 2022 14:47:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308430; bh=PBNtZh/GBCMXZFNxvU/c9S6wR55Oyh3d5ac/jw5ZbN4=; 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=4ZgAV29+5abmpsFjA1NvbLsOOrOUTizaQFNmuyExHsRuC2Kuj5dV1JjypFeZha2T7 gzgnqMzxGfn+iWrqCMTmdZyzOAUr+LdactAT9gHxbQhLFFCNi5kNTn8hv42W7LtXui g+TaHYNmWHo/kRLv45+GTvs8iU50bwBWHmX1yFC+2YUjXB296o+9UdwpkhPTpTJyZc 4ry3DlGMrquHLr25IQV7ZjubQ4FVblh1LTVBPKhez3QGiMG6tfoDd4IlZ6q43ihd3N AUBaGrcjAU7AwTfNf9Z/b245RSRi0+eeMINEhWKiKJIUb3qPLJo/enM+zBjqq1qNQC 1vNKZGX2pDTdA== Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 39F9B603EA for ; Fri, 12 Aug 2022 14:47:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="C//4Of9B"; dkim-atps=neutral Received: by mail-pf1-x429.google.com with SMTP id h28so850203pfq.11 for ; Fri, 12 Aug 2022 05:47:08 -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=ghblknVhGijt/nmW4rVKt6Xyc1ourgY6xruFoCTihac=; b=C//4Of9BNxWEhvbgQaRSpOISVthlOUDG+Wm3J8AZk8AsfSZZlT1+YHVmvLfLsAkL/p K6la3IMHI8YwwWI6mW9jvwZ41pILa4OhyeZFZf3zT5xsahSGG+Y7kugSEhhhMeH5xpAN psJEjsJpHuXboaCzn5P4vM/Rnls2t0zxRpM7ZEBDXqRWaQhG4QauxRe/+x0OKF8XUecT ILikiRMKxzg72Zlrj2hPHwod4Jdye3eFLFLiLRyFRgiY7ZZ5NtCZtzO+1v7OO/WyQlyU IRpF7EU/VKm5BcWAHrr2GFnjuFl07na30fIrhOIvZEm6Xftm4/R0nKz3O6lm+jGCbRPS el0Q== 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=ghblknVhGijt/nmW4rVKt6Xyc1ourgY6xruFoCTihac=; b=Wrt6kAXt4gfwA+cxNW0GZeUsOSCklkXZxf9m958/O1Y1oUdjakbCleDr32UUwuAgge VyfQs7gf5V55nfpzeAnVbYXIgjm/uxoIfUL2F9wwpzj1+VNzmDZ16Edgl18RAcw1yqae ObROnGeY4l98Pj4rQ5dLu74bwyMyavYxRqXjx1I7OelCVn0URRHQNPg226cYrBVVvyHW uwtdpsrHZ2Hy4sIkpituH4tORZ5+GLPWQmyw4bNnYumgwbD4GvCFtvJ9FiCY3E5uwOQI Gydsf2PpU8AAU8sG0gHHS/TXV+lwX8nmYq9rcnMWtX8CwCnE3oGft1W5l1A0VhLx9Hce 90ng== X-Gm-Message-State: ACgBeo2U2EyQvQAFjUF6gexJv3niwyLbU8grVgXT61D9Acrr92XB0ipQ O8m/zf7CCUTg8KUQ4yEl4nlWo8eObh8= X-Google-Smtp-Source: AA6agR40EPJkbX2Phwc1hCLO/0kuzY0HOKXnSUA5XOrNwU1FFg3qAjMX0yG/1fnwXhmoZDOjLBdCnw== X-Received: by 2002:a63:14c:0:b0:41d:c975:1ed6 with SMTP id 73-20020a63014c000000b0041dc9751ed6mr3032099pgb.39.1660308426473; Fri, 12 Aug 2022 05:47:06 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:06 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:42 +0530 Message-Id: <20220812124651.27496-3-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 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 --- Difference from v1: 1. Fix comment styling 2. Now parameters can drop libcamera:: as effect from 1/11 src/qcam/settings/control_frame.cpp | 48 +++++++++++++++++++++++++++-- src/qcam/settings/control_frame.h | 9 ++++++ src/qcam/settings/controls_tab.cpp | 2 +- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 8b1162db..79cf67eb 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -16,13 +16,57 @@ using namespace libcamera; -ControlFrame::ControlFrame(const ControlId *control, QWidget *parent) - : QFrame(parent), control_(control) +ControlFrame::ControlFrame(const ControlId *control, + const 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..280f07e0 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -10,6 +10,7 @@ #include #include +#include #include class ControlFrame : public QFrame @@ -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 Aug 12 12:46:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17099 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 DDA1DBE173 for ; Fri, 12 Aug 2022 12:47:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B3A663334; Fri, 12 Aug 2022 14:47:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308432; bh=naxmq4pAh7h/eoNWdQ3P0xc3xcUhSSB+XP1uNsOQW+A=; 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=MXAQKDWF5rFOtxQycOfwClgyCZ2wGQToF7oA8eDk3mG+w4l/TLI1C2v4E9S+ba6Wz 2on4wivTZfy0FCObe8p90MNea5C+UKdlcRYtVLukhFV5TqOQUepYBnNdTutn5QAAnp 65/GwXSd9Ovgbpxw/dv/rzSv0mqju039IAyC92Mb3wQM5jZF8wRSDCnNf5yzkaFNA9 gGBfOISk9xBeOeT1Pvk+FPKk7f1LBC9qmrD1HySh7fe4tDBHaMPkoqtpO1od178J2+ FYsZgTyPv1uLDLyy7dDQqV8QmgY3ENk2B0ticR7+mUW+eWYTSp0nufM0dxIpwxrexH kE3xzPtc8+1bw== 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 83CAB63328 for ; Fri, 12 Aug 2022 14:47:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pOA0+LdR"; dkim-atps=neutral Received: by mail-pg1-x535.google.com with SMTP id 12so720158pga.1 for ; Fri, 12 Aug 2022 05:47:10 -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=x7UaddQYAA5WjaMHvFJtpiORxx5fo0lFeM0wW38ro28=; b=pOA0+LdROBGPYHLgAHXZUj6gk8/IuDmkwZg7UuH5NVtY0JBlooGLGV+lpGiV1aniRH w5fpAw299Y0UxLktrwSFzyKHVG07fgTgsDuH1gJZOP5oZ7ryES7wS/W5FcBXaIV7WyEa i1w8lP6ZODXQE0GosyrwtVRAPyfK1Fe7SbQ3FsZIWyZbBgGHsT/K+7ApJvZf/c38IH3b 6Ck7ioZbsUIyfaN+3gCYuX2yNcaXlUcuAa6ClZorC9JLyrLpl3Y9aXVmSJ4BF7gEQXsi SCd05KNx/Na3UC8YblQqHUprTztbTk3c4BuB9Wvm1GsBUtEqgTPR/5OO0v9UvDYIYzD/ RKDQ== 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=x7UaddQYAA5WjaMHvFJtpiORxx5fo0lFeM0wW38ro28=; b=k5me8ZxziIsRZgzfW5lM35KRhI7CdGgdjcauignnWWCoBcmBQgDtEZlKKsv/HjLKW9 3WtmhxltbT7b/x7C8Yg1E+9swo1kNbO1toDtI4ENbRO8b4K88t7V2hXjA1aFOl7Rvfaq BA5EjALtCBd+1N5P8ZcAl+zYRCpoXlLvK6xBtB6H0sg76T+UmccnGGW0mOwb+wxWTSQ5 zj1TaJMy1cYeOvv+R/IL7K/bRXIth9Lzeu2Nf/2401UljVxIZ3VdwqIpkTPWBlz3oiXl TJBHqT2Z52GlAFLUgstc0Tff8/pjyU18oiTQpbohjgn+KlfMwXaABmYFQpp+ynMD5jbK MzIw== X-Gm-Message-State: ACgBeo2aYPf4dcWywaimHKD+PvfzIb39Aw0T6SAMNRGsmr8f61M6+IKg Fdvhf+UFLbY0LdSlDjzkNzXkFTUENBI= X-Google-Smtp-Source: AA6agR77vjzNilKlD0qLIUc7/cUoNd0now+5LKy6aHVu1a5mWswxkRRQUpiRuolRdBc4AJekC26zsw== X-Received: by 2002:a05:6a00:1705:b0:52f:6028:5c33 with SMTP id h5-20020a056a00170500b0052f60285c33mr3789379pfc.29.1660308428646; Fri, 12 Aug 2022 05:47:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:08 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:43 +0530 Message-Id: <20220812124651.27496-4-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 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 --- Difference from v1: 1. Now using infromScriptRest() to change the script button state. src/qcam/main_window.cpp | 40 +++++++++++++++-- src/qcam/main_window.h | 3 ++ src/qcam/settings/control_frame.cpp | 70 +++++++++++++++++++++++++++++ src/qcam/settings/control_frame.h | 11 +++++ src/qcam/settings/controls_tab.cpp | 19 +++++++- src/qcam/settings/controls_tab.h | 10 +++++ src/qcam/settings/settings_dialog.h | 5 +++ 7 files changed, 154 insertions(+), 4 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 7861c34b..87cdad82 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -101,7 +101,7 @@ private: MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) : saveRaw_(nullptr), cameraSelectorDialog_(nullptr), options_(options), cm_(cm), allocator_(nullptr), isCapturing_(false), captureRaw_(false), - firstCameraSelect_(true) + firstCameraSelect_(true), controlList_(ControlList()) { int ret; @@ -276,6 +276,8 @@ void MainWindow::openSettingsDialog() } settingsDialog_ = new SettingsDialog(camera_, this); + connect(settingsDialog_, &SettingsDialog::controlListChanged, + this, &MainWindow::controlListLatch); settingsDialog_->show(); } @@ -863,10 +865,42 @@ 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_) { + script_.reset(); + cameraSelectorDialog_->informScriptReset(); + } + + return; + } + + if (script_) + controlList_ = script_->frameControls(queueCount_); +} diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 856a71b1..8137e736 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -75,6 +75,8 @@ private Q_SLOTS: void renderComplete(libcamera::FrameBuffer *buffer); + void controlListLatch(std::shared_ptr controlList); + private: int createToolbars(); @@ -145,4 +147,5 @@ private: std::vector> requests_; std::unique_ptr script_; std::string scriptPath_; + libcamera::ControlList controlList_; }; diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 79cf67eb..273ce79b 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 @@ -30,6 +32,7 @@ ControlFrame::ControlFrame(const ControlId *control, * ownership to its parent widget. */ frameVLayout->addWidget(defaultValueLabel()); + frameVLayout->addWidget(controlInteraction()); setFrameStyle(QFrame::StyledPanel); } @@ -47,6 +50,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 280f07e0..61005ea5 100644 --- a/src/qcam/settings/control_frame.h +++ b/src/qcam/settings/control_frame.h @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -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 Aug 12 12:46:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17100 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 73393BE173 for ; Fri, 12 Aug 2022 12:47:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 29FA86332C; Fri, 12 Aug 2022 14:47:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308434; 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=oVQo44/ZPjtX0RHG4C+T19FMelzhp7x80xUW4N8OBEAJDjB29Q7GDzD8NGBLfM0Hd fAHxYAIi/46hRUgjrpH2fz4Q67DFleIWvKO8/Mv2twseHMhfZmxGyS5+OO3RbNPL1k ihLPW2LGNqTpPF+pj0saNh8hLqgSHpuWczqogfH6X991AMO1jk2O85NSI9j8AJRqSq FfskvJuXEcOi3Uq46ZrRSEFsJ5nRMSNX2eofuj6R1VKQuuIl6/cTLJv8N3XZ2ZS0X8 yxfWzoaNiI+JNtOam6cOtty/g6D3tNtS8W41nENAYxL1kZ2arIygF5PiKvppuvhPbr w81ex0A0CH0jQ== 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 93FDF63328 for ; Fri, 12 Aug 2022 14:47:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lJ/DKbTP"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id ha11so921810pjb.2 for ; Fri, 12 Aug 2022 05:47:12 -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=CcoTbYUj3cSt0YMH+9NqHU45gZLE6JusliHQMFRScRI=; b=lJ/DKbTPbFjd17l3JGM6dJPQO9W613j1FcUVpzfV3uuqVVd0tb8rybCj7upu8hfGGr zZJOaYRNiaex1JHTXbA3m6xPXW80CdeK294cjhfLaZ4bVE8EE6wh3/aoyUr/vY+1TSk9 tw9ujrXXkTI9QDcdDJL41TSYrlbyTShlkUSUe17g6vHO03CamGMvJbHhmqqsCzEf1wSx 6PM5+/Su1t/2HOfTn2wWpJh3PhMPZe745Sm0SMUmiuwGCgP5F7UzIzCj6v6Fqxa5BzF/ bq9mmY0F2kQ2FMM2kjzm/DH0kj3zPeKY5TabTIhlHmGcU25YULL7yoCrvwuHNfMoM0k7 Zkuw== 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=CcoTbYUj3cSt0YMH+9NqHU45gZLE6JusliHQMFRScRI=; b=1zXgsPAYiCnxFRwUhgT07IHEqHSn2KIDAyLH8DCHcDeUSaJ+x5hfIlp75l1vw20B9P Oxjhdf6uSU36oiT0pxTWvnCo/qkVYRIueRNseWJR49Nlkdwaqxu96WYp4gIgIkS//KEA M1WyQ8Ok6gp4IVg6rYU4LXUVIDAJqkLb8ZYmuA7D5fTDUPhXPREOIggd9HFz0GhK+ozD R7vmy1l6E80vikYvYPinkVa3EHwIyCO4JBnETfzqD7MY4Z8X/Um9CRqpb1ibnERgA+vC OwHe8mGhCIkflAZ74rgtVANANfXgnO0hoqDZgQXK2YAYqaDb/kjNUdUvYJ1Rr0pQULKn I4wA== X-Gm-Message-State: ACgBeo2SKo3sRU1X0P2+7erLB2sFEECIRIQIkpHN1rpOwMDYx24nMItm OCqHesH1rWOJQdFnJ7DKUtn7FtHPx/Q= X-Google-Smtp-Source: AA6agR525tLOb329TyGMh1K2yBfZ8CJKc4XTKUmn3+msOTkr2walvgcpWrc+rKRd4aeL53OhfvMrAg== X-Received: by 2002:a17:90a:1912:b0:1f7:8c6c:4fde with SMTP id 18-20020a17090a191200b001f78c6c4fdemr4067484pjg.8.1660308430794; Fri, 12 Aug 2022 05:47:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:10 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:44 +0530 Message-Id: <20220812124651.27496-5-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 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 Aug 12 12:46:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17101 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 02A3BBE173 for ; Fri, 12 Aug 2022 12:47:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C243563339; Fri, 12 Aug 2022 14:47:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308436; bh=EZyEcQ7PKeKc2DfvktgRpWMlok6oAGxXGjUsMD/mOH4=; 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=bNghF/TAY6ikWBjdYRPCzI1yMp2szceyrnSm+o3YJqmSqYfiyQIxkvfpmXPvteSDQ iwpSZciI5zoYMISX/Qv53nEkM2FTsuy+btZEKxHfYIoOdfODq1cBQPVJ4jZL8a+42r P27NyNiQtjof7Kp1u+buX4rFi2TjbZGLrdLCDC+roUD8SpTcb1g895NZsV/x3fLBJK k+6hSCLdxOLImjEFZLgvpkfJDBI4gUEDbk+/8rBhyqqVLNcK79nJKrMHi9goCZ3KAL grJqfELK76mWqt9jfs1Nz8MQpnFYcdL8qTkjFbwSeTnyKoo8I4iyLpZCy0J99isTNv m0B4NQjczWvew== 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 8BD4763339 for ; Fri, 12 Aug 2022 14:47:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AC8dmI6e"; dkim-atps=neutral Received: by mail-pj1-x1029.google.com with SMTP id d65-20020a17090a6f4700b001f303a97b14so827913pjk.1 for ; Fri, 12 Aug 2022 05:47:14 -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=X9GlEOeBAytrLDIMS7fbF23OZRtclahma2t8K369wZo=; b=AC8dmI6enb0rmyTCO2kn8Ioxl8aKL5k4/QbcdfiNQ+XGUH6UdIEgqIi6xQaS++X3M3 GxmKBAsOT3CV1x9+O3eBQC1fDI2uPo986biP63LOAtauTcfgb9XL8ywqjd8ozCXQGBxm 1/st+T/VHqPWpj2KyNY98V0ftPpxv9h5+NjqIw6CY8b4izXttRx8q9KP7t/1hbRvESD3 Y2u4Cpl5esgxSFzZEbX2nYgXtby9XJT8TRkckeB1VGT6gUIS1KbdILiMQqRAZPBz7UzZ +aHDvIF/WWLexLWjJKa3/M29ectOgOBXY26UGq7iTYv8DoKv1eFhJNlly+7C8c6CpoeI RGLQ== 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=X9GlEOeBAytrLDIMS7fbF23OZRtclahma2t8K369wZo=; b=O78gnesJwE6Te1jvcVXWwAFy0E3Pwfl8uZVePSTSt172jM8NZXD1p+EINsM1yTnt0O m1xlXGl+yZdlFBGL8JwbrrIkfTxZJ9J0FHHjzUHqdrD+zQGbYfFSE2uqvNSgo+yxaEZ0 BDHg4+9YydfZnnCh0nY+8P5F6tC3XdlqjlhKAzsMmM7/hHsRRWQZGZT8fQREww69NOJB AhluqlhV/KuCt7Nhxj4nEE3XBv0TR1XQEtt/bZT0UfBweisgxt0r+nqRI1+mg5mXtUNn p1M64upHivQR+MI02TwcHuqv8zKKv5pxxLFbZo23zaNe2vOJ8WV7hruAaUD73AKzjo4p /GbA== X-Gm-Message-State: ACgBeo17/Y0g9XxmkY2wz5Ab3LdJHiTQblS9MdLqDLnisBYXtxCwbtEv txQXvzMiMxKeVY3qKPfF1ftJ7y1VYZ0= X-Google-Smtp-Source: AA6agR5TO1pxnD4HDV+xgR5t6q5vkkTg+w0zt29LUJPnkIV97skdrWD1+61aDzkQbSX1N9XJFdpoAw== X-Received: by 2002:a17:90b:4a07:b0:1f5:1aff:4af with SMTP id kk7-20020a17090b4a0700b001f51aff04afmr3980374pjb.124.1660308432787; Fri, 12 Aug 2022 05:47:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:12 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:45 +0530 Message-Id: <20220812124651.27496-6-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 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 87cdad82..4ee3a013 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -278,6 +278,8 @@ void MainWindow::openSettingsDialog() settingsDialog_ = new SettingsDialog(camera_, this); connect(settingsDialog_, &SettingsDialog::controlListChanged, this, &MainWindow::controlListLatch); + connect(this, &MainWindow::processControls, + settingsDialog_, &SettingsDialog::processControls); settingsDialog_->show(); } @@ -795,6 +797,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 8137e736..8615d22c 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -61,6 +61,9 @@ public: bool event(QEvent *e) override; +Q_SIGNALS: + void processControls(std::shared_ptr); + private Q_SLOTS: void quit(); void updateTitle(); @@ -148,4 +151,5 @@ private: std::unique_ptr script_; std::string scriptPath_; libcamera::ControlList controlList_; + std::shared_ptr controlListShared_; }; diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp index 273ce79b..2554f70d 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -32,6 +32,7 @@ ControlFrame::ControlFrame(const ControlId *control, * ownership to its parent widget. */ frameVLayout->addWidget(defaultValueLabel()); + frameVLayout->addWidget(currentValueLabel()); frameVLayout->addWidget(controlInteraction()); setFrameStyle(QFrame::StyledPanel); @@ -82,10 +83,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 Aug 12 12:46:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17102 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 8811FBE173 for ; Fri, 12 Aug 2022 12:47:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4F3DD63331; Fri, 12 Aug 2022 14:47:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308438; bh=Dg1bN0aVojFT65CgMPCx4UraJV3WkHZfYJ2upR8GNsQ=; 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=tECgrrqG0hI7r0uCpxHCYqm+qO0cwmah8jUi2sJeikcmZMl+Z5BRlpFW3s8Ek8nlj 1f3ZnZplQG6QzE2M/dlvGg+oxQT7znqMVH8wUEVTEd954zFnar8/IClF5ONLVswIZe ky0gVl6U63Jza2ypC83FOKafYNHAj9MLMfgtwvxfZgeOQ1PzdPcqt8N8Nmi8i39bEE VYqAsblm9csSOVMCWfXuGLAtEThkZO/tTChQ93v/AAkefa9VhVTVqSxJkauWnBuuBZ 0FT5nUwQ9zxvZSxGjzLvxigoSIu/NS5kGpmA7+lUFpk50H4IPH2SmyWAfPUTdgmxMc V4rlnzu4+3cLw== 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 AE7A9603EA for ; Fri, 12 Aug 2022 14:47:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R7/TEk7r"; dkim-atps=neutral Received: by mail-pg1-x52c.google.com with SMTP id r69so720830pgr.2 for ; Fri, 12 Aug 2022 05:47:16 -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=ZLojxJ7wxvVcqWW9k6jj8xlp7O+dZGH6BiHKkMD5lIQ=; b=R7/TEk7r9elpG0fQzKisv9KMAdC2pHefBM1QLbCXXABo+EjAHEcVR1Riem0N1Nvekr QR5hHcD9IkBPeNDo33c/MnSdH2mxwu6NFNn0dgYKYDzvMiGb8sWIA5059y8pIr5plMN8 65esmEPs/Q5BiwNPIB4fnpR/nKK9gQadmsCNJYHv0hBe/4vqLAoRNcxBqsfPT53o6tAj /RANi7QtO1i1iDgXhuVLAMai23mS2rpBO4vTn7edhoCiiTYkrnnQuneXMW+RrXmY724A C7foperKjUEZcVdnU26VVKqTqpRjngZBJLUNQtXJ7VetjrJmN5N/kSkDWriyxVAu1vyd RZyQ== 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=ZLojxJ7wxvVcqWW9k6jj8xlp7O+dZGH6BiHKkMD5lIQ=; b=QHEGT2+0tkjNkPz4imfQd5RrywxzVlIt4lFXBN4Td2eBaJ/INYJwLPvHq1fTRkf18J fbP1Kd4A79lZu1s8o6ZVAzCLfWM1ALuR5Kd09hrgHFKBzkKpRAI4tba1c2/Fk82/RJhg Qly0PHDxTCJ5LyrXneQNx4AJyLUZPl1X5rRsH3s6+qLW1QHDDjoUm4XB/RS4d2ekwnUK Bu+6bipGp7+GMBYcRZYSJ7o6Rja6xNqtM8NdoV5jGcpCu0fkQttj4qVrAX4RdQQMZL2/ zrK8Fmu0HVQXo4NgYIHfPPS7qPNju+jw0sbFEh8/cLYVLTzJQ/J3D8jUvb3YRFLeLBbJ pQXQ== X-Gm-Message-State: ACgBeo0aS/pI/ze4H4QvJaUPqfzX80CGnj0KGwVE+dX2OL65+PWserG0 iN+cYw5HkiRetlpdU0EbfdcRnZb+zRY= X-Google-Smtp-Source: AA6agR4/gsZjcxiJi6Y25n8d7wTjm/0hjPLIw237g3ApsZhm1zGX6bHB2J/fU0Jdr0rlT0iJzd8U6A== X-Received: by 2002:a65:6384:0:b0:41c:5f9b:881c with SMTP id h4-20020a656384000000b0041c5f9b881cmr2958208pgv.513.1660308434966; Fri, 12 Aug 2022 05:47:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:14 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:46 +0530 Message-Id: <20220812124651.27496-7-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 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 7a785fd0..b6a09c87 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -35,6 +35,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 Aug 12 12:46:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17103 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 74659BE173 for ; Fri, 12 Aug 2022 12:47:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4163C63337; Fri, 12 Aug 2022 14:47:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308440; 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=U2gvreRBQ6Y3TpofvZHoVL2AVMbNIm93sJfyyfrirxF5CpXR6469dmCaCNVCBzauo B4U8JxXYddDExmMOC5nMVYrG4jOcBlDmP1CC1JfpyDnn/XYTybhQ+/XI3epDb0zSAK LM5SBkjLZrEY77DYyJgBnvX2FnM1c/F3TYF/UX/dHmeUtsoPtZx7bHjYcn8sYr/Rro +lwwquo4scLG+GAl7D8dIP2KOWUy2zOlnFHek/shckE4+VTBz9gYAsm0thh0FrP7yF 5YVT+UHaIBDk9mifc7M2dJUoxX1r5TKXzklyKdcWx+N/3RLrAss+KgW0gojY04oyDs BUK6lenkQrkEw== Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 82B976333C for ; Fri, 12 Aug 2022 14:47:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Cy1uBZPG"; dkim-atps=neutral Received: by mail-pg1-x52e.google.com with SMTP id bh13so713459pgb.4 for ; Fri, 12 Aug 2022 05:47:18 -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=H6Q3a3MyWxu+j9oPQ0Vx1yJWr4fzvLodrhiRMAc7T4c=; b=Cy1uBZPGf7GqR7jCdBjyRsvw79AoSRWSaq3vK6udm8+PsF7euz4ia/m8GfCLyxSVzl WYdAo8YPt1oYvv6NV+ODvO7P3V/1W/Xn3rPE0Wto2hAOWytZQvBeNe6dq+CYeRIoyDaq tHKWRMRqykoyS1MHhUBgIzEmX9n1uijHT7cYfGINMUiENFfFJHQaDTQL4vref6+Q/QS3 jMBy6OIZqhu6vHGu2qAPRa/lRUZbp/D2u7zvFdYBaT/hyCDF8SojfioccTE2bELq86D7 DeB3LOWM9udupEMHTQO2SUbCAEQnZGGNn/kkVSBdIOKbKm/NIu0adVY2I8xUBlpPnur3 RxKw== 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=H6Q3a3MyWxu+j9oPQ0Vx1yJWr4fzvLodrhiRMAc7T4c=; b=BRoRrLpzowcYVfwdF6miJdkKYPs1Az/MAJqGAaieWgxcycjuifNnCB3pghwBaTRgZh i1mJV/x7VkE00xEkNfC8EKE6c3OUokYoN3jy8WIFjPJ4MK3coj48bGhjAlFNVcfKYqws QLNg3p9EangnFsfgLae+3LiufYeeYY4HmArPmzXppIYcKsQmIzMKhPF6mAyyPRAHEETC 3u3p9sVu1garRHgLmhfTfilHgdM1rXvX/XetVV5JYoJfCfFx7mFMwGh8xPghN6j+X9fa Np3nDaZ+xkAe9hjkgaRlpKlKFp179Y0f0QaJceH4h4aZc0xSczJuzs5cVzyqLMNVjFea rrEQ== X-Gm-Message-State: ACgBeo3Atr0yol/xpRbgm1AIQN2uypSfcdv18TdYDgPTLcwgfndGmY5D GwpUFs3KAm7pcZnoEAu62znncM/RRNU= X-Google-Smtp-Source: AA6agR7ca+fNGYa2rr9F2X5qwRaQ1jeN4B0Fp9R4jCD1OlCkSi3vAqkz5ve27pZn7C8ubJA349gb+w== X-Received: by 2002:a63:a4f:0:b0:41d:e435:c857 with SMTP id z15-20020a630a4f000000b0041de435c857mr2994658pgk.433.1660308436940; Fri, 12 Aug 2022 05:47:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:16 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:47 +0530 Message-Id: <20220812124651.27496-8-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 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 Aug 12 12:46:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17104 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 77941BE173 for ; Fri, 12 Aug 2022 12:47:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 340B563335; Fri, 12 Aug 2022 14:47:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308442; 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=McdYk5xD2Bz4y58rvfLH5YuoW9rhI4k3IHcvlwkmlslw1KOnL4AZn7jbja3zvibJH 5bah03vlrUhb73oNK41vgc4uZUqYO+8848mTgdrDFL5jaP5tT2mxhxn3k4SzLOmOS6 acc+hIQ01AFBMiIpnPD1Uj0N4cJjtaV/nj+D8pa5ZAGm3K24wQlaZuiZfev/APTKmw OTxVstbCXrcMP3TTktfGFytZHNDTXfJDiszKvK2Rxna8KRUJWig35lwf5aZQfxq+gT fxlfr1JgNgp5PhkiY9G1gINkuXmbboIUx68XPwLEH6J6P78+2xhGln/JqPeAOtN/+X PmmV3/qdsqeoA== Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 857B263335 for ; Fri, 12 Aug 2022 14:47:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bD8EjVWl"; dkim-atps=neutral Received: by mail-pf1-x435.google.com with SMTP id f30so872363pfq.4 for ; Fri, 12 Aug 2022 05:47:20 -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=tOMvEb8+jW2LNCQnAUQ+tjZmiR2dUmv6UZKwe1iyfwE=; b=bD8EjVWl9x9pfmKkpgd/IFh3MQtidJvw+3X6Vv+9KrBGE/3eI0wiXy/KCK6X73n+Rq FfBc0NXDTIZ40LVIxTETE+Q6bkyy8Zi7keaxh2aeqk2QvE8I3hMf5HsZktERtlwAnyrb wyWF/nRQ3q1+9bBmTD8Pvk2v++XtFMoJGy2PybnyLMrgaBNjhkCIg35NksKn/Kckbib/ R22wWSiRVflYKEIwfVICtoyA2/+nRly0c8N0E+SB8DMyYAu8N8qbphLfNvVWRVxo/PkX iTRcyov1W5uCZftdgAog9Fogb65MNFHxlYMyGzFWHJsPUezljJjflOHSiBF03ezAI7x4 DD5w== 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=tOMvEb8+jW2LNCQnAUQ+tjZmiR2dUmv6UZKwe1iyfwE=; b=df5NRhfedipsojiC3+ETfEFqf4kQxpo5zqIM9/A56F9y8mTLsASFi2G3fmQq9blIrS utRykqNZGhgYMT+kdA51oNcXnAzps0i2t9cIr1MM7xRfHGWK1Dd3LIMFsjPDXE7iM8TY xp3QCHfzkFXtEkjuqLs28i7fUXvO22sOhByw/qehhQANbaE0AG3jhuAW7saPfwd37I9G OhbRQqPu+E2lGzjfVhwI3RNuJ4njPRUajI7aksI+QlmOAc7+AdiFZz7p7yWJad1eChcc YTs4ii9u8H73cmZthvXawZfY9In7cQPXjyWNNe9nc06za8gmCUwr2bc/gFyK1m+GeGwd mjVQ== X-Gm-Message-State: ACgBeo0kOuVrlDq+p9P6AQB7IhDZdZ/vFsukEOietNAWD8qsy2ADKpQC g+ADVjEDnj+Kgz9jwWd/t9AdaCtyBqk= X-Google-Smtp-Source: AA6agR4LNEU2vPOa7uXO71RHXGpUQvWoiWWVP3JYGJydkWFkAXFjX9tkixf/ZG9yANIPD8I9OdXR1A== X-Received: by 2002:a63:4145:0:b0:41d:deef:b318 with SMTP id o66-20020a634145000000b0041ddeefb318mr3024565pga.271.1660308438916; Fri, 12 Aug 2022 05:47:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:18 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:48 +0530 Message-Id: <20220812124651.27496-9-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 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 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(); From patchwork Fri Aug 12 12:46: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: 17106 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 7D3A8BE173 for ; Fri, 12 Aug 2022 12:47:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 12B2F6333D; Fri, 12 Aug 2022 14:47:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308446; bh=wQeQ1Ln3iAWeCQ+hlJFdS8O+yK8fw3jxJ25JPQM2QF0=; 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=eOnbt7uawKm63O2YUWF4+IsVNJjpvU2Isqh5Y+tFJPgRnE+STohVlzZAKVQAXZHtr KGbgyaAau2FLG+m5uU/3aFdDuznHB6xF56i180S9vA531y9KepWzikRJ8FmnW6KYNb /ksJjl4epc2YP2t/qocvR5yO931t/BuJkHLkG1z2fVJOceAe0pMJ+N4AliI3f6YPHb CMQwpCNFSIyuuXbEM+NtLlbhQmvmSBMU+uwEZV+1oO77alonNExvh8QiTKTyx0EBrE 4z8TodGcsdRPcihnAa1IUHVmjWVRvsGLnnPgfiqUhjcjvRMIWZzbGshfJrDdoptjIX mpIBRAVnO+BAA== 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 6BD7C6332F for ; Fri, 12 Aug 2022 14:47:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ese1uDVr"; dkim-atps=neutral Received: by mail-pg1-x535.google.com with SMTP id 12so720603pga.1 for ; Fri, 12 Aug 2022 05:47:23 -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=0mSGTAJYgBUn9gbfDNStPGozQZftpJdLDYTBsC3J34U=; b=ese1uDVr2Ioe9MXvV6lsFBm4CcK+nfxa2ki3gbYGytDgWbXf+LLSUO/zImr10kWj57 da21LOta4o7D1sXP4qOHgjXD1yEhzrxJRGAbjDYU1GYJmrWNE4lZvhBeFIO/mOVxuTNc YMBZMshB50qtwNHNNFVrslAvVgWIFsh+47lArVRuCBtIGzkV3WZJOt2MmoOD2j5vjq9U 2KBg3PxlpNxbUOF/T78KKHR02UTtfc7a/UrdBX7dcM/vn7LgiveUqueBA03vc0DqTC6D RnBPP34a8E3RrmMKY0T98yVAsgzIu5JDZlmwbw8z1ONgpXxYsyOnC+VY+8OJmX7apvKc 2KgA== 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=0mSGTAJYgBUn9gbfDNStPGozQZftpJdLDYTBsC3J34U=; b=KqUU1t3qg4pWjpR1vMTxjGr/6srRCl9nBimJhBhXAaX1Al/EiZwd4LOVqp22YILnWn Bq98vgcaQmxeuYr1RGwyNYvLxM8vJCL6wz3curPhqi5mdJPVx81oTwYQg5rQQbQzhQ6B fd9D0t/ALyIQ669DkHd8R701CdECQZ+GvFBqT/jLWyKFG5+wmyr25gYKB4/92f/rymGl mWKtECYboMeJFkv4XUda7GSYHZII7futsViCE2uiYakXGFkqUTVExlR9yywdUHZCXSzX xO1C0yTn+euX6Rgpa8ooAWNVI7TknvqfZhtLSAudVDElQT29Yuh8gPE9aM8ouy/g1P14 1b/Q== X-Gm-Message-State: ACgBeo1OXLdDiQDykxUOElYQ4X6wuaMXkTG0UmgQ3uXRromXbHpFJy2w LCFB2PHV3fNNNo8UnPiZbj4Lc0m473I= X-Google-Smtp-Source: AA6agR5jb4sRx+6hsjr5LHI78qLpQPN2Mm6asLt7lKeW0z4qbS3K+yPpS6zjhyqpIbiwQbeBFogAmA== X-Received: by 2002:a63:dd4b:0:b0:41d:e855:7137 with SMTP id g11-20020a63dd4b000000b0041de8557137mr3075434pgj.595.1660308442826; Fri, 12 Aug 2022 05:47:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:22 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:50 +0530 Message-Id: <20220812124651.27496-11-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 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 9e38da37..d9c294a2 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -93,6 +93,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")); } @@ -162,6 +175,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 Aug 12 12:46: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: 17107 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 CE54EBE173 for ; Fri, 12 Aug 2022 12:47:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7FDE86332F; Fri, 12 Aug 2022 14:47:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660308449; bh=T++GkxDL3UJZAfQWu3JPt2kiIPUYDr2fxuQdBZ+OLxs=; 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=nKDoEaJufrJQBT96fCLQk7jLZ4d+7I2VuU6T+e5G3LUXFxVawxJwZ8sV9Ccvuclcf 2tGKX6rDrZUXdfgrzk2BtgZAVaf15shC2ZDVLgft6Nymf5bL8F29s/0OTyfO9Nghlg mxdrUoO/7bQS3MtKkowRSejpLzdB9N4tv2jXIedUhzQ9UksfiNutgul4LZXHHW9mla tGdeaPk3Nn+yOJeCdHun2N8Wf0RgI9E3Gt0usc06p1CcAFDvpiL2Aw0K3qtoJCfrnc +TWVQd7dmMVR5TFx9ePY4QTRIkKuyjsTk6vPE0cM7UwPwP9MjggGFkZwDt6PB42Aaz WoDFGJfGqaEGA== Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 89CAE6333C for ; Fri, 12 Aug 2022 14:47:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ddj0dE7e"; dkim-atps=neutral Received: by mail-pf1-x429.google.com with SMTP id q19so861064pfg.8 for ; Fri, 12 Aug 2022 05:47:26 -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=5/HXw9ImJB2umPS6J+EtU65f7nMmfoqQchYu/6IodcM=; b=Ddj0dE7e4b05Pl0Vc7UWv8mGmpC/81sT/ASY3DoCw3EkXxNkigkxjHaCUKi2OG8FZh ExMkurkt8ZWb5yqguxP84zEG7j+bXboNWoGVoG9DWeUf2UtXrP4hTEVQkbV4o6ag8fBg CxaYr12JRMGET1qfF55/jOMNxcB7jAB5Ja1MZ+e5qC6bZCUUwfLg1E2GvNE7IOB2s0g2 eiThXWvrLFO/iGMfhbypDh4udGlkj5UNa29T1CqpPJaZ6M5o9dAC3gj5CPHcrkBXtkmg pZLlk6tcXSRXLON+yxndKwSJnGctq2jQwBP2J2E1JCHshrQfJKTQm0PySDanPogLTtgg uK/w== 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=5/HXw9ImJB2umPS6J+EtU65f7nMmfoqQchYu/6IodcM=; b=1lr0zo0iLhR4xFtUng3hG+5xhfjgHzGdrJViR+qK24vi0fhoWuQBwZOnqsWYmrvf75 mjBVGCyvaii+KJ3xrfnitY0f48I8vzE/p3zJQ6IT0VoTpi4vzXgmCcLu+K64iC+nFzC4 QIHxN3Wx0dmcqGKteuKR78FqAwoMZfsNVI6Sb2ww/179kYDsA24qvO7L8qbPYwAhDOJd xVwKnzgyz9UYMLmJ15gxSh0rz/DspuVB+cd3P/0G7DEUCC976p0IgFAvyYjRZTQdbksh Ck++NcZrOFWPM4AOVSVcLV2EMwWB5Wzmtiijg991GsjqRgTvR3cEW0r//3ixx3PMO3t5 vpZg== X-Gm-Message-State: ACgBeo1CtRNIw5LwQK5pFi7cj2d+mMLbuOgKuWdwc71A1jjsC1R/zciA bH/jndJvzYCpXZUnG5V1qIDb59lZOO0= X-Google-Smtp-Source: AA6agR6+mQSQpWRhO91wZPIRQys1b1aQrf1a/+Ld+tGjO2LV2adfIB84itbF8B7TPBvKqy6zznc7xw== X-Received: by 2002:a05:6a00:855:b0:52e:f01d:723a with SMTP id q21-20020a056a00085500b0052ef01d723amr3752911pfk.31.1660308444810; Fri, 12 Aug 2022 05:47:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 05:47:24 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Aug 2022 18:16:51 +0530 Message-Id: <20220812124651.27496-12-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 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 d9c294a2..45846ba2 100644 --- a/src/qcam/settings/control_frame.cpp +++ b/src/qcam/settings/control_frame.cpp @@ -144,6 +144,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; }