Show a patch.

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

{
    "id": 16657,
    "url": "https://patchwork.libcamera.org/api/patches/16657/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16657/",
    "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-3-utkarsh02t@gmail.com>",
    "date": "2022-07-15T19:13:51",
    "name": "[libcamera-devel,02/11] qcam: ControlFrame: Display defualt value of controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "25d31e5f0880372ad658f8bd57515d3bea25a6c0",
    "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/16657/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/16657/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16657/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 D23DBC3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Jul 2022 19:14:12 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D24363317;\n\tFri, 15 Jul 2022 21:14:12 +0200 (CEST)",
            "from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com\n\t[IPv6:2607:f8b0:4864:20::102f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 022FA6330F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 21:14:11 +0200 (CEST)",
            "by mail-pj1-x102f.google.com with SMTP id\n\to3-20020a17090a744300b001ef8f7f3dddso7000043pjk.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Jul 2022 12:14:10 -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.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Jul 2022 12:14:09 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657912452;\n\tbh=/qKLkWUUn1tNProfmPvTMn//dPD1XB0Co6XOj+4bWuI=;\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=NRxawFfWv6Pkcio7CEaE4+isT+0jH7tHIR2Y9rPHAUBnR5ZmOj7U4+x1OFz0NyLAR\n\tEa04pAUcpSpnTVrolJ4nJFH5zt5y4puwg9Tv1udS3L6FSatVj1gRhimthaEhDclcLR\n\t010eff3c16nQeJwG1CcddqZcaOImfuNHzNUXC7NvDuSkA8GQJFRdc1issU1BbGRH15\n\tteMDSKuE0/anin5u4vPA/W4+y0P4hrLFiHSjfmKdBrE9TfBNBXWbIbGjjmR7Q5eRd6\n\tFGmiMMPv2D+yT/8wpeWnNoB77tG58W0nMYXS4GktRoPP+T/US3QdCKrCznoaNm0dOr\n\tZbbLLcv7bO9ag==",
            "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=Uz+u8kCOf37oqVbQNCDdLgtf+EpJ0K3cuUXKTKqQAg0=;\n\tb=EwYXvBjMBSKobG77FetoGGWKn5VxcjLK5gYjv2Kdy5tPEk2V+C1QoMzCQNZT2NG5KO\n\tIxvo+FQvQ/IqUUVwpEcRp52h8ynGeXdguOIBbRZRq6gYxO9evO3e8xrsGQwmfrlQlFQg\n\tApUX/QjchhhFB6tgmdgY7VKpQ9j5oFBvv4afa+b9k+ro7Mk5X0Gh6HeKqKnc3hmVPp59\n\th26pX7SEDuJKnsh/Vbx/s+Iynw/X0bqadF2w6+6cNj7OYEDkcE6ZMapyhwZxcFeeIiI2\n\tUJIxC8j8ATYqGFNlqWptyJWrKiZ8kRQIdpaHH4ggia1gaDIywXWOANiWLauZVTfsw+CD\n\t2AUA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"EwYXvBjM\"; 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=Uz+u8kCOf37oqVbQNCDdLgtf+EpJ0K3cuUXKTKqQAg0=;\n\tb=OxFzxfUUq5PAaIjKnkpbFbCRxs/7uA7WFle7Jn29BgUeSCOAO8aRoRnKFcUSRJtI+W\n\tKacDjYdo1wb5E0L0y1pZiFzc7KppQLSIJ49siWeVfbairjHuhHjU7K3zk8Sz6ikZbsRG\n\tondsWNoWDQkU7iJXz1eYQsSvLW3JK02z0E/jmjGy98ZuwbCLPOTsI3yzuOQ3n5FSWDnv\n\t2Ztm8H7zxm6Mimz5bfgsedPZzZ3YohDCh43SywbHuJulVZL/SPyYQ/TsIpO7Bcih+Lhq\n\tBUOlJIoI3KxWmK7VfU+udRdZgT63fpv+F2w9z/AgLlOPXfoAtklHCWNok11LI7UI4oho\n\t+mMg==",
        "X-Gm-Message-State": "AJIora9ykUud4BO7azS/csMPf6kfDFD5ZJxfxkFC4E/BNrqRsiBx+LmP\n\ttfyg7zkuGQ9WLd9614oofsGRS0NuNOk5Og==",
        "X-Google-Smtp-Source": "AGRyM1u0nrS+1Dj6Sjk7Y48oMRL0pVC8mMzNlYEkwzrXydDB92RheVb5MWVbm2xgaQ/l0v/slpe5rg==",
        "X-Received": "by 2002:a17:90b:4c48:b0:1ef:c839:c68c with SMTP id\n\tnp8-20020a17090b4c4800b001efc839c68cmr17232832pjb.233.1657912449285; \n\tFri, 15 Jul 2022 12:14:09 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 16 Jul 2022 03:13:51 +0800",
        "Message-Id": "<20220715191400.890976-3-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220715191400.890976-1-utkarsh02t@gmail.com>",
        "References": "<20220715191400.890976-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 02/11] qcam: ControlFrame: Display defualt\n\tvalue of controls",
        "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": "Display a QLabel below the Control Name showing the default value for\nthe controls.\n\nThis adds support to Display defualt value for the\ncontrol types :\n    ControlTypeBool\n    ControlTypeInteger32\n    ControlTypeInteger64\n    ControlTypeFloat\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n---\n src/qcam/settings/control_frame.cpp | 52 +++++++++++++++++++++++++++--\n src/qcam/settings/control_frame.h   |  9 +++++\n src/qcam/settings/controls_tab.cpp  |  2 +-\n 3 files changed, 60 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/qcam/settings/control_frame.cpp b/src/qcam/settings/control_frame.cpp\nindex 6f5cba6d..785e4040 100644\n--- a/src/qcam/settings/control_frame.cpp\n+++ b/src/qcam/settings/control_frame.cpp\n@@ -14,13 +14,61 @@\n #include <QString>\n #include <QVBoxLayout>\n \n-ControlFrame::ControlFrame(const libcamera::ControlId *control, QWidget *parent)\n-\t: QFrame(parent), control_(control)\n+using namespace libcamera;\n+\n+ControlFrame::ControlFrame(const libcamera::ControlId *control,\n+\t\t\t   const libcamera::ControlInfo &controlInfo,\n+\t\t\t   QWidget *parent)\n+\t: QFrame(parent), control_(control), controlInfo_(controlInfo)\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+\t/*\n+\t * No need to pass parents to widgets,\n+\t * as QVBoxLayout transfers ownership to\n+\t * its parent widget.\n+\t */\n+\tframeVLayout->addWidget(defaultValueLabel());\n+\n \tsetFrameStyle(QFrame::StyledPanel);\n }\n+\n+/* -----------------------------------------------------------------------------\n+ * Widgets\n+ */\n+\n+QLabel *ControlFrame::defaultValueLabel(QWidget *parent)\n+{\n+\tQLabel *defaultValLabel = new QLabel(parent);\n+\n+\tdefaultValLabel->setText(\"Default Value: \" + getDefaultValueQStr());\n+\n+\treturn defaultValLabel;\n+}\n+\n+/* -----------------------------------------------------------------------------\n+ * Helpers\n+ */\n+\n+QString ControlFrame::getDefaultValueQStr()\n+{\n+\tswitch (control_->type()) {\n+\tcase ControlTypeBool:\n+\t\tif (controlInfo_.def().get<bool>()) {\n+\t\t\treturn QString(\"True\");\n+\t\t} else {\n+\t\t\treturn QString(\"False\");\n+\t\t}\n+\tcase ControlTypeInteger32:\n+\t\treturn QString::number(controlInfo_.def().get<int32_t>());\n+\tcase ControlTypeInteger64:\n+\t\treturn QString::number(controlInfo_.def().get<int64_t>());\n+\tcase ControlTypeFloat:\n+\t\treturn QString::number(controlInfo_.def().get<float>());\n+\tdefault:\n+\t\treturn QString(\"Unavailable\");\n+\t}\n+}\ndiff --git a/src/qcam/settings/control_frame.h b/src/qcam/settings/control_frame.h\nindex 10690674..884feb6b 100644\n--- a/src/qcam/settings/control_frame.h\n+++ b/src/qcam/settings/control_frame.h\n@@ -9,6 +9,7 @@\n \n #include <libcamera/controls.h>\n \n+#include <QLabel>\n #include <QFrame>\n #include <QWidget>\n \n@@ -18,9 +19,17 @@ class ControlFrame : public QFrame\n \n public:\n \tControlFrame(const libcamera::ControlId *control,\n+\t\t     const libcamera::ControlInfo &controlInfo,\n \t\t     QWidget *parent);\n \t~ControlFrame() = default;\n \n private:\n \tconst libcamera::ControlId *control_;\n+\tconst libcamera::ControlInfo &controlInfo_;\n+\n+\t/* Widgets */\n+\tQLabel *defaultValueLabel(QWidget *parent = nullptr);\n+\n+\t/* Helper Hunctions */\n+\tQString getDefaultValueQStr();\n };\ndiff --git a/src/qcam/settings/controls_tab.cpp b/src/qcam/settings/controls_tab.cpp\nindex 33ed9332..adc24326 100644\n--- a/src/qcam/settings/controls_tab.cpp\n+++ b/src/qcam/settings/controls_tab.cpp\n@@ -26,7 +26,7 @@ ControlsTab::ControlsTab(std::shared_ptr<libcamera::Camera> camera_,\n \n \tint controlCount = 0;\n \tfor (auto &[control, info] : camera_->controls()) {\n-\t\tControlFrame *controlFrame = new ControlFrame(control, this);\n+\t\tControlFrame *controlFrame = new ControlFrame(control, info, this);\n \n \t\tcontrolGLayout->addWidget(controlFrame, controlCount / 2,\n \t\t\t\t\t  controlCount % 2);\n",
    "prefixes": [
        "libcamera-devel",
        "02/11"
    ]
}