{"id":17013,"url":"https://patchwork.libcamera.org/api/patches/17013/?format=json","web_url":"https://patchwork.libcamera.org/patch/17013/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220807154138.91960-1-utkarsh02t@gmail.com>","date":"2022-08-07T15:41:38","name":"[libcamera-devel,v2.1,4/4] qcam: CamSelectDialog: Display Location and Model propety of camera","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d02fae8b824a99793f12f231e4b0faac9e930426","submitter":{"id":114,"url":"https://patchwork.libcamera.org/api/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17013/mbox/","series":[{"id":3383,"url":"https://patchwork.libcamera.org/api/series/3383/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3383","date":"2022-08-07T15:40:02","name":null,"version":1,"mbox":"https://patchwork.libcamera.org/series/3383/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17013/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17013/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 A9B0BC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  7 Aug 2022 15:41:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5D4AB6332B;\n\tSun,  7 Aug 2022 17:41:55 +0200 (CEST)","from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com\n\t[IPv6:2607:f8b0:4864:20::1036])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 074DB63312\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  7 Aug 2022 17:41:54 +0200 (CEST)","by mail-pj1-x1036.google.com with SMTP id pm17so6750513pjb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 07 Aug 2022 08:41:53 -0700 (PDT)","from localhost.localdomain ([2404:bd00:3:d2bc:d9f0:4d1:f1a2:ade])\n\tby smtp.gmail.com with ESMTPSA id\n\tu6-20020a17090341c600b0016be596c8afsm6751889ple.282.2022.08.07.08.41.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 07 Aug 2022 08:41:44 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659886915;\n\tbh=yvl4Be1rDGPf//2TMwNf/uo1HTN3n1iBb/Xma4ZVIaU=;\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=p9cbdcrfbtMaGMNalgn3JM5SpX5VkfUtf8M3P0yZaa8gBOkH0k8s6H0AasfxpVa6d\n\tZuVBFt7HDBcY7aUtHGhJtzEaQZmIZvwaDQX8RJ1q+WNEx5GhSRJLo183Dplyc+ynts\n\tB4RKY/SS2AePTVi3a2J5piyWtqMvErmWVWW0g/urjP3QFwWAbAt/fqBE7FRhLql3tA\n\tH2Gqg9nG9VilcphfXEY52oVH803K3v9u/JryTeRekMlK30tcxapfixCollT9M5NAlo\n\t4tm2bQ459+32FWGN/qCGpSPQdjCibe2bByVcmPk11tk/UUbuwMQvJhvVHG60nfx8eb\n\tVPr9WztNSQ1lA==","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=lTHOLU79qXKIVDo134nYc49oQn/lIMGsg4pDKOK6Z3A=;\n\tb=UdQrH7Jm2zln4gfUbP9Bt+ZRgtYcuzxAru0Egchfjq3hiN/qOBs4t5AOvSpXiA9R/J\n\tshKWo1DVxCePXaiYSyHg56p6QBZqN+5ITHaCdOBktuxxyY5cx0wVulLcJ6K564TvU6+d\n\tkHfLP6SYdpFlF1pNNYMjOmkLga2MY6gwoVLgV1Hj0hDzTPAXagMFTBLhsTxRh66RSorv\n\tOgyAqYU4uWYjFXtklcXNHfND1uZsgDUGnVh7qDYQhpN+uM6ZXNloImZ2I6sGab/+ppmX\n\tbRgQgjSfrlWr6oSYFWFYRklOSp/067UlrfSLSNvjmecoiZQ6a5HIArdkSp+2zSs3xHoY\n\txTpw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UdQrH7Jm\"; 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=lTHOLU79qXKIVDo134nYc49oQn/lIMGsg4pDKOK6Z3A=;\n\tb=Eov/Ktz8+fp56tP2bQdvsvy0hmS+8JnpX5lurdMGiG2A/CgF2iMn2kDatCo3UC3uVg\n\txCjx2/1nQl7bBDcs7nbP4n/fQd2tiuciAtqSLcZrSSmINAhd662ijMrmKE0qaZZ8BFkz\n\tBV5ikiZy9ON83pbvie/TG3OO08M6BdIceBS7qc987yB40NnLxQqyxh/zxCU7svGKcFGC\n\tjL8ecoahEXAspK8HeweI9zyotAkCJ714wjXSRBOkDsirK7z21uoBO6FyodEWfBXou1wG\n\t+1SN5L+EemaPItd++peyK+RzKMG+rB1ifI9F5zOu+oRWCWj+/IJ4R56lZjq+TBlucFpD\n\tRaEw==","X-Gm-Message-State":"ACgBeo1orsTSWZXhRv+8DlQ2OR7QM1h+sDV/+AcDRzQBaERGhiGGInrq\n\tM2FtnOOpJKNyl65e2WeBtzraJ6NWPeI=","X-Google-Smtp-Source":"AA6agR4hmGl+kWXWQBGnZMdK+a5mWPc+iIp1Oc6L4IitG2xYxYQ/y2SJpGuhd/V21c8Wv4dnUwB6CA==","X-Received":"by 2002:a17:902:cccf:b0:168:c4c3:e8ca with SMTP id\n\tz15-20020a170902cccf00b00168c4c3e8camr15354380ple.40.1659886904624; \n\tSun, 07 Aug 2022 08:41:44 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  7 Aug 2022 21:11:38 +0530","Message-Id":"<20220807154138.91960-1-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220806190433.59128-5-utkarsh02t@gmail.com>","References":"<20220806190433.59128-5-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2.1 4/4] 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 v2:\n\tUse getCameraId() instead of getCurrentCamera()\n src/qcam/cam_select_dialog.h | 54 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 54 insertions(+)","diff":"diff --git a/src/qcam/cam_select_dialog.h b/src/qcam/cam_select_dialog.h\nindex ee65eb88..6ba61cff 100644\n--- a/src/qcam/cam_select_dialog.h\n+++ b/src/qcam/cam_select_dialog.h\n@@ -12,11 +12,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 CamSelectDialog : public QDialog\n@@ -34,6 +37,17 @@ public:\n \t\tfor (const auto &cam : cm_->cameras())\n \t\t\tcameraIdComboBox_->addItem(QString::fromStdString(cam->id()));\n \n+\t\t/* Set camera information labels. */\n+\t\tcameraLocation_ = new QLabel;\n+\t\tcameraModel_ = new QLabel;\n+\n+\t\tupdateCamInfo(cm_->get(getCameraId()));\n+\t\tconnect(cameraIdComboBox_, &QComboBox::currentTextChanged,\n+\t\t\tthis, [&]() {\n+\t\t\t\tupdateCamInfo(cm_->get(\n+\t\t\t\t\tcameraIdComboBox_->currentText().toStdString()));\n+\t\t\t});\n+\n \t\t/* Setup the QDialogButton Box */\n \t\tQDialogButtonBox *dialogButtonBox =\n \t\t\tnew QDialogButtonBox(QDialogButtonBox::Ok |\n@@ -46,6 +60,8 @@ public:\n \n \t\t/* Set the layout. */\n \t\tcamSelectDialogLayout->addRow(\"Camera: \", cameraIdComboBox_);\n+\t\tcamSelectDialogLayout->addRow(\"Location: \", cameraLocation_);\n+\t\tcamSelectDialogLayout->addRow(\"Model: \", cameraModel_);\n \t\tcamSelectDialogLayout->addWidget(dialogButtonBox);\n \t}\n \n@@ -70,9 +86,47 @@ public:\n \t\tcameraIdComboBox_->removeItem(cameraIndex);\n \t}\n \n+\t/* Camera Information */\n+\tvoid updateCamInfo(const std::shared_ptr<libcamera::Camera> &camera)\n+\t{\n+\t\tif (camera == nullptr)\n+\t\t\treturn;\n+\n+\t\tconst libcamera::ControlList &cameraProperties = camera->properties();\n+\n+\t\tconst auto &location =\n+\t\t\tcameraProperties.get(libcamera::properties::Location);\n+\t\tif (location) {\n+\t\t\tswitch (*location) {\n+\t\t\tcase libcamera::properties::CameraLocationFront:\n+\t\t\t\tcameraLocation_->setText(\"Internal front camera \");\n+\t\t\t\tbreak;\n+\t\t\tcase libcamera::properties::CameraLocationBack:\n+\t\t\t\tcameraLocation_->setText(\"Internal back camera \");\n+\t\t\t\tbreak;\n+\t\t\tcase libcamera::properties::CameraLocationExternal:\n+\t\t\t\tcameraLocation_->setText(\"External camera \");\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\tcameraLocation_->setText(QString());\n+\t\t\t}\n+\t\t} else {\n+\t\t\tcameraLocation_->setText(QString());\n+\t\t}\n+\n+\t\tconst auto &model = cameraProperties.get(libcamera::properties::Model);\n+\n+\t\tif (model)\n+\t\t\tcameraModel_->setText(QString::fromStdString(*model));\n+\t\telse\n+\t\t\tcameraModel_->setText(QString());\n+\t}\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","v2.1","4/4"]}