[libcamera-devel,v2,1/2] qcam: main_window: Make cameraCombo_ private

Message ID 20200430155946.15605-2-email@uajain.com
State Accepted
Headers show
Series
  • Fix combo-box entry selection on startup
Related show

Commit Message

Umang Jain April 30, 2020, 4 p.m. UTC
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 <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/qcam/main_window.cpp | 8 ++++----
 src/qcam/main_window.h   | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

Patch

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<int>::of(&QComboBox::activated),
+	cameraCombo_ = new QComboBox();
+	connect(cameraCombo_, QOverload<int>::of(&QComboBox::activated),
 		this, &MainWindow::switchCamera);
 
 	for (const std::shared_ptr<Camera> &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_;