[libcamera-devel,2/6] qcam: Expose quit method for MainWindow

Message ID 20200206150504.24204-3-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • qcam: Provide an initial toolbar
Related show

Commit Message

Kieran Bingham Feb. 6, 2020, 3:05 p.m. UTC
Provide a method to facilitate clean shutdowns.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/qcam/main_window.cpp | 9 +++++++--
 src/qcam/main_window.h   | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Feb. 6, 2020, 10:06 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Thu, Feb 06, 2020 at 03:05:00PM +0000, Kieran Bingham wrote:
> Provide a method to facilitate clean shutdowns.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Provided this is useful in a subsequent patch,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

But I think you can squash it with the patch that uses it.

> ---
>  src/qcam/main_window.cpp | 9 +++++++--
>  src/qcam/main_window.h   | 1 +
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index 38bc04a23b86..b51a16de199d 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -41,8 +41,7 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)
>  	}
>  
>  	if (ret < 0)
> -		QTimer::singleShot(0, QCoreApplication::instance(),
> -				   &QCoreApplication::quit);
> +		quit();
>  }
>  
>  MainWindow::~MainWindow()
> @@ -54,6 +53,12 @@ MainWindow::~MainWindow()
>  	}
>  }
>  
> +void MainWindow::quit()
> +{
> +	QTimer::singleShot(0, QCoreApplication::instance(),
> +			   &QCoreApplication::quit);
> +}
> +
>  void MainWindow::updateTitle()
>  {
>  	unsigned int duration = frameRateInterval_.elapsed();
> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
> index 04fb9e3ea869..a11443b30b37 100644
> --- a/src/qcam/main_window.h
> +++ b/src/qcam/main_window.h
> @@ -41,6 +41,7 @@ public:
>  	~MainWindow();
>  
>  private Q_SLOTS:
> +	void quit();
>  	void updateTitle();
>  
>  private:
> -- 
> 2.20.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index 38bc04a23b86..b51a16de199d 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -41,8 +41,7 @@  MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)
 	}
 
 	if (ret < 0)
-		QTimer::singleShot(0, QCoreApplication::instance(),
-				   &QCoreApplication::quit);
+		quit();
 }
 
 MainWindow::~MainWindow()
@@ -54,6 +53,12 @@  MainWindow::~MainWindow()
 	}
 }
 
+void MainWindow::quit()
+{
+	QTimer::singleShot(0, QCoreApplication::instance(),
+			   &QCoreApplication::quit);
+}
+
 void MainWindow::updateTitle()
 {
 	unsigned int duration = frameRateInterval_.elapsed();
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 04fb9e3ea869..a11443b30b37 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -41,6 +41,7 @@  public:
 	~MainWindow();
 
 private Q_SLOTS:
+	void quit();
 	void updateTitle();
 
 private: