diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-02-05 14:41:14 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2020-02-14 12:34:33 +0000 |
commit | 2dc85eabe1d9e9946f39692ea9a3bf1bb635bbcc (patch) | |
tree | bafc799250835bd3e417cd60cdaf55b0c214be04 /src | |
parent | fc9fe45580839cee9420415f6d04052f9dfcaa62 (diff) |
qcam: Provide initial icon buttons "Play/Stop"
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 <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qcam/assets/feathericons/feathericons.qrc | 7 | ||||
-rw-r--r-- | src/qcam/main_window.cpp | 9 | ||||
-rw-r--r-- | src/qcam/main_window.h | 6 | ||||
-rw-r--r-- | src/qcam/meson.build | 9 |
4 files changed, 25 insertions, 6 deletions
diff --git a/src/qcam/assets/feathericons/feathericons.qrc b/src/qcam/assets/feathericons/feathericons.qrc new file mode 100644 index 00000000..b8e5c226 --- /dev/null +++ b/src/qcam/assets/feathericons/feathericons.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> +<file>./play-circle.svg</file> +<file>./stop-circle.svg</file> +<file>./x-circle.svg</file> +</qresource> +</RCC> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index f55628c7..f76890e7 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -12,6 +12,7 @@ #include <QComboBox> #include <QCoreApplication> +#include <QIcon> #include <QInputDialog> #include <QTimer> #include <QToolBar> @@ -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 12af103f..27ceed61 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 1e71f20f..5b877a84 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) |