summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.h
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2019-06-20 17:11:33 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2019-07-04 22:11:27 +0100
commit843e4466cd78b3369b1e77af0bf3b33cbd09129d (patch)
treed60f82cfaa145773aa2bcdc4f5a318f288d9a529 /src/qcam/main_window.h
parent2976dd6a7e202d161077a454b28e9fcce98945c1 (diff)
qcam: Update window title with FPS
Provide an average FPS in the QCam title bar to show the current rate of frame processing. The QCam compilation is updated to process the Qt MoC headers to support signals and slots accordingly. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/main_window.h')
-rw-r--r--src/qcam/main_window.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 46a494a9..f58cb6a6 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -10,7 +10,10 @@
#include <map>
#include <memory>
+#include <QElapsedTimer>
#include <QMainWindow>
+#include <QObject>
+#include <QTimer>
#include <libcamera/camera.h>
#include <libcamera/stream.h>
@@ -28,10 +31,15 @@ enum {
class MainWindow : public QMainWindow
{
+ Q_OBJECT
+
public:
MainWindow(const OptionsParser::Options &options);
~MainWindow();
+private Q_SLOTS:
+ void updateTitle();
+
private:
int openCamera();
@@ -43,6 +51,8 @@ private:
int display(Buffer *buffer);
QString title_;
+ QTimer titleTimer_;
+
const OptionsParser::Options &options_;
std::shared_ptr<Camera> camera_;
@@ -51,6 +61,10 @@ private:
uint64_t lastBufferTime_;
+ QElapsedTimer frameRateInterval_;
+ uint32_t previousFrames_;
+ uint32_t framesCaptured_;
+
ViewFinder *viewfinder_;
};