Show a patch.

GET /api/1.1/patches/17097/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17097,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17097/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17097/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220812124651.27496-2-utkarsh02t@gmail.com>",
    "date": "2022-08-12T12:46:41",
    "name": "[libcamera-devel,v2,01/11] qcam: Add settings Dialog with Control tab",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "fce1e9ea1eac0c1c3e5127e159f35e7a2633361a",
    "submitter": {
        "id": 114,
        "url": "https://patchwork.libcamera.org/api/1.1/people/114/?format=api",
        "name": "Utkarsh Tiwari",
        "email": "utkarsh02t@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17097/mbox/",
    "series": [
        {
            "id": 3410,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3410/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3410",
            "date": "2022-08-12T12:46:40",
            "name": "Introduce control interaction to qcam",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3410/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17097/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17097/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 01179BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Aug 2022 12:47:07 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC1726332E;\n\tFri, 12 Aug 2022 14:47:07 +0200 (CEST)",
            "from mail-pf1-x435.google.com (mail-pf1-x435.google.com\n\t[IPv6:2607:f8b0:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3DDF461FAB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Aug 2022 14:47:06 +0200 (CEST)",
            "by mail-pf1-x435.google.com with SMTP id p125so875940pfp.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Aug 2022 05:47:06 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:dc0d:d8e:96a2:2dbe:5a83])\n\tby smtp.gmail.com with ESMTPSA id\n\te6-20020a17090a728600b001f069352d73sm1431785pjg.25.2022.08.12.05.47.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 12 Aug 2022 05:47:04 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660308427;\n\tbh=Sh+PbJ25NGs5XtqHcyTP5/e6EJXtbdiJeMXGsUegKo8=;\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=LyUTI1481ONyMmu4NmhEEBHGg9IaMQq2v6FZTpnxc1+TFY/lr8lCf+MtZA9m9CAfT\n\tAhmFX5nntFy2PvjPBCeOB3LHQAZ4Xl4Td7Cqk8UwbCvwd4hYx3d+m1EgAg9vXW7iqy\n\tQY/mBshDGzV7fRLW89ZrGYF3wn2Ml2QZDutUGVYFErxEUfzJ9A6I3tc+veGsR87Rmz\n\tbad2UZguO3lfB4bBinsNJKCF199gx2XMdj4P5XKT64VZgKD61HvTdUUcneUs+ynPK1\n\tytJbJbf9b9F2vob7h9C8VcdGpHYvJV4vwc8B2qoxA8Kb8h/BUgsKrdg5tUv1x6WfP+\n\tNnvQPJ5a9hW1w==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc;\n\tbh=eeJ4uOdVqbzxkSFHFCXGMxTFRLSE3n1n+dHzSj9VE/E=;\n\tb=Bm7+LoY9c1lUNU/1vkojGV0aUrgRnwJnriny5NEuE4mgaXuTrW2S+5wNv5+v4kOOK9\n\tjPcP8HMHFTXMZT73ZpugyeguQReZm7bcEpnabT7HqwVemrg+bvxJkADR8Pdlxjvn7FaW\n\t6wbgN+PDJzwFKa0H/shUTck8FbuBmrcIUYVvpZGP4EplIEJd2W4I37iDMwhT5PAVVBtg\n\tddjo/w4kiErzJxpsahLxDqn9QUud2mVvIrKb7yLp1B7ekQA28aKdaV6iZOVFGJDi468d\n\tjhJe9lfnEpkzOujyqAhLuopG8LIe/1MnegKbsCFpX80xv0GS5a384QFQCEgXFt9Z6Aus\n\ts08A=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Bm7+LoY9\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc;\n\tbh=eeJ4uOdVqbzxkSFHFCXGMxTFRLSE3n1n+dHzSj9VE/E=;\n\tb=UqHKj1r+K6IAFz2X3sDhLhs0+ub74U45gqoU0Rb9DVPn2H5aF0Sh8TqfUrhVC+xWuM\n\t0EP7J3S8CjivsaX8LLranTtzHEME5cKyiyvriStaJLnHoyxa5LcTPmkq/Gzs1os92RTz\n\tMQ1SXvdPfNnWymPZNezBiTBfrycpHRENGshwfluwcwuDwv1NvAMEpU8k74APwcVQL4q+\n\ttioReBl1mS2JdwdnOdr2bR3+R7dHWA9tEaB7f5X3fqnANEOmZBKW2BgFipI5a1HG0CwW\n\twPds3Z6XrcAQgze5ifHi66BoeprzYre4KgXO4MQUXloYB/BcPOItt3u9iUAC3Nud1UZ9\n\tavbQ==",
        "X-Gm-Message-State": "ACgBeo0ab2ZXdT63lYK6qU7ghhNkBLiKkQOveGz2PmL+3L8XhUCcMny2\n\t2B5OSmP2q1jt7HHdNhmzn9iAX3Iqjuo=",
        "X-Google-Smtp-Source": "AA6agR58QvAdVytHfSsb79qeBK8yWxTdX04YMSM0V0xj/oEVSJPxBIxVHhVNM1j/ituuZkAlV1k17g==",
        "X-Received": "by 2002:a63:4d1a:0:b0:41b:d319:d8ad with SMTP id\n\ta26-20020a634d1a000000b0041bd319d8admr2959828pgb.613.1660308424431; \n\tFri, 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",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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. We check its existence with\nQPointer.\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---\nDifference from v1:\n\t1. Settings dialog now primarily uses QIcon::fromTheme(\"preferences-system\")\n\t2. using namespace libcamera; added in ControlFrame\n src/qcam/assets/feathericons/feathericons.qrc |  1 +\n src/qcam/main_window.cpp                      | 17 ++++++++\n src/qcam/main_window.h                        |  5 +++\n src/qcam/meson.build                          |  5 +++\n src/qcam/settings/control_frame.cpp           | 28 +++++++++++++\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, 183 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 c5302040..3078c26f 100644\n--- a/src/qcam/assets/feathericons/feathericons.qrc\n+++ b/src/qcam/assets/feathericons/feathericons.qrc\n@@ -5,6 +5,7 @@\n \t<file>camera-off.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 </qresource>\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex ce70cc02..7861c34b 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -239,6 +239,12 @@ int MainWindow::createToolbars()\n \tsaveRaw_ = action;\n #endif\n \n+\t/* Settings Dialog open action */\n+\taction = toolbar_->addAction(QIcon::fromTheme(\"preferences-system\",\n+\t\t\t\t\t\t      QIcon(\":settings.svg\")),\n+\t\t\t\t     \"Open Settings Window\");\n+\tconnect(action, &QAction::triggered, this, &MainWindow::openSettingsDialog);\n+\n \treturn 0;\n }\n \n@@ -262,6 +268,17 @@ void MainWindow::updateTitle()\n \tsetWindowTitle(title_ + \" : \" + QString::number(fps, 'f', 2) + \" fps\");\n }\n \n+void MainWindow::openSettingsDialog()\n+{\n+\tif (settingsDialog_) {\n+\t\tsettingsDialog_->show();\n+\t\treturn;\n+\t}\n+\n+\tsettingsDialog_ = new 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 c7cba5e9..856a71b1 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -23,12 +23,14 @@\n #include <QMainWindow>\n #include <QMutex>\n #include <QObject>\n+#include <QPointer>\n #include <QPushButton>\n #include <QQueue>\n #include <QTimer>\n \n #include \"../cam/capture_script.h\"\n #include \"../cam/stream_options.h\"\n+#include \"settings/settings_dialog.h\"\n \n #include \"cam_select_dialog.h\"\n #include \"viewfinder.h\"\n@@ -94,6 +96,8 @@ private:\n \tvoid loadCaptureScript();\n \tvoid stopCaptureScript();\n \n+\tvoid openSettingsDialog();\n+\n \t/* UI elements */\n \tQToolBar *toolbar_;\n \tQAction *startStopAction_;\n@@ -108,6 +112,7 @@ private:\n \tQTimer titleTimer_;\n \n \tCameraSelectorDialog *cameraSelectorDialog_;\n+\tQPointer<SettingsDialog> settingsDialog_;\n \n \t/* Options */\n \tconst OptionsParser::Options &options_;\ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 70a18d7e..7a785fd0 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -24,12 +24,17 @@ 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     'cam_select_dialog.h',\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..8b1162db\n--- /dev/null\n+++ b/src/qcam/settings/control_frame.cpp\n@@ -0,0 +1,28 @@\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+using namespace libcamera;\n+\n+ControlFrame::ControlFrame(const 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",
        "v2",
        "01/11"
    ]
}