Show a patch.

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

{
    "id": 17268,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17268/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17268/",
    "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": "<20220831054938.21617-5-utkarsh02t@gmail.com>",
    "date": "2022-08-31T05:49:35",
    "name": "[libcamera-devel,v9,4/7] qcam: CamSelectDialog: Display Location and Model propety of camera",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "fd752e1cfb734a9c44a807ad536f8c68f79735ad",
    "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/17268/mbox/",
    "series": [
        {
            "id": 3457,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3457/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3457",
            "date": "2022-08-31T05:49:31",
            "name": "Introduce capture scripts to qcam",
            "version": 9,
            "mbox": "https://patchwork.libcamera.org/series/3457/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17268/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17268/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 CAE51C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 31 Aug 2022 05:50:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A48261FC4;\n\tWed, 31 Aug 2022 07:50:04 +0200 (CEST)",
            "from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n\t[IPv6:2607:f8b0:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B9AF361F9B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Aug 2022 07:50:02 +0200 (CEST)",
            "by mail-pl1-x633.google.com with SMTP id m2so13195304pls.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Aug 2022 22:50:02 -0700 (PDT)",
            "from devut-HP-Laptop-14q-cs0xxx.. ([103.36.82.122])\n\tby smtp.gmail.com with ESMTPSA id\n\tq19-20020aa79833000000b00537eacc8fa6sm8307333pfl.40.2022.08.30.22.49.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 30 Aug 2022 22:50:00 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661925004;\n\tbh=YvZ727gfLjtvWMXWh3ahMRI3I+UkZdTkjnh9L2o62rk=;\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=XNeUVGyZv5JyIq9UYg1rLkmsqTMSvI/QE3CrUj0VE5/jYFXzeNp07Rt7ckwPDjEn6\n\tXWQC2U3YHOtMWOQ/d3h4WwiHkBJXtqxygeoQnb9raBDY0z+fXyJJl74AsqwlmVXxkE\n\teY9lm8W75xZp+dFo7E/Uib3sz04ezC85zAkiOc+nYveuylCenOWmpqYyvwYPr6T1B7\n\tTQRyHaqZcKHFhaAnFOw7cbMqsCwHZ9QcjYCadPrJRIAo08WidULR5//9iwFJThD3u/\n\tcz+bIxDyl+Ij4A0URi49sQp6BuI2mMQcGq7U+UgU/Coj1u8v8YNQol/xqPy5cQ6W69\n\tNjUy2WkdXgn+Q==",
            "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=bstUSyjs2LmOJ8SXsae32HU48ED7P1q8tMxr+a1QFf8=;\n\tb=dfGPshDHE+0Mnfr2kpmhDfUXZhs6g4ZF7g1Mn5kxnGx+YUDrfpOlzsul6vtyOnRs7t\n\tjFhUeCMaf9RJWEtVtumJEzROeV9HRME04DjBlgJDsqemTS6Xe3yM8d6RPJKY+6yCptA2\n\tseECuWbVShHh0i9YlaE307tiCmq0Yk/AH9Xr0AVb0Wiw5V7RXZtISdlWPLXxtcR32t2r\n\t0WnX0YXUz4DW2gfav3Wyy3gM+4A3bcO/Kp8cMMM1t+6Ko9rBtzNYHAZYZJIknqCsibO+\n\t9h6e0ZafgnT6nVqacrTWT36g88pkpcnMbNNiTB/UCb09BqzbKQnThyUDQr/qwZOBTlj9\n\tj9tA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"dfGPshDH\"; 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=bstUSyjs2LmOJ8SXsae32HU48ED7P1q8tMxr+a1QFf8=;\n\tb=ndaU+hZfnz5nHytTH542Zr6MyZzegebPNK92YavhvYPKsLzHMx1jOwMcAXLV1sGv3s\n\ttoOp6CaGIrcVbCZtfeCflo9LlyOCe3TFvWSDjsH/oVz6rp98hA/r2PdphSAXtPXI/EGd\n\tI0GyLuh4DVxqcyQFuRgflVZuAeiyPkwVNiKOnFIA1rXJC2gagaBCVlPJF8umZOtda/EG\n\tV4PMdx0mTu/q9puMlvVyK8JT4TlGn03FlivKaKLNPRQnV76lAK/jPvlSQUEzBHWSshQw\n\t2gwzufj0Zy9F811nxpBgZno5Wn6EBFzxWcVYTIem+Lb7GuRm2se+tDP5Ik9Kn7AgzqI2\n\tzo0g==",
        "X-Gm-Message-State": "ACgBeo2IeHmLHNgfjXcsCu80alkjX+25KfFCU76yngQIthDwKvlPvZW2\n\tl2TcytyOJ2pQxte9WOLi1tkpFIiIUIc=",
        "X-Google-Smtp-Source": "AA6agR60BCjwOWDsNOYdQfS0BecQVoO1+ilocqWrB2gi1HOTvlMuJOtbCJ0GuGcrtGdEyqVCrE3uOQ==",
        "X-Received": "by 2002:a17:902:e552:b0:16d:d3c0:85fb with SMTP id\n\tn18-20020a170902e55200b0016dd3c085fbmr23655018plf.38.1661925001180; \n\tTue, 30 Aug 2022 22:50:01 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 31 Aug 2022 11:19:35 +0530",
        "Message-Id": "<20220831054938.21617-5-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220831054938.21617-1-utkarsh02t@gmail.com>",
        "References": "<20220831054938.21617-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v9 4/7] 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>\n---\nDifference from v9:\n    1. Remove handleCameraChange and use updateCamInfo directly\n    2. QLabel forward-declare\n    3. Rename cameraProperties to just properties\n src/qcam/cam_select_dialog.cpp | 50 ++++++++++++++++++++++++++++++++++\n src/qcam/cam_select_dialog.h   |  8 ++++++\n 2 files changed, 58 insertions(+)",
    "diff": "diff --git a/src/qcam/cam_select_dialog.cpp b/src/qcam/cam_select_dialog.cpp\nindex f82930cc..6543228a 100644\n--- a/src/qcam/cam_select_dialog.cpp\n+++ b/src/qcam/cam_select_dialog.cpp\n@@ -7,12 +7,15 @@\n \n #include \"cam_select_dialog.h\"\n \n+#include <memory>\n+\n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n \n #include <QComboBox>\n #include <QDialogButtonBox>\n #include <QFormLayout>\n+#include <QLabel>\n #include <QString>\n \n CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManager,\n@@ -27,6 +30,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+\tupdateCamInfo(cameraIdComboBox_->currentText());\n+\tconnect(cameraIdComboBox_, &QComboBox::currentTextChanged,\n+\t\tthis, &CameraSelectorDialog::updateCamInfo);\n+\n \t/* Setup the QDialogButton Box */\n \tQDialogButtonBox *buttonBox =\n \t\tnew QDialogButtonBox(QDialogButtonBox::Ok |\n@@ -39,6 +50,8 @@ CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManag\n \n \t/* Set the layout. */\n \tlayout->addRow(\"Camera:\", cameraIdComboBox_);\n+\tlayout->addRow(\"Location:\", cameraLocation_);\n+\tlayout->addRow(\"Model:\", cameraModel_);\n \tlayout->addWidget(buttonBox);\n }\n \n@@ -60,3 +73,40 @@ void CameraSelectorDialog::removeCamera(QString cameraId)\n \tint cameraIndex = cameraIdComboBox_->findText(cameraId);\n \tcameraIdComboBox_->removeItem(cameraIndex);\n }\n+\n+/* Camera Information */\n+void CameraSelectorDialog::updateCamInfo(QString cameraId)\n+{\n+\tconst std::shared_ptr<libcamera::Camera> &camera =\n+\t\tcm_->get(cameraId.toStdString());\n+\n+\tif (!camera)\n+\t\treturn;\n+\n+\tconst libcamera::ControlList &properties = camera->properties();\n+\n+\tconst auto &location = properties.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 = properties\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 bd2dbc1e..c91b7ebe 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 <QDialog>\n #include <QString>\n \n class QComboBox;\n+class QLabel;\n \n class CameraSelectorDialog : public QDialog\n {\n@@ -32,9 +35,14 @@ public:\n \tvoid addCamera(QString cameraId);\n \tvoid removeCamera(QString cameraId);\n \n+\t/* Camera Information */\n+\tvoid updateCamInfo(QString cameraId);\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",
        "v9",
        "4/7"
    ]
}