mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-16 17:05:08 +03:00
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>
This commit is contained in:
parent
fc9fe45580
commit
2dc85eabe1
4 changed files with 25 additions and 6 deletions
7
src/qcam/assets/feathericons/feathericons.qrc
Normal file
7
src/qcam/assets/feathericons/feathericons.qrc
Normal file
|
@ -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>
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QIcon>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
@ -66,7 +67,7 @@ int MainWindow::createToolbars()
|
||||||
/* Disable right click context menu. */
|
/* Disable right click context menu. */
|
||||||
toolbar_->setContextMenuPolicy(Qt::PreventContextMenu);
|
toolbar_->setContextMenuPolicy(Qt::PreventContextMenu);
|
||||||
|
|
||||||
action = toolbar_->addAction("Quit");
|
action = toolbar_->addAction(QIcon(":x-circle.svg"), "Quit");
|
||||||
connect(action, &QAction::triggered, this, &MainWindow::quit);
|
connect(action, &QAction::triggered, this, &MainWindow::quit);
|
||||||
|
|
||||||
/* Camera selection. */
|
/* Camera selection. */
|
||||||
|
@ -81,6 +82,12 @@ int MainWindow::createToolbars()
|
||||||
|
|
||||||
toolbar_->addSeparator();
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,14 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void switchCamera(int index);
|
void switchCamera(int index);
|
||||||
|
|
||||||
|
int startCapture();
|
||||||
|
void stopCapture();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int createToolbars();
|
int createToolbars();
|
||||||
std::string chooseCamera();
|
std::string chooseCamera();
|
||||||
int openCamera();
|
int openCamera();
|
||||||
|
|
||||||
int startCapture();
|
|
||||||
void stopCapture();
|
|
||||||
|
|
||||||
void requestComplete(Request *request);
|
void requestComplete(Request *request);
|
||||||
int display(FrameBuffer *buffer);
|
int display(FrameBuffer *buffer);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ qcam_moc_headers = files([
|
||||||
'main_window.h',
|
'main_window.h',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
qcam_resources = files([
|
||||||
|
'assets/feathericons/feathericons.qrc',
|
||||||
|
])
|
||||||
|
|
||||||
qt5 = import('qt5')
|
qt5 = import('qt5')
|
||||||
qt5_dep = dependency('qt5',
|
qt5_dep = dependency('qt5',
|
||||||
method : 'pkg-config',
|
method : 'pkg-config',
|
||||||
|
@ -30,10 +34,11 @@ if qt5_dep.found()
|
||||||
endif
|
endif
|
||||||
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)
|
dependencies: qt5_dep)
|
||||||
|
|
||||||
qcam = executable('qcam', qcam_sources, moc_files,
|
qcam = executable('qcam', qcam_sources, resources,
|
||||||
install : true,
|
install : true,
|
||||||
dependencies : [libcamera_dep, qt5_dep],
|
dependencies : [libcamera_dep, qt5_dep],
|
||||||
cpp_args : qt5_cpp_args)
|
cpp_args : qt5_cpp_args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue