summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.cpp
diff options
context:
space:
mode:
authorUtkarsh Tiwari <utkarsh02t@gmail.com>2022-08-07 00:34:31 +0530
committerUtkarsh Tiwari <utkarsh02t@gmail.com>2022-09-05 12:12:02 +0530
commit923927ae45dd10be5c3c854d568dae6751ccb87e (patch)
tree343d8b15a514ade7ff5734c480f6d9d64a37f933 /src/qcam/main_window.cpp
parentf03da23b56bed065dace3cf3e7bf027f700e1085 (diff)
qcam: Support Hotplug for Camera Selection Dialog
Currently if there is HotPlug event when the user is on the Camera selection dialog, the QComboBox doesn't update to reflect the change. Add support for hotplugging / unplugging cameras. Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r--src/qcam/main_window.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 3bddb1f1..385b0059 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -594,10 +594,12 @@ void MainWindow::stopCapture()
void MainWindow::processHotplug(HotplugEvent *e)
{
Camera *camera = e->camera();
+ QString cameraId = QString::fromStdString(camera->id());
HotplugEvent::PlugEvent event = e->hotplugEvent();
if (event == HotplugEvent::HotPlug) {
- cameraCombo_->addItem(QString::fromStdString(camera->id()));
+ cameraCombo_->addItem(cameraId);
+ cameraSelectorDialog_->addCamera(cameraId);
} else if (event == HotplugEvent::HotUnplug) {
/* Check if the currently-streaming camera is removed. */
if (camera == camera_.get()) {
@@ -607,8 +609,9 @@ void MainWindow::processHotplug(HotplugEvent *e)
cameraCombo_->setCurrentIndex(0);
}
- int camIndex = cameraCombo_->findText(QString::fromStdString(camera->id()));
+ int camIndex = cameraCombo_->findText(cameraId);
cameraCombo_->removeItem(camIndex);
+ cameraSelectorDialog_->removeCamera(cameraId);
}
}