From patchwork Sat Aug 6 19:04:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16997 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 2B781BE173 for ; Sat, 6 Aug 2022 19:05:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CB6B363337; Sat, 6 Aug 2022 21:05:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659812701; bh=MyUpLSLEtM5kTr87vZBJ+qzN24xO8h0IJIlJOXFOTdE=; 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=yIucVNlDwzGR4k5/k8ta9i0TiQ1XZxDEOEoHpw/duMk7iE8RHno7zWQ1Dho3zouKy 4jXWdAKckdBsRGawt3hTtcIlEWJsyj2MU6WFItI6p0AxO014IHPnIJEsTOKEgC/0wd P45NrdcZyg0QyfmKcU1Ghopqq6R2S+jLKoXAjKSiDHR4usVqKq8mqViSjlIDhtgw6R eOhCckRLisVzXP3Qp2+543zGThNwmG9yvxM6L72CdAsVned+cIXlFKODRc2ddtkNjr 62Qoi4F0u2ezI7qZvbVw5dFg/BHbf/ZBl/JaSpMsdYNGK6ieMGHPA/ur3Pv+0MpuZ2 TNfLsBa3KvF4w== Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A70A163330 for ; Sat, 6 Aug 2022 21:04:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MOITIItx"; dkim-atps=neutral Received: by mail-pf1-x434.google.com with SMTP id f28so4945857pfk.1 for ; Sat, 06 Aug 2022 12:04:59 -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=YrgsQJ2JjVrN6lqcP3OJCWFTFg1HvBD3vVFd1HXpkVk=; b=MOITIItxBzjS5VFUdHHyq+BvcKcuuQKpGo3barI6Ah+4KayxVoPeh+FzG2zBdPKAUA m5ENr1pEFEOV/NNmaS2ft8cXAIhzZAcP5NnKde86pImOKpap6WNQBNSjgSswNsfxVE3t rQ5t6cYvxocbp8vD6cBnb3myM/Cqv/KjdlurBjWL7rRNieMeTG2i10MswFsFoRwg+qn8 4ini34u7A2oyp3nXH76pYFeTqSSQfRSV0kLRNOhqwDMWltICDFZlTpzlalXTB/yEZvnH PGPGDklIzmUTrQ2q5PwA9Y9vz+GlHMHs6yONwVNNKSzFC/+Ylj93PbRUQRUPx53qMn49 LP4w== 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=YrgsQJ2JjVrN6lqcP3OJCWFTFg1HvBD3vVFd1HXpkVk=; b=QhjeCJ+j2VlJWXznj0dG9Kxay/nfJT8rVjKOEiuW1vG47ajCnzlOo3iPy/7xvxLegO Upc5JN21oU8XxXJOZ5X7++2f/cMeHdxLXeaAfaaDiPZXiOc77Kb24l2aF8Zb1wbeqcp5 qq1WkPAGgLEpyu9EvQXXzNc0H27DF2APpfrqWJwXi/9jBKsZmYrFjU0KB5dVin0EGwX+ odY2esJrrcBsgRKL/MOS8f2JnFvsXPEnMZd82Cv6dLOMogD1qh9WdlhE4WLgl9MEXuPD agZkuhf2GKlJAMqD+Hju/MxfVOkIzlw70mVmcwLc7zyZq6r1ohpdHsyusj+qrJT2XJaN CmsQ== X-Gm-Message-State: ACgBeo0ExOo5wEjKncUdo1ectmSapOlOyma5wPq29UVRyui3/+t5RRj4 0EsaJFnW75rDlM13gUD2z+M73Tpf/8A= X-Google-Smtp-Source: AA6agR74dMUBdjdPIsxP8R3GJ99RbTxnMNJyEiPwQMzksxToP4kxf0uyhZ9kgro6mtziD1RID7ewow== X-Received: by 2002:a63:2254:0:b0:41c:4b26:863d with SMTP id t20-20020a632254000000b0041c4b26863dmr10045659pgm.4.1659812697933; Sat, 06 Aug 2022 12:04:57 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:daa9:adf3:a099:1bff:e55]) by smtp.gmail.com with ESMTPSA id z17-20020aa79911000000b0052f20d70845sm406025pff.150.2022.08.06.12.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Aug 2022 12:04:57 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sun, 7 Aug 2022 00:34:33 +0530 Message-Id: <20220806190433.59128-5-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220806190433.59128-1-utkarsh02t@gmail.com> References: <20220806190433.59128-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- 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 a5189ec3..0200d374 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(getCurrentCamera())); + 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); } @@ -75,9 +91,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_; };