Show a patch.

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

{
    "id": 16958,
    "url": "https://patchwork.libcamera.org/api/patches/16958/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16958/",
    "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": "<20220803175517.175332-4-utkarsh02t@gmail.com>",
    "date": "2022-08-03T17:55:16",
    "name": "[libcamera-devel,3/4] qcam: CameraSelectDialog: Display Location and Model propety of camera",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "65c0f9abd9e0a44956f61b230860614a4516a540",
    "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/16958/mbox/",
    "series": [
        {
            "id": 3370,
            "url": "https://patchwork.libcamera.org/api/series/3370/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3370",
            "date": "2022-08-03T17:55:13",
            "name": "Improve Camera Selection GUI in QCam",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3370/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16958/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16958/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 188ABC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 17:55:33 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C16EE63318;\n\tWed,  3 Aug 2022 19:55:32 +0200 (CEST)",
            "from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CF5663314\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 19:55:31 +0200 (CEST)",
            "by mail-pl1-x629.google.com with SMTP id v18so17067525plo.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 03 Aug 2022 10:55:31 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:d5b8:ad21:c99c:170f:1ae])\n\tby smtp.gmail.com with ESMTPSA id\n\tf3-20020a170902860300b0016357fd0fd1sm2193343plo.69.2022.08.03.10.55.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 03 Aug 2022 10:55:29 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659549332;\n\tbh=L5SUs8syTThpflIJmphIG1FYn8k+QjPN8wemRiOXVjg=;\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=A/y3NbFuwfQKWakEVWPttvaDMAxiNlVXIbFR43hA1/wUgf4CMc1bji5BxOwcQPm/r\n\t+zc8RTBzqZi7mx9SIyRjPVbKmhjKLfnaILyEr+T4KI+s5Eu0YN+DsHzxC/bLtudkmr\n\tWtnLbXKTnYxqHqTDYCqUlkx1qMTcTaiFFD6p3kO0PTBsHTuJ8Ccy0/vQp80z46K1pn\n\tcNhW4YOnRp+jZJUh8uMjUcLCkz1DJuGeluLrLYXOjTQrkx1ISduuCGrSerLn735xO3\n\t1ou3rH9DsxweTR2j5FVMBUBsBB+0N0QUBwXuqSDjjvN8k3/Tr99xgmQlOQJI9U9l5p\n\thHeaZUPq5z3+w==",
            "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=+AYKpewvBPvWpyDdvrjVaXbdLyr0CbHI6oebH/diOL4=;\n\tb=Ee6e85WIV7IJfjNWViDN7BbUMTU/AGsxfE+JL4OM1iOaWv51QMj96CfX6bt72ZQVJp\n\tTgz8FH5xRwiYFWbL0Nx/lKAPLbFuY49n4otymlHPpCE6Qd6WCZ/te0PTcQ8JHc9BxEKB\n\tDYVo5SqXpMDvzzAaGONfVrvxl4rti7BJGcncJCO2hfSMBO+ZzJ/lGMNBMuP+ZObd2PsO\n\tXKTXohS670lDJedzIVK9TNHp7deuTh10SVds0Gf0THpVq7TNXFa5Kx2ASimBhcHIiSME\n\tN4QVkfLtCo8NdYyLSDQTPs2jplEgBxOCPJuS0WWd6k1Q6KFNOqKQ2Epqfn0B34hni3HL\n\tpa+g=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Ee6e85WI\"; 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=+AYKpewvBPvWpyDdvrjVaXbdLyr0CbHI6oebH/diOL4=;\n\tb=6wV0A8DwiV65w3ipLqOt4TqoGQ4CAzkkZi6OkRdXZ5LBWK+pEG6RwOblP5Rsd/+TB/\n\tM58nJoTj9Q0akwNh4dIaeGebHha7WRxA4RjdiQvP/h5RD8qcyuIs125v4nHjNPaACtz0\n\tGz32W5QLoSlG9pAma2kNnbxD1C2cUYKPj4mqoYvKrchCbsCAHYZ5PSEkits3PaSF+KUR\n\tqKXFf1odSigtCBUQO7cLpIlf+vs+PdOREJdsgVevq58AYKp9Jn+qH1GGTKL4a3saZKHI\n\tVGZPiDCM6qBDKOy7/829yR7mTKNSzwHu4c/PyQHdKybV92Cj63IgQggaYTnfu7tKdF2U\n\tM5JQ==",
        "X-Gm-Message-State": "ACgBeo3gzulld8XbMOgsaudSM94L9v/2rdGoZtjne2Gdc72WyPYDDeiV\n\tS1gu/xHkG1s9C+MrrQXfRTVUdXhGSw4=",
        "X-Google-Smtp-Source": "AA6agR5GcKUrE7wJr5TyDqUj6K7NdwxjXBZEx6fCLOo6wSM/orF2fW+QtUpIfrTMHdX9qIKl0NQa2Q==",
        "X-Received": "by 2002:a17:902:cece:b0:16e:d4c3:5894 with SMTP id\n\td14-20020a170902cece00b0016ed4c35894mr19732219plg.154.1659549329482; \n\tWed, 03 Aug 2022 10:55:29 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  3 Aug 2022 23:25:16 +0530",
        "Message-Id": "<20220803175517.175332-4-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220803175517.175332-1-utkarsh02t@gmail.com>",
        "References": "<20220803175517.175332-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 3/4] qcam: CameraSelectDialog: 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---\n src/qcam/main_window.cpp | 69 ++++++++++++++++++++++++++++++++++++++++\n src/qcam/main_window.h   |  7 ++++\n 2 files changed, 76 insertions(+)",
    "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 80a73b68..81fa3e60 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -12,6 +12,7 @@\n #include <string>\n \n #include <libcamera/camera_manager.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/version.h>\n \n #include <QComboBox>\n@@ -23,6 +24,7 @@\n #include <QImage>\n #include <QImageWriter>\n #include <QInputDialog>\n+#include <QLabel>\n #include <QMutexLocker>\n #include <QStandardPaths>\n #include <QStringList>\n@@ -291,6 +293,47 @@ void MainWindow::switchCamera(int index)\n \tstartStopAction_->setChecked(true);\n }\n \n+QString MainWindow::getCameraLocation(const std::shared_ptr<Camera> &camera)\n+{\n+\tif (camera == nullptr)\n+\t\treturn QString();\n+\n+\tconst ControlList &cameraProperties = camera->properties();\n+\tconst auto &location = cameraProperties.get(properties::Location);\n+\n+\tif (location) {\n+\t\tswitch (*location) {\n+\t\tcase properties::CameraLocationFront:\n+\t\t\treturn \"Internal front camera \";\n+\t\tcase properties::CameraLocationBack:\n+\t\t\treturn \"Internal back camera \";\n+\t\tcase properties::CameraLocationExternal:\n+\t\t\treturn \"External camera \";\n+\t\t}\n+\t}\n+\treturn QString();\n+}\n+\n+QString MainWindow::getCameraModel(const std::shared_ptr<Camera> &camera)\n+{\n+\tif (camera == nullptr)\n+\t\treturn QString();\n+\n+\tconst ControlList &cameraProperties = camera->properties();\n+\tconst auto &model = cameraProperties.get(properties::Model);\n+\n+\tif (model)\n+\t\treturn QString::fromStdString(*model);\n+\n+\treturn QString();\n+}\n+\n+void MainWindow::updateCameraInfo(const std::shared_ptr<libcamera::Camera> &camera)\n+{\n+\tcameraLocation_->setText(getCameraLocation(camera));\n+\tcameraModel_->setText(getCameraModel(camera));\n+}\n+\n std::string MainWindow::chooseCamera()\n {\n \tstd::string result;\n@@ -303,6 +346,29 @@ std::string MainWindow::chooseCamera()\n \tfor (const std::shared_ptr<Camera> &cam : cm_->cameras())\n \t\tcameraIdComboBox_->addItem(QString::fromStdString(cam->id()));\n \n+\t/* Display Camera Informtion in the Selection Dialog. */\n+\tcameraLocation_ = new QLabel;\n+\tcameraModel_ = new QLabel;\n+\n+\tstd::shared_ptr<Camera> currentCamera;\n+\n+\t/*\n+\t * When the Qdialog starts, the QComboBox would have the first\n+\t * camera's Id as its currentText.\n+\t */\n+\tif (cm_->cameras().size())\n+\t\tcurrentCamera = cm_->cameras()[0];\n+\telse\n+\t\tcurrentCamera = nullptr;\n+\n+\tif (currentCamera)\n+\t\tupdateCameraInfo(currentCamera);\n+\n+\tconnect(cameraIdComboBox_, &QComboBox::currentTextChanged,\n+\t\tthis, [&]() {\n+\t\t\tupdateCameraInfo(cm_->get(cameraIdComboBox_->currentText().toStdString()));\n+\t\t});\n+\n \t/* Setup QDialogButtonBox. */\n \tQDialogButtonBox *dialogButtonBox = new QDialogButtonBox;\n \tdialogButtonBox->addButton(QDialogButtonBox::Cancel);\n@@ -323,6 +389,9 @@ std::string MainWindow::chooseCamera()\n \t/* Setup the layout for the dialog. */\n \tQFormLayout *cameraSelectLayout = new QFormLayout(cameraSelectDialog);\n \tcameraSelectLayout->addRow(\"Camera: \", cameraIdComboBox_);\n+\tcameraSelectLayout->addRow(\"Location: \", cameraLocation_);\n+\tcameraSelectLayout->addRow(\"Model: \", cameraModel_);\n+\n \tcameraSelectLayout->addWidget(dialogButtonBox);\n \n \tcameraSelectDialog->exec();\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex b8122eb9..3a1c6156 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -20,6 +20,7 @@\n \n #include <QElapsedTimer>\n #include <QIcon>\n+#include <QLabel>\n #include <QMainWindow>\n #include <QMutex>\n #include <QObject>\n@@ -88,6 +89,10 @@ private:\n \tvoid processHotplug(HotplugEvent *e);\n \tvoid processViewfinder(libcamera::FrameBuffer *buffer);\n \n+\tQString getCameraLocation(const std::shared_ptr<libcamera::Camera> &camera);\n+\tQString getCameraModel(const std::shared_ptr<libcamera::Camera> &camera);\n+\tvoid updateCameraInfo(const std::shared_ptr<libcamera::Camera> &camera);\n+\n \t/* UI elements */\n \tQToolBar *toolbar_;\n \tQAction *startStopAction_;\n@@ -102,6 +107,8 @@ private:\n \tQTimer titleTimer_;\n \n \tQPointer<QComboBox> cameraIdComboBox_;\n+\tQLabel *cameraLocation_;\n+\tQLabel *cameraModel_;\n \n \t/* Options */\n \tconst OptionsParser::Options &options_;\n",
    "prefixes": [
        "libcamera-devel",
        "3/4"
    ]
}