From 84ad104499d9efc0253dae1a60ee070ed375ad95 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 20 Oct 2022 00:44:55 +0300 Subject: Move test applications to src/apps/ The cam and qcam test application share code, currently through a crude hack that references the cam source files directly from the qcam meson.build file. To prepare for the introduction of hosting that code in a static library, move all applications to src/apps/. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/qcam/cam_select_dialog.cpp | 111 ----------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 src/qcam/cam_select_dialog.cpp (limited to 'src/qcam/cam_select_dialog.cpp') diff --git a/src/qcam/cam_select_dialog.cpp b/src/qcam/cam_select_dialog.cpp deleted file mode 100644 index 3c8b12a9..00000000 --- a/src/qcam/cam_select_dialog.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2022, Utkarsh Tiwari - * - * cam_select_dialog.cpp - qcam - Camera Selection dialog - */ - -#include "cam_select_dialog.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include - -CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManager, - QWidget *parent) - : QDialog(parent), cm_(cameraManager) -{ - /* Use a QFormLayout for the dialog. */ - QFormLayout *layout = new QFormLayout(this); - - /* Setup the camera id combo-box. */ - cameraIdComboBox_ = new QComboBox; - for (const auto &cam : cm_->cameras()) - cameraIdComboBox_->addItem(QString::fromStdString(cam->id())); - - /* Set camera information labels. */ - cameraLocation_ = new QLabel; - cameraModel_ = new QLabel; - - updateCameraInfo(cameraIdComboBox_->currentText()); - connect(cameraIdComboBox_, &QComboBox::currentTextChanged, - this, &CameraSelectorDialog::updateCameraInfo); - - /* Setup the QDialogButton Box */ - QDialogButtonBox *buttonBox = - new QDialogButtonBox(QDialogButtonBox::Ok | - QDialogButtonBox::Cancel); - - connect(buttonBox, &QDialogButtonBox::accepted, - this, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, - this, &QDialog::reject); - - /* Set the layout. */ - layout->addRow("Camera:", cameraIdComboBox_); - layout->addRow("Location:", cameraLocation_); - layout->addRow("Model:", cameraModel_); - layout->addWidget(buttonBox); -} - -CameraSelectorDialog::~CameraSelectorDialog() = default; - -std::string CameraSelectorDialog::getCameraId() -{ - return cameraIdComboBox_->currentText().toStdString(); -} - -/* Hotplug / Unplug Support. */ -void CameraSelectorDialog::addCamera(QString cameraId) -{ - cameraIdComboBox_->addItem(cameraId); -} - -void CameraSelectorDialog::removeCamera(QString cameraId) -{ - int cameraIndex = cameraIdComboBox_->findText(cameraId); - cameraIdComboBox_->removeItem(cameraIndex); -} - -/* Camera Information */ -void CameraSelectorDialog::updateCameraInfo(QString cameraId) -{ - const std::shared_ptr &camera = - cm_->get(cameraId.toStdString()); - - if (!camera) - return; - - const libcamera::ControlList &properties = camera->properties(); - - const auto &location = properties.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("Unknown"); - } - } else { - cameraLocation_->setText("Unknown"); - } - - const auto &model = properties.get(libcamera::properties::Model) - .value_or("Unknown"); - - cameraModel_->setText(QString::fromStdString(model)); -} -- cgit v1.2.1