From patchwork Thu Apr 30 16:00: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: 3638 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 581B7613F3 for ; Thu, 30 Apr 2020 18:00:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="ugvLudgV"; 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=i3uAe5AXAlWJzvdmy8ks40Y2+ZFAQCdzYLxJH+4vc74=; b=ugvLudgV+lhYUQyhPDnKE1Xpjyn/WHwxgncZfOKjzV4EQDWq07uLYu+ErSRMXMjPiPyr 4+O5/3nsg0dugRfPeW0E5J1/OmywQ+NOm5Q/2aZ2+WxMEt9OTTw4XGamRGkCj8fxvf1bbF Ks1+eGGTKeHu/9whVpmvp36SVSsMUDfCM= Received: by filter0084p3las1.sendgrid.net with SMTP id filter0084p3las1-1974-5EAAF601-5B 2020-04-30 16:00:01.363742507 +0000 UTC m=+1274293.850613641 Received: from mail.uajain.com (unknown) by ismtpd0003p1maa1.sendgrid.net (SG) with ESMTP id CJeV-LQeTQuTgIr21OSOZQ Thu, 30 Apr 2020 16:00:00.870 +0000 (UTC) From: Umang Jain Date: Thu, 30 Apr 2020 16:00:01 +0000 (UTC) Message-Id: <20200430155946.15605-2-email@uajain.com> In-Reply-To: <20200430155946.15605-1-email@uajain.com> References: <20200430155946.15605-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc6PesGYbv37LpAT9IAi6gfXfncOY+tO4ZhcClrvriHNAxns0xSPQhYyYDfTz7h3cMiKa43IFQ1MR3DS8ou0CYbtK9w9qnQPKlLLjP/i53HuBp7FlBbxUXCEDMvzLtqXflXtHEqJgK8xTXWWDPLc24Bhqosbz2gI85E6gOF7BV3GRbFA8Y/lU1FWlZpUTMat9X To: libcamera-devel Subject: [libcamera-devel] [PATCH v2 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 16:00:03 -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 | 8 ++++---- src/qcam/main_window.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index d021fa9..c95d097 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -114,14 +114,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..4ec37d4 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -29,6 +29,7 @@ using namespace libcamera; class QAction; +class QComboBox; enum { OptCamera = 'c', @@ -72,6 +73,7 @@ private: /* UI elements */ QToolBar *toolbar_; QAction *startStopAction_; + QComboBox *cameraCombo_; ViewFinder *viewfinder_; QIcon iconPlay_; From patchwork Thu Apr 30 16:00:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3639 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 DFFB76142F for ; Thu, 30 Apr 2020 18:00:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="x7icnKYQ"; 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=to8kvyjFjtpe3sDVdwYz0UBV9lkbEl4iHzD8IrxyY9Y=; b=x7icnKYQ2MyGjeBMZ8rh1+AjsmytwfZuDikGixVqvPMJk2mr3MGAwGqi82OVCln09zip YseQuJt7D7qQGQfuA+Ptjj3m7Rh/+9uHZCwa+wLeSnYbCQDiZH8TubMtAEVxyQo6NAVPOD G9drr3G8uicnOKVai2wkRR3yBDOrdZQAM= Received: by filterdrecv-p3mdw1-6dbfd75bfd-mgvzk with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-mgvzk-19-5EAAF602-58 2020-04-30 16:00:02.494997608 +0000 UTC m=+3077565.900999360 Received: from mail.uajain.com (unknown) by ismtpd0005p1maa1.sendgrid.net (SG) with ESMTP id A1N_0a46RCuAs6l4F_j5qA Thu, 30 Apr 2020 16:00:02.187 +0000 (UTC) From: Umang Jain Date: Thu, 30 Apr 2020 16:00:02 +0000 (UTC) Message-Id: <20200430155946.15605-3-email@uajain.com> In-Reply-To: <20200430155946.15605-1-email@uajain.com> References: <20200430155946.15605-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcREc2X1LpIgLW8oEasGbeg0dNzyr1rvnGXqGeVMcKOlrsDeqL0dRJ9ge7fxuW99NHeUq/ByOGJ9OSpcW09XvGWlyBf/gEhNfe0sPDg5rLxy9HrSiLD2cn0KDbmVlHgvvg7hXAZQwVDig5s1bwHg36vH5Tq6I0fITjJzsGEn5SUnc0pz9YG+GjU/iNxJHXFM8cBputZ7yf8mmLXrUnXHaCCw== To: libcamera-devel Subject: [libcamera-devel] [PATCH v2 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 16:00: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 Reviewed-by: Laurent Pinchart Tested-by: Kieran Bingham --- src/qcam/main_window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index c95d097..3e92cd9 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -250,6 +250,9 @@ int MainWindow::openCamera() return -EBUSY; } + /* Set the combo-box entry with the currently selected Camera */ + cameraCombo_->setCurrentText(QString::fromStdString(cameraName)); + return 0; }