Show a patch.

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

{
    "id": 17056,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17056/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17056/",
    "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": "<20220809205042.344923-5-utkarsh02t@gmail.com>",
    "date": "2022-08-09T20:50:38",
    "name": "[libcamera-devel,v7,4/8] qcam: CamSelectDialog: Display Location and Model propety of camera",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0dc07e3f44b014d86d1885436fff4ff50a75143c",
    "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/17056/mbox/",
    "series": [
        {
            "id": 3400,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3400/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3400",
            "date": "2022-08-09T20:50:34",
            "name": "Introduce capture scripts to qcam",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/3400/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17056/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17056/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 46CFBBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 20:51:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0530863330;\n\tTue,  9 Aug 2022 22:51:06 +0200 (CEST)",
            "from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com\n\t[IPv6:2607:f8b0:4864:20::1030])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F3E2E6332F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 22:51:04 +0200 (CEST)",
            "by mail-pj1-x1030.google.com with SMTP id pm17so12830956pjb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Aug 2022 13:51:04 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:d2bc:2358:3bcd:fb4f:cbb7])\n\tby smtp.gmail.com with ESMTPSA id\n\td3-20020a623603000000b0052d981e7842sm301936pfa.208.2022.08.09.13.51.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 09 Aug 2022 13:51:03 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660078266;\n\tbh=Bfo3MNw2X87wUqYkn7yZ5Z7KL5aO6MgRuLdiAKhIk+c=;\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=robKugGc1Ars3j0jGtZBIBS1S6r2ggETt6eyUtFT+6abxOLqfUziklB6KJuzJuVjZ\n\tMyMQrrmMk+AdIhsDNob7cxvxnCx4KDbXzMlVSGrwab2GnbmjhDTvt1/cgRQcnw7inX\n\t0OgZ0NnNnpL59m87kmBES17EdzU9a44C1DihAqxWBToEIQD/Lx7ORzhhbjsNsY0BrX\n\tTxG+2QVppqPLGmAQC4h3k1XnhcngwYQbyLaWce5/KltzJ2e80ASuxL1aQwltH1De7c\n\tN2MTSg6X+6UFovVRlfe8Mx7SXUhNStSmugwe+E1GJpbBsA7gvY6kqP6ZI9aor4Cyt2\n\tvs0XcKApWeeZQ==",
            "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=8FNAgahM9w38jWDF6h/O2SKek+RtA3Cc8HkrQLIP6LM=;\n\tb=Nxt562N+VZh51IxuMOndZRLBo1a+qm7B/5ERFEvZ/2bD9EE3+H7Xv/DhmjnKCtdtnt\n\tupD9zeFZ0Oel+G5yIj2kvfaZIfUAQDPxf6LrlVyUZsDeAyI/O2iiUm0J50Kh2EYxUL3l\n\thK/X1DKVjV3kW0d3CgMUgNpOE993Q7XOmffKZ/G9CO5Jk8YCXahUyGOJWMcpmB2ur3SS\n\t5EyjVraWjYkuhst0CUkSCS4nzSFHJ2wRGF7P24XCwyrpO5VRa6K8VuNIBL+Oel1Nefo+\n\t0n7JdgYl82eko2nNGgJwRtT2anpvNUz2bTMZr1/xkLDCsNynYmcwhI2Q2LQPUri5NNnk\n\tX7DA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Nxt562N+\"; 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=8FNAgahM9w38jWDF6h/O2SKek+RtA3Cc8HkrQLIP6LM=;\n\tb=jUB1rgKnCivP4zNgZIBHB28wIUuq3UXizgh7ifgIl9AQwFmjLZaZV0bC6YV/Vyjw6k\n\tk7ovY0DPVmR92mwSV2dUHXLdGNDh6MgTTmq21SIaq+JsfW6zKFM5MrINW1ebjY4vrlWN\n\t5L0S9xAJmXS1DLk5gp5aGK0glR7jkvHfWIhIT58SfxUxLFwOTZBc0GmL9/OCpfIhqHrV\n\t+iJbNfM4BGKuMWduBqe1VU7uguMbdT67bnzYd0tesE0ZKVGj4HFlX32PlF2elDzhdRp6\n\tc3Uvyl2z4pzPVbZ5CtjF4cm1VjelAIRQ0fFmI+3M9trxEQNiGvFmMOCWworG8B5DUGav\n\tpUNw==",
        "X-Gm-Message-State": "ACgBeo34Kq3QeZU/W/cZmauhP7FawD7vrMMasaFQ/sM861Wo/QGFSdAo\n\tSR1Yl/RuLtrMclVLXkDEapHDlogLXs8=",
        "X-Google-Smtp-Source": "AA6agR5+N9dgNTrq5lWo5ZGMZ9RLZ35MicT9B+aCi3IeGrGinUlbEj9Sv9kqayYEfJMkPLoiz0Mlgw==",
        "X-Received": "by 2002:a17:90b:1b08:b0:1f5:b65:9654 with SMTP id\n\tnu8-20020a17090b1b0800b001f50b659654mr292169pjb.77.1660078263357; \n\tTue, 09 Aug 2022 13:51:03 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 10 Aug 2022 02:20:38 +0530",
        "Message-Id": "<20220809205042.344923-5-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220809205042.344923-1-utkarsh02t@gmail.com>",
        "References": "<20220809205042.344923-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 4/8] qcam: CamSelectDialog: Display\n\tLocation and Model propety of camera",
        "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": "The camera selection dialog currently only displays the camera Id.\nDisplay the camera location and camera model if available.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nDifference :\n\t1. Now use value_or for optional\n\t2. Not use lambda and make a private member function\n src/qcam/cam_select_dialog.cpp | 52 ++++++++++++++++++++++++++++++++++\n src/qcam/cam_select_dialog.h   | 10 +++++++\n 2 files changed, 62 insertions(+)",
    "diff": "diff --git a/src/qcam/cam_select_dialog.cpp b/src/qcam/cam_select_dialog.cpp\nindex d8982800..f97ad6eb 100644\n--- a/src/qcam/cam_select_dialog.cpp\n+++ b/src/qcam/cam_select_dialog.cpp\n@@ -7,6 +7,7 @@\n \n #include \"cam_select_dialog.h\"\n \n+#include <memory>\n #include <string>\n \n #include <libcamera/camera.h>\n@@ -30,6 +31,14 @@ CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManag\n \tfor (const auto &cam : cm_->cameras())\n \t\tcameraIdComboBox_->addItem(QString::fromStdString(cam->id()));\n \n+\t/* Set camera information labels. */\n+\tcameraLocation_ = new QLabel;\n+\tcameraModel_ = new QLabel;\n+\n+\thandleCameraChange();\n+\tconnect(cameraIdComboBox_, &QComboBox::currentTextChanged,\n+\t\tthis, &CameraSelectorDialog::handleCameraChange);\n+\n \t/* Setup the QDialogButton Box */\n \tQDialogButtonBox *buttonBox =\n \t\tnew QDialogButtonBox(QDialogButtonBox::Ok |\n@@ -41,7 +50,10 @@ CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManag\n \t\tthis, &QDialog::reject);\n \n \t/* Set the layout. */\n+\n \tlayout->addRow(\"Camera:\", cameraIdComboBox_);\n+\tlayout->addRow(\"Location:\", cameraLocation_);\n+\tlayout->addRow(\"Model:\", cameraModel_);\n \tlayout->addWidget(buttonBox);\n }\n \n@@ -63,3 +75,43 @@ void CameraSelectorDialog::cameraRemoved(libcamera::Camera *camera)\n \n \tcameraIdComboBox_->removeItem(cameraIndex);\n }\n+\n+/* Camera Information */\n+void CameraSelectorDialog::handleCameraChange()\n+{\n+\tupdateCamInfo(cm_->get(getCameraId()));\n+}\n+\n+void CameraSelectorDialog::updateCamInfo(const std::shared_ptr<libcamera::Camera> &camera)\n+{\n+\tif (!camera)\n+\t\treturn;\n+\n+\tconst libcamera::ControlList &cameraProperties = camera->properties();\n+\n+\tconst auto &location =\n+\t\tcameraProperties.get(libcamera::properties::Location);\n+\tif (location) {\n+\t\tswitch (*location) {\n+\t\tcase libcamera::properties::CameraLocationFront:\n+\t\t\tcameraLocation_->setText(\"Internal front camera\");\n+\t\t\tbreak;\n+\t\tcase libcamera::properties::CameraLocationBack:\n+\t\t\tcameraLocation_->setText(\"Internal back camera\");\n+\t\t\tbreak;\n+\t\tcase libcamera::properties::CameraLocationExternal:\n+\t\t\tcameraLocation_->setText(\"External camera\");\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcameraLocation_->setText(\"Unknown\");\n+\t\t}\n+\t} else {\n+\t\tcameraLocation_->setText(\"Unknown\");\n+\t}\n+\n+\tconst auto &model = cameraProperties\n+\t\t\t\t    .get(libcamera::properties::Model)\n+\t\t\t\t    .value_or(\"Unknown\");\n+\n+\tcameraModel_->setText(QString::fromStdString(model));\n+}\ndiff --git a/src/qcam/cam_select_dialog.h b/src/qcam/cam_select_dialog.h\nindex 567083ae..359df811 100644\n--- a/src/qcam/cam_select_dialog.h\n+++ b/src/qcam/cam_select_dialog.h\n@@ -11,11 +11,14 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n+#include <libcamera/controls.h>\n+#include <libcamera/property_ids.h>\n \n #include <QComboBox>\n #include <QDialog>\n #include <QDialogButtonBox>\n #include <QFormLayout>\n+#include <QLabel>\n #include <QString>\n \n class CameraSelectorDialog : public QDialog\n@@ -33,9 +36,16 @@ public:\n \tvoid cameraAdded(libcamera::Camera *camera);\n \n \tvoid cameraRemoved(libcamera::Camera *camera);\n+\n+\t/* Camera Information */\n+\tvoid updateCamInfo(const std::shared_ptr<libcamera::Camera> &camera);\n+\tvoid handleCameraChange();\n+\n private:\n \tlibcamera::CameraManager *cm_;\n \n \t/* UI elements. */\n \tQComboBox *cameraIdComboBox_;\n+\tQLabel *cameraLocation_;\n+\tQLabel *cameraModel_;\n };\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "4/8"
    ]
}