From 15273b38dff309af52eb0b9454ade5f5cbb18ac0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 22 Mar 2020 19:47:40 +0200 Subject: qcam: main_window: Replace start and stop actions with a toggle action The main window toolbar contains a start button and a stop button. This allows starting an already started camera (which is currently not handled and results in an error) or stopping an already stopped camera. Replace the two actions with a single start/stop toggle action, preventing UI misuse and reducing confusion. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/qcam/main_window.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/qcam/main_window.h') diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index c623120d..34a090cc 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ using namespace libcamera; +class QAction; class ViewFinder; enum { @@ -49,9 +51,7 @@ private Q_SLOTS: void updateTitle(); void switchCamera(int index); - - int startCapture(); - void stopCapture(); + void toggleCapture(bool start); void saveImageAs(); @@ -60,11 +60,17 @@ private: std::string chooseCamera(); int openCamera(); + int startCapture(); + void stopCapture(); + void requestComplete(Request *request); void processCapture(); int display(FrameBuffer *buffer); void queueRequest(FrameBuffer *buffer); + QIcon iconPlay_; + QIcon iconStop_; + QString title_; QTimer titleTimer_; @@ -87,6 +93,7 @@ private: QQueue doneQueue_; QToolBar *toolbar_; + QAction *startStopAction_; ViewFinder *viewfinder_; std::map> mappedBuffers_; }; -- cgit v1.2.1