From patchwork Fri Feb 14 00:18:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2831 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BE10A61A2B for ; Fri, 14 Feb 2020 01:18:15 +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 51CE99D3; Fri, 14 Feb 2020 01:18:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581639495; bh=k6FWYGdYMSBVyrZG+Il02eJbl1ph4eBQhghcDofRDAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TwLJIS/Eyjvd1iOFCRW1suVIbnROVPMm6aj4apncF5cBaEYDWLIhbn+fEm8LcSTOK OlEkjKU3y7U4kOnzMQlBB62BSE9CH0EwQ9jXnjeZs519s244xaHx4FhYZavLTdP1Oz k+INOD2QXS6vvPQKW+VF4DUDEkJrPi5j9+hcYPoA= From: Kieran Bingham To: libcamera devel Date: Fri, 14 Feb 2020 00:18:09 +0000 Message-Id: <20200214001810.19302-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214001810.19302-1-kieran.bingham@ideasonboard.com> References: <20200214001810.19302-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/7] 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: Fri, 14 Feb 2020 00:18:16 -0000 Provide Quit, Play, Stop icons. Create a Qt resource to compile icons into the binary and present them on the toolbar. Update the Quit button with a 'cross', and implement Play/Stop buttons. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- v2 - Remove pause button src/qcam/assets/feathericons/feathericons.qrc | 7 +++++++ src/qcam/main_window.cpp | 9 ++++++++- src/qcam/main_window.h | 6 +++--- src/qcam/meson.build | 9 +++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/qcam/assets/feathericons/feathericons.qrc diff --git a/src/qcam/assets/feathericons/feathericons.qrc b/src/qcam/assets/feathericons/feathericons.qrc new file mode 100644 index 000000000000..b8e5c2266408 --- /dev/null +++ b/src/qcam/assets/feathericons/feathericons.qrc @@ -0,0 +1,7 @@ + + +./play-circle.svg +./stop-circle.svg +./x-circle.svg + + diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 0e9e717b7e1a..ec93e0177b41 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -66,7 +67,7 @@ int MainWindow::createToolbars() /* Disable right click context menu */ toolbar_->setContextMenuPolicy(Qt::PreventContextMenu); - action = toolbar_->addAction("Quit"); + action = toolbar_->addAction(QIcon(":x-circle.svg"), "Quit"); connect(action, &QAction::triggered, this, &MainWindow::quit); /* Camera selection */ @@ -81,6 +82,12 @@ int MainWindow::createToolbars() toolbar_->addSeparator(); + action = toolbar_->addAction(QIcon(":play-circle.svg"), "start"); + connect(action, &QAction::triggered, this, &MainWindow::startCapture); + + 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 12af103f87d0..27ceed611d59 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -46,14 +46,14 @@ private Q_SLOTS: void switchCamera(int index); + int startCapture(); + void stopCapture(); + private: int createToolbars(); std::string chooseCamera(); int openCamera(); - 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..5b877a84da85 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', @@ -30,10 +34,11 @@ if qt5_dep.found() endif endif - moc_files = qt5.preprocess(moc_headers: qcam_moc_headers, + resources = qt5.preprocess(moc_headers: qcam_moc_headers, + qresources : qcam_resources, dependencies: qt5_dep) - qcam = executable('qcam', qcam_sources, moc_files, + qcam = executable('qcam', qcam_sources, resources, install : true, dependencies : [libcamera_dep, qt5_dep], cpp_args : qt5_cpp_args)