Patch Detail
Show a patch.
GET /api/patches/16656/?format=api
{ "id": 16656, "url": "https://patchwork.libcamera.org/api/patches/16656/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16656/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220715191400.890976-2-utkarsh02t@gmail.com>", "date": "2022-07-15T19:13:50", "name": "[libcamera-devel,01/11] qcam: Add settings Dialog with Control tab", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "61a71006ee423f0c52f8dc5575d937cf1053d782", "submitter": { "id": 114, "url": "https://patchwork.libcamera.org/api/people/114/?format=api", "name": "Utkarsh Tiwari", "email": "utkarsh02t@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16656/mbox/", "series": [ { "id": 3292, "url": "https://patchwork.libcamera.org/api/series/3292/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3292", "date": "2022-07-15T19:13:49", "name": "Introduce control interaction to qcam", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3292/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16656/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16656/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F09DFBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Jul 2022 19:14:11 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7CDA763316;\n\tFri, 15 Jul 2022 21:14:11 +0200 (CEST)", "from mail-pg1-x536.google.com (mail-pg1-x536.google.com\n\t[IPv6:2607:f8b0:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 859F96330E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 21:14:09 +0200 (CEST)", "by mail-pg1-x536.google.com with SMTP id e132so5217480pgc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 12:14:09 -0700 (PDT)", "from localhost.localdomain\n\t([2406:3003:2005:1c27:d8e8:f9ac:919c:9ac8])\n\tby smtp.gmail.com with ESMTPSA id\n\ts10-20020a170903214a00b0016be834d544sm3834315ple.237.2022.07.15.12.14.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Jul 2022 12:14:07 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657912451;\n\tbh=FoKUz+FkkiUIWht5IENjaIF1emvhatvEXA9CQBxsjCM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=yrloO2J2DpJU61T3hF6NGi48wEjj/VUAyxD9DljE8Je0xh5wHT42eiCQ9nKn8UF6r\n\t9zFOBiCfIsjKTqhtyr/hZ69QdTaxbkvJXrimxfyTlXj+At8zbhRU9H8qULXTmS29XN\n\tzorOd5OBfCIa2xuihUXaXLpIBjnwcEIaSfWmcuh8DIAa2dj6E9XfcePGcJz0jN09+5\n\tBPZc3cZwbEOSIO4ktapWM8/kaam+miPyEZnGbPsx8RXqEd67WPDNbh+QBPZ7UWbcnR\n\t6Jh8U9tIVQPsIVAddSZTHyh6qZV0w5j/azBMdW5yhL1fmM5mWW9+LWKilpp1n8aiEC\n\tJmyMZsl/iF7wg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=anyKfc289I3CWaA7uesC5+ilg1UNAagPjTMM2PRc++0=;\n\tb=CAuyIvm2H9SA/NNxLDBj2TkddMhHilOJqC4Uhpn9vm0pWZFTZFC7IeuThaw7dDSQTE\n\tBGqEvI6sBByj5M9JHPyyRivRLoacibvN8oUjhl88c8BBPXHe/AZ/7y7fjKDvTqBp1tWc\n\t6c0Nrva74lR7Sj9tLHuSBhcstkbXSjveKeQkDxcnpEJLBNC/y4vKqVGn2MF4tl8oddh4\n\tsBGKal5dVagL67kxkivN420r/DtocdisMArBQB6cdDuq886JQ1PW5wJGX8IedkEOA1xR\n\tXvUjb1hezQbZrHqzBDa/WYEsqOJ6aWlHa+talrZAFHM8hDDcmse+SuvCXNaodIJOX7pK\n\tzImw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"CAuyIvm2\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=anyKfc289I3CWaA7uesC5+ilg1UNAagPjTMM2PRc++0=;\n\tb=j2JNpZ9mtjARZFnThoewKJBcu8GYye0amfff7UPJzL7nVw3Ylx5b0Cy8FCLkPLGvth\n\tEtlDbgFgaCcU6dkHSFtFtXty1UrLMHc9JzpfMf1CHiZHipU1bX1pRfWq6+Ea71/3hMrt\n\tGACxfzXbiFnr0xBilVZbksAy/FoJazZzYVN3LKIEkJFTDTOA9QEFXcM5fSVKhvitMhui\n\tuyg1SoTZwnaH72HKqWuOTdjY4jeLpghmO9tfHk7G875jttG8kRKAYw/cxUV7VBk1nsuX\n\tzIeZl2+zLlFQ2AIBwbkn/Ez492SBmMTuWbXX4PxjhgDqbBO8A/VhbC9GOP31Vj1lt+5O\n\tKUGw==", "X-Gm-Message-State": "AJIora8S1Pu11fgfGl6/ogzE/2+wYrqZXDrwhjPmAsg639PnnxyO5DiB\n\tV6HockUZn9w024ra3aH2quY+8dNKGMivhw==", "X-Google-Smtp-Source": "AGRyM1vGgWrtytlofyYBmBopCg/Q4oSWsfRM4PsoMcXXctl//rJ0PiyCPrG+z6ICKY8eJYT54aHQqg==", "X-Received": "by 2002:a63:8341:0:b0:415:c973:18b1 with SMTP id\n\th62-20020a638341000000b00415c97318b1mr13882885pge.292.1657912447875; \n\tFri, 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", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 01/11] qcam: Add settings Dialog with\n\tControl tab", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Utkarsh Tiwari via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Utkarsh Tiwari <utkarsh02t@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Implement a Settings QDialog and add its buttonon the toolbar.\nWe only create one instance of the SettingsWindow and its created the\nfirst time user clicks on the button.\n\nThis Setting Dialog implements a QTabWidget which resides in a\nQVBoxLayout so that it spans the whole QDialog.\n\nThe QTabWidget currently only holds the control tab.\nThis Tab lays out the respective ControlFrames in a QGridLayout listing\ntwo controls in each row.\n\nControlFrames handles the UI for each respective controls.\nIt also implements the QVBoxLayout as for future when we want to add\nmore information in each frame.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n---\n src/qcam/assets/feathericons/feathericons.qrc | 1 +\n src/qcam/main_window.cpp | 15 +++++++\n src/qcam/main_window.h | 4 ++\n src/qcam/meson.build | 5 +++\n src/qcam/settings/control_frame.cpp | 26 +++++++++++++\n src/qcam/settings/control_frame.h | 26 +++++++++++++\n src/qcam/settings/controls_tab.cpp | 38 ++++++++++++++++++\n src/qcam/settings/controls_tab.h | 24 ++++++++++++\n src/qcam/settings/settings_dialog.h | 39 +++++++++++++++++++\n 9 files changed, 178 insertions(+)\n create mode 100644 src/qcam/settings/control_frame.cpp\n create mode 100644 src/qcam/settings/control_frame.h\n create mode 100644 src/qcam/settings/controls_tab.cpp\n create mode 100644 src/qcam/settings/controls_tab.h\n create mode 100644 src/qcam/settings/settings_dialog.h", "diff": "diff --git a/src/qcam/assets/feathericons/feathericons.qrc b/src/qcam/assets/feathericons/feathericons.qrc\nindex 6b08395a..9dc179bb 100644\n--- a/src/qcam/assets/feathericons/feathericons.qrc\n+++ b/src/qcam/assets/feathericons/feathericons.qrc\n@@ -6,6 +6,7 @@\n \t<file>file.svg</file>\n \t<file>play-circle.svg</file>\n \t<file>save.svg</file>\n+\t<file>settings.svg</file>\n \t<file>stop-circle.svg</file>\n \t<file>x-circle.svg</file>\n \t<file>x-square.svg</file>\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex d4b3d629..f0916b8e 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -255,6 +255,10 @@ int MainWindow::createToolbars()\n \t/* Do not operate directly call toggleScriptAction */\n \tscriptExecAction_ = action;\n \n+\t/* Settings Dialog open action */\n+\taction = toolbar_->addAction(QIcon(\":settings.svg\"), \"Open Settings Window\");\n+\tconnect(action, &QAction::triggered, this, &MainWindow::openSettingsDialog);\n+\n \treturn 0;\n }\n \n@@ -341,6 +345,17 @@ void MainWindow::toggleScriptAction(bool showAvailable)\n \t}\n }\n \n+void MainWindow::openSettingsDialog()\n+{\n+\tif (settingsDialog_) {\n+\t\tsettingsDialog_->show();\n+\t\treturn;\n+\t}\n+\n+\tsettingsDialog_ = std::make_unique<SettingsDialog>(camera_, this);\n+\tsettingsDialog_->show();\n+}\n+\n /* -----------------------------------------------------------------------------\n * Camera Selection\n */\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 6f131b17..e35f9029 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -28,6 +28,7 @@\n \n #include \"../cam/capture_script.h\"\n #include \"../cam/stream_options.h\"\n+#include \"settings/settings_dialog.h\"\n #include \"viewfinder.h\"\n \n class QAction;\n@@ -89,6 +90,7 @@ private:\n \tvoid processViewfinder(libcamera::FrameBuffer *buffer);\n \n \tvoid chooseScript();\n+\tvoid openSettingsDialog();\n \n \tvoid toggleScriptAction(bool showAvailable);\n \n@@ -106,6 +108,8 @@ private:\n \tQString title_;\n \tQTimer titleTimer_;\n \n+\tstd::unique_ptr<SettingsDialog> settingsDialog_;\n+\n \t/* Options */\n \tconst OptionsParser::Options &options_;\n \ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 67074252..b02b216c 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -23,11 +23,16 @@ qcam_sources = files([\n 'main.cpp',\n 'main_window.cpp',\n 'message_handler.cpp',\n+ 'settings/control_frame.cpp',\n+ 'settings/controls_tab.cpp',\n 'viewfinder_qt.cpp',\n ])\n \n qcam_moc_headers = files([\n 'main_window.h',\n+ 'settings/control_frame.h',\n+ 'settings/controls_tab.h',\n+ 'settings/settings_dialog.h',\n 'viewfinder_qt.h',\n ])\n \ndiff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp\nnew file mode 100644\nindex 00000000..6f5cba6d\n--- /dev/null\n+++ b/src/qcam/settings/control_frame.cpp\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Utkarsh Tiwari <utkarsh02t@gmail.com>\n+ *\n+ * control_frame.cpp - qcam - Control frame\n+ */\n+\n+#include \"control_frame.h\"\n+\n+#include <libcamera/controls.h>\n+\n+#include <QFrame>\n+#include <QLabel>\n+#include <QString>\n+#include <QVBoxLayout>\n+\n+ControlFrame::ControlFrame(const libcamera::ControlId *control, QWidget *parent)\n+\t: QFrame(parent), control_(control)\n+{\n+\t/* Main layout for the frame */\n+\tQVBoxLayout *frameVLayout = new QVBoxLayout(this);\n+\n+\tframeVLayout->addWidget(new QLabel(QString::fromStdString(control_->name())));\n+\n+\tsetFrameStyle(QFrame::StyledPanel);\n+}\ndiff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h\nnew file mode 100644\nindex 00000000..10690674\n--- /dev/null\n+++ b/src/qcam/settings/control_frame.h\n@@ -0,0 +1,26 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Utkarsh Tiwari <utkarsh02t@gmail.com>\n+ *\n+ * control_frame.h - qcam - Control frame\n+ */\n+\n+#pragma once\n+\n+#include <libcamera/controls.h>\n+\n+#include <QFrame>\n+#include <QWidget>\n+\n+class ControlFrame : public QFrame\n+{\n+\tQ_OBJECT\n+\n+public:\n+\tControlFrame(const libcamera::ControlId *control,\n+\t\t QWidget *parent);\n+\t~ControlFrame() = default;\n+\n+private:\n+\tconst libcamera::ControlId *control_;\n+};\ndiff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp\nnew file mode 100644\nindex 00000000..33ed9332\n--- /dev/null\n+++ b/src/qcam/settings/controls_tab.cpp\n@@ -0,0 +1,38 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Utkarsh Tiwari <utkarsh02t@gmail.com>\n+ *\n+ * controls_tab.cpp - qcam - Controls Tab\n+ */\n+\n+#include \"controls_tab.h\"\n+\n+#include <memory>\n+\n+#include <libcamera/camera.h>\n+\n+#include <QGridLayout>\n+#include <QLabel>\n+#include <QWidget>\n+\n+#include \"control_frame.h\"\n+\n+ControlsTab::ControlsTab(std::shared_ptr<libcamera::Camera> camera_,\n+\t\t\t QWidget *parent)\n+\t: QWidget(parent)\n+{\n+\t/* Main Layout for the tab */\n+\tQGridLayout *controlGLayout = new QGridLayout(this);\n+\n+\tint controlCount = 0;\n+\tfor (auto &[control, info] : camera_->controls()) {\n+\t\tControlFrame *controlFrame = new ControlFrame(control, this);\n+\n+\t\tcontrolGLayout->addWidget(controlFrame, controlCount / 2,\n+\t\t\t\t\t controlCount % 2);\n+\t\tcontrolCount++;\n+\t}\n+\n+\tif (controlCount == 0)\n+\t\tcontrolGLayout->addWidget(new QLabel(\"No controls available\"));\n+}\ndiff --git a/src/qcam/settings/controls_tab.h b/src/qcam/settings/controls_tab.h\nnew file mode 100644\nindex 00000000..6a63f334\n--- /dev/null\n+++ b/src/qcam/settings/controls_tab.h\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Utkarsh Tiwari <utkarsh02t@gmail.com>\n+ *\n+ * controls_tab.h - qcam - Controls Tab\n+ */\n+\n+#pragma once\n+\n+#include <memory>\n+\n+#include <libcamera/camera.h>\n+\n+#include <QVBoxLayout>\n+#include <QWidget>\n+\n+class ControlsTab : public QWidget\n+{\n+\tQ_OBJECT\n+\n+public:\n+\tControlsTab(std::shared_ptr<libcamera::Camera> camera_, QWidget *parent);\n+\t~ControlsTab() = default;\n+};\ndiff --git a/src/qcam/settings/settings_dialog.h b/src/qcam/settings/settings_dialog.h\nnew file mode 100644\nindex 00000000..c2fa61ea\n--- /dev/null\n+++ b/src/qcam/settings/settings_dialog.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2022, Utkarsh Tiwari <utkarsh02t@gmail.com>\n+ *\n+ * settings_dialog.h - qcam - Settings Dialog\n+ */\n+\n+#pragma once\n+\n+#include <memory>\n+\n+#include <QDialog>\n+#include <QTabWidget>\n+#include <QVBoxLayout>\n+#include <QWidget>\n+\n+#include \"controls_tab.h\"\n+class SettingsDialog : public QDialog\n+{\n+\tQ_OBJECT\n+\n+public:\n+\tSettingsDialog(std::shared_ptr<libcamera::Camera> camera, QWidget *parent)\n+\t\t: QDialog(parent)\n+\t{\n+\t\t/*Main layout for dialog */\n+\t\tQVBoxLayout *settingVLayout = new QVBoxLayout(this);\n+\n+\t\t/* Main TabWidget which would hold other tabs */\n+\t\tQTabWidget *settingTabWidget = new QTabWidget;\n+\t\tsettingVLayout->addWidget(settingTabWidget);\n+\n+\t\tControlsTab *controlsTab = new ControlsTab(camera, this);\n+\t\tsettingTabWidget->addTab(controlsTab, \"Controls\");\n+\n+\t\tsetWindowTitle(\"Settings\");\n+\t}\n+\t~SettingsDialog() = default;\n+};\n", "prefixes": [ "libcamera-devel", "01/11" ] }