qcam: Automatically select the camera if only one is available
When only a single camera is available, showing the camera selection dialog is unnecessary. It's better to automatically select the available camera without prompting the user for input. Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
12b553d691
commit
80a7ccd3ad
1 changed files with 11 additions and 5 deletions
|
@ -298,13 +298,19 @@ int MainWindow::openCamera()
|
|||
std::string cameraName;
|
||||
|
||||
/*
|
||||
* Use the camera specified on the command line, if any, or display the
|
||||
* camera selection dialog box otherwise.
|
||||
* If a camera is specified on the command line, get it. Otherwise, if
|
||||
* only one camera is available, pick it automatically, else, display
|
||||
* the selector dialog box.
|
||||
*/
|
||||
if (options_.isSet(OptCamera))
|
||||
if (options_.isSet(OptCamera)) {
|
||||
cameraName = static_cast<std::string>(options_[OptCamera]);
|
||||
else
|
||||
cameraName = chooseCamera();
|
||||
} else {
|
||||
std::vector<std::shared_ptr<Camera>> cameras = cm_->cameras();
|
||||
if (cameras.size() == 1)
|
||||
cameraName = cameras[0]->id();
|
||||
else
|
||||
cameraName = chooseCamera();
|
||||
}
|
||||
|
||||
if (cameraName == "")
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue