From patchwork Thu Feb 6 15:05:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2791 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6EF2E608A6 for ; Thu, 6 Feb 2020 16:05:11 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0EA409F0; Thu, 6 Feb 2020 16:05:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581001511; bh=CG++kaOhv+WrNngzAWuFzVKnqHqhdEBC+W0BUpXRz/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3HO4A6TaFv5sgbVIiugWjhUFBYyIojwNK+wGELksEULsr9hafZ7utcmzAIFob9Qr 2v4MgdgDU9uDZZzgjV5PR7NtVDsT8ZEQRVJ+xwyO/wE6Mgy7lsUFHs/YfZYNbZTcW4 lsW+iIyuSPJLqwY9OsGZ11R20TOsL3TbA9RMD79I= From: Kieran Bingham To: LibCamera Devel Date: Thu, 6 Feb 2020 15:05:03 +0000 Message-Id: <20200206150504.24204-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200206150504.24204-1-kieran.bingham@ideasonboard.com> References: <20200206150504.24204-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/6] qcam: Provide initial icon buttons "Play/Stop" 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, 06 Feb 2020 15:05:12 -0000 Provide Quit, Play, Pause, Stop icons. Utilise the provided QT resources to present icons for the toolbar. Update the Quit button with a 'cross', and implement Play/Pause/Stop buttons. 'Pause' is a no-op currently and likely could be removed, but I wanted an ability to distinguish between holding the stream and restarting it. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 12 +++++++++++- src/qcam/main_window.h | 7 +++---- src/qcam/meson.build | 8 +++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 1c7260f32d0a..0ae4c60b8699 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -63,7 +64,7 @@ int MainWindow::createToolbars(CameraManager *cm) toolbar_ = addToolBar(""); - action = toolbar_->addAction("Quit"); + action = toolbar_->addAction(QIcon(":x-circle.svg"), "Quit"); connect(action, &QAction::triggered, this, &MainWindow::quit); QAction *cameraAction = new QAction("&Cameras", this); @@ -79,6 +80,15 @@ int MainWindow::createToolbars(CameraManager *cm) connect(action, &QAction::triggered, this, [=]() { this->setCamera(cam); }); } + action = toolbar_->addAction(QIcon(":play-circle.svg"), "start"); + connect(action, &QAction::triggered, this, &MainWindow::startCapture); + + toolbar_->addAction(QIcon(":pause-circle.svg"), "pause"); + /* TODO: Connect an action to perform when 'pause' requested? or remove */ + + action = toolbar_->addAction(QIcon(":stop-circle.svg"), "stop"); + connect(action, &QAction::triggered, this, &MainWindow::stopCapture); + return 0; } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index f7c96fdd5c30..b0bf16dd2a09 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -46,14 +46,13 @@ private Q_SLOTS: int setCamera(const std::shared_ptr &cam); + int startCapture(); + void stopCapture(); + private: int createToolbars(CameraManager *cm); std::string chooseCamera(CameraManager *cm); int openCamera(CameraManager *cm); - - int startCapture(); - void stopCapture(); - void requestComplete(Request *request); int display(FrameBuffer *buffer); diff --git a/src/qcam/meson.build b/src/qcam/meson.build index 1e71f20fa15e..b6544dbf3f2b 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -11,6 +11,10 @@ qcam_moc_headers = files([ 'main_window.h', ]) +qcam_resources = files([ + 'assets/feathericons/feathericons.qrc', +]) + qt5 = import('qt5') qt5_dep = dependency('qt5', method : 'pkg-config', @@ -33,7 +37,9 @@ if qt5_dep.found() moc_files = qt5.preprocess(moc_headers: qcam_moc_headers, dependencies: qt5_dep) - qcam = executable('qcam', qcam_sources, moc_files, + resources = qt5.preprocess(qresources : qcam_resources) + + qcam = executable('qcam', qcam_sources, moc_files, resources, install : true, dependencies : [libcamera_dep, qt5_dep], cpp_args : qt5_cpp_args)