From patchwork Sun Aug 7 15:41:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17013 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A9B0BC3272 for ; Sun, 7 Aug 2022 15:41:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5D4AB6332B; Sun, 7 Aug 2022 17:41:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659886915; bh=yvl4Be1rDGPf//2TMwNf/uo1HTN3n1iBb/Xma4ZVIaU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=p9cbdcrfbtMaGMNalgn3JM5SpX5VkfUtf8M3P0yZaa8gBOkH0k8s6H0AasfxpVa6d ZuVBFt7HDBcY7aUtHGhJtzEaQZmIZvwaDQX8RJ1q+WNEx5GhSRJLo183Dplyc+ynts B4RKY/SS2AePTVi3a2J5piyWtqMvErmWVWW0g/urjP3QFwWAbAt/fqBE7FRhLql3tA H2Gqg9nG9VilcphfXEY52oVH803K3v9u/JryTeRekMlK30tcxapfixCollT9M5NAlo 4tm2bQ459+32FWGN/qCGpSPQdjCibe2bByVcmPk11tk/UUbuwMQvJhvVHG60nfx8eb VPr9WztNSQ1lA== Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 074DB63312 for ; Sun, 7 Aug 2022 17:41:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UdQrH7Jm"; dkim-atps=neutral Received: by mail-pj1-x1036.google.com with SMTP id pm17so6750513pjb.3 for ; Sun, 07 Aug 2022 08:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=lTHOLU79qXKIVDo134nYc49oQn/lIMGsg4pDKOK6Z3A=; b=UdQrH7Jm2zln4gfUbP9Bt+ZRgtYcuzxAru0Egchfjq3hiN/qOBs4t5AOvSpXiA9R/J shKWo1DVxCePXaiYSyHg56p6QBZqN+5ITHaCdOBktuxxyY5cx0wVulLcJ6K564TvU6+d kHfLP6SYdpFlF1pNNYMjOmkLga2MY6gwoVLgV1Hj0hDzTPAXagMFTBLhsTxRh66RSorv OgyAqYU4uWYjFXtklcXNHfND1uZsgDUGnVh7qDYQhpN+uM6ZXNloImZ2I6sGab/+ppmX bRgQgjSfrlWr6oSYFWFYRklOSp/067UlrfSLSNvjmecoiZQ6a5HIArdkSp+2zSs3xHoY xTpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=lTHOLU79qXKIVDo134nYc49oQn/lIMGsg4pDKOK6Z3A=; b=Eov/Ktz8+fp56tP2bQdvsvy0hmS+8JnpX5lurdMGiG2A/CgF2iMn2kDatCo3UC3uVg xCjx2/1nQl7bBDcs7nbP4n/fQd2tiuciAtqSLcZrSSmINAhd662ijMrmKE0qaZZ8BFkz BV5ikiZy9ON83pbvie/TG3OO08M6BdIceBS7qc987yB40NnLxQqyxh/zxCU7svGKcFGC jL8ecoahEXAspK8HeweI9zyotAkCJ714wjXSRBOkDsirK7z21uoBO6FyodEWfBXou1wG +1SN5L+EemaPItd++peyK+RzKMG+rB1ifI9F5zOu+oRWCWj+/IJ4R56lZjq+TBlucFpD RaEw== X-Gm-Message-State: ACgBeo1orsTSWZXhRv+8DlQ2OR7QM1h+sDV/+AcDRzQBaERGhiGGInrq M2FtnOOpJKNyl65e2WeBtzraJ6NWPeI= X-Google-Smtp-Source: AA6agR4hmGl+kWXWQBGnZMdK+a5mWPc+iIp1Oc6L4IitG2xYxYQ/y2SJpGuhd/V21c8Wv4dnUwB6CA== X-Received: by 2002:a17:902:cccf:b0:168:c4c3:e8ca with SMTP id z15-20020a170902cccf00b00168c4c3e8camr15354380ple.40.1659886904624; Sun, 07 Aug 2022 08:41:44 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:d9f0:4d1:f1a2:ade]) by smtp.gmail.com with ESMTPSA id u6-20020a17090341c600b0016be596c8afsm6751889ple.282.2022.08.07.08.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 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 Subject: [libcamera-devel] [PATCH v2.1 4/4] qcam: CamSelectDialog: Display Location and Model propety of camera X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The camera selection dialog currently only displays the camera Id. Display the camera location and camera model if available. Signed-off-by: Utkarsh Tiwari Reviewed-by: Kieran Bingham --- Difference from v2: Use getCameraId() instead of getCurrentCamera() src/qcam/cam_select_dialog.h | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/qcam/cam_select_dialog.h b/src/qcam/cam_select_dialog.h index ee65eb88..6ba61cff 100644 --- a/src/qcam/cam_select_dialog.h +++ b/src/qcam/cam_select_dialog.h @@ -12,11 +12,14 @@ #include #include +#include +#include #include #include #include #include +#include #include class CamSelectDialog : public QDialog @@ -34,6 +37,17 @@ public: for (const auto &cam : cm_->cameras()) cameraIdComboBox_->addItem(QString::fromStdString(cam->id())); + /* Set camera information labels. */ + cameraLocation_ = new QLabel; + cameraModel_ = new QLabel; + + updateCamInfo(cm_->get(getCameraId())); + connect(cameraIdComboBox_, &QComboBox::currentTextChanged, + this, [&]() { + updateCamInfo(cm_->get( + cameraIdComboBox_->currentText().toStdString())); + }); + /* Setup the QDialogButton Box */ QDialogButtonBox *dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | @@ -46,6 +60,8 @@ public: /* Set the layout. */ camSelectDialogLayout->addRow("Camera: ", cameraIdComboBox_); + camSelectDialogLayout->addRow("Location: ", cameraLocation_); + camSelectDialogLayout->addRow("Model: ", cameraModel_); camSelectDialogLayout->addWidget(dialogButtonBox); } @@ -70,9 +86,47 @@ public: cameraIdComboBox_->removeItem(cameraIndex); } + /* Camera Information */ + void updateCamInfo(const std::shared_ptr &camera) + { + if (camera == nullptr) + return; + + const libcamera::ControlList &cameraProperties = camera->properties(); + + const auto &location = + cameraProperties.get(libcamera::properties::Location); + if (location) { + switch (*location) { + case libcamera::properties::CameraLocationFront: + cameraLocation_->setText("Internal front camera "); + break; + case libcamera::properties::CameraLocationBack: + cameraLocation_->setText("Internal back camera "); + break; + case libcamera::properties::CameraLocationExternal: + cameraLocation_->setText("External camera "); + break; + default: + cameraLocation_->setText(QString()); + } + } else { + cameraLocation_->setText(QString()); + } + + const auto &model = cameraProperties.get(libcamera::properties::Model); + + if (model) + cameraModel_->setText(QString::fromStdString(*model)); + else + cameraModel_->setText(QString()); + } + private: libcamera::CameraManager *cm_; /* UI elements. */ QComboBox *cameraIdComboBox_; + QLabel *cameraLocation_; + QLabel *cameraModel_; };