From patchwork Thu Apr 30 14:15:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3634 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD43E613F4 for ; Thu, 30 Apr 2020 16:15:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="oX6j8eHE"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=fcGHvtiKkcH+1hWtGe6A9fNmiLJKXhQA3S/q+ATkGG4=; b=oX6j8eHEApGPfUQlybMmS951xId0wts2/YggZgKq/5R873Jxrn7E8pQbqgMm+mGrwlXn Ns/llRaRD1NcXZe4gON+BK+6n66cZsYyOse0iA3XlaI+Hhq9bsPK2+HRvoVciFN+dq/X/r rgZTVQ4aDj0XQUQe0lDk3grqp9Zha3OuU= Received: by filterdrecv-p3mdw1-6dbfd75bfd-s4r2z with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-s4r2z-18-5EAADD65-17 2020-04-30 14:15:01.37816804 +0000 UTC m=+3071257.358681003 Received: from mail.uajain.com (unknown) by ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP id KDpipkqITA21P0cOAW0Kfg for ; Thu, 30 Apr 2020 14:15:00.982 +0000 (UTC) From: Umang Jain Date: Thu, 30 Apr 2020 14:15:01 +0000 (UTC) Message-Id: <20200430141433.6776-2-email@uajain.com> In-Reply-To: <20200430141433.6776-1-email@uajain.com> References: <20200430141433.6776-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcclL1jEi7n/kJwGMQDXxjoXcmppJDacV3imlgOtTm+65kfEqbc3cuGP78AIE/CnR/bpC+zvJ+TFueE0u0CgO/XOBXytApa7iT4lIo/6sr5cv64skmIrCw8O/Q/VoIjTa5L0XBccWCvPfgs+OqlRr4hWNYhx09O+WsP/0Ls5BW8mWqMqMHtMbC83gIciBxPIfjkNF6F6qkjrpGCWkuwrJ2HA== To: libcamera-devel Subject: [libcamera-devel] [PATCH 1/2] qcam: main_window: Make cameraCombo_ private 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-List-Received-Date: Thu, 30 Apr 2020 14:15:04 -0000 This commit introduces no functional changes. This is required so that the combo-box list can be managed conveniently from various private functions in subsequent commit. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 9 ++++----- src/qcam/main_window.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index d021fa9..344b7ec 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -114,14 +113,14 @@ int MainWindow::createToolbars() connect(action, &QAction::triggered, this, &MainWindow::quit); /* Camera selector. */ - QComboBox *cameraCombo = new QComboBox(); - connect(cameraCombo, QOverload::of(&QComboBox::activated), + cameraCombo_ = new QComboBox(); + connect(cameraCombo_, QOverload::of(&QComboBox::activated), this, &MainWindow::switchCamera); for (const std::shared_ptr &cam : cm_->cameras()) - cameraCombo->addItem(QString::fromStdString(cam->name())); + cameraCombo_->addItem(QString::fromStdString(cam->name())); - toolbar_->addWidget(cameraCombo); + toolbar_->addWidget(cameraCombo_); toolbar_->addSeparator(); diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 5d6251c..28c325f 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -9,6 +9,7 @@ #include +#include #include #include #include @@ -72,6 +73,7 @@ private: /* UI elements */ QToolBar *toolbar_; QAction *startStopAction_; + QComboBox *cameraCombo_; ViewFinder *viewfinder_; QIcon iconPlay_; From patchwork Thu Apr 30 14:15:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3636 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 684F6613A8 for ; Thu, 30 Apr 2020 16:15:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="rysNYrIo"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=FtAbM7tPdRfk8tBnyld8JAFpnNrdycaCsvCkipGAJHs=; b=rysNYrIoW4uuns1srXTyrJT3K7McFvJ9nwB/v9WT2mo8+P4UJvBe6+PXKELByqznPFGh hIfa5lOkoouIFuAcImWa2fOw9od1jmaDfq4Yi9ZMJV+quQNzPVz9iN+Rz6DfSbwsomkiaV fcDW+wyDiDhflrvJHV37y6FoLpPzoRoI0= Received: by filterdrecv-p3mdw1-6dbfd75bfd-br5mk with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-br5mk-18-5EAADD66-A2 2020-04-30 14:15:03.065126942 +0000 UTC m=+3071266.835650499 Received: from mail.uajain.com (unknown) by ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP id Pp9dRUh0QcOxYg-UaGD9Ew for ; Thu, 30 Apr 2020 14:15:02.678 +0000 (UTC) From: Umang Jain Date: Thu, 30 Apr 2020 14:15:03 +0000 (UTC) Message-Id: <20200430141433.6776-3-email@uajain.com> In-Reply-To: <20200430141433.6776-1-email@uajain.com> References: <20200430141433.6776-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcYDswUgqLHty1lirORaEntZ5ZX+Stb2wq2TPNefJ8c+oSaNspsExquBCZZyXPaqOWYS2+egyEWSXCEhUf+TT+PVOhAwasICA/wuzrTsqfv6ZwXC/EBEjpnTAy1BVPLQfB0AG9BxQ+qaNBTg0mmbn1+ckikfO56QWuqbtSfgukWY4OM52SpAdanGYBIQlPVnBnyJ8kvXI7EI6MiyQ+igU3iA== To: libcamera-devel Subject: [libcamera-devel] [PATCH 2/2] qcam: main_window: Fix combo-box entry selection on startup 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-List-Received-Date: Thu, 30 Apr 2020 14:15:04 -0000 When one of the camera is selected and opened from the "Select Cameras" items list, the entry of the combo-box in the main-window doesn't update its item index to reflect the camera which was earlier selected. Fix that. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 344b7ec..fa05515 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -249,6 +249,10 @@ int MainWindow::openCamera() return -EBUSY; } + /* Set the combo-box with the current selected Camera */ + int camIndex = cameraCombo_->findText(QString::fromStdString(cameraName)); + cameraCombo_->setCurrentIndex(camIndex); + return 0; }