PrisonScanner 5.109.0
videoscanner.h
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: MIT
4*/
5
6#ifndef PRISON_VIDEOSCANNER_H
7#define PRISON_VIDEOSCANNER_H
8
9#include "prisonscanner_export.h"
10#include "scanresult.h"
11
12#include <QObject>
13#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
14#include <QAbstractVideoFilter>
15#else
16#include <QVideoSink>
17#endif
18
19#include <memory>
20
21namespace Prison
22{
23
24class VideoScannerPrivate;
25
33class PRISONSCANNER_EXPORT VideoScanner
34#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
35 : public QAbstractVideoFilter
36#else
37 : public QObject
38#endif
39{
40 Q_OBJECT
41 Q_PROPERTY(Prison::ScanResult result READ result NOTIFY resultChanged)
42 Q_PROPERTY(Prison::Format::BarcodeFormats formats READ formats WRITE setFormats NOTIFY formatsChanged)
43
44#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
45 Q_PROPERTY(QVideoSink *videoSink READ videoSink WRITE setVideoSink NOTIFY videoSinkChanged)
46#endif
47
48public:
49 explicit VideoScanner(QObject *parent = nullptr);
51
54
58 Format::BarcodeFormats formats() const;
63 void setFormats(Format::BarcodeFormats formats);
64
65#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
67 QVideoFilterRunnable *createFilterRunnable() override;
69#else
71 QVideoSink *videoSink() const;
73 void setVideoSink(QVideoSink *sink);
74#endif
75
76Q_SIGNALS:
84 void resultChanged(const Prison::ScanResult &scanResult);
85
92
93 void formatsChanged();
94 void videoSinkChanged();
95
96private:
97 std::unique_ptr<VideoScannerPrivate> d;
98};
99
100}
101
102#endif // PRISON_VIDEOSCANNER_H
Result of a barcode scan attempt.
Definition scanresult.h:31
Scans a live video feed for barcodes.
Definition videoscanner.h:39
ScanResult result() const
The latest result of the barcode scan.
void resultContentChanged(const Prison::ScanResult &scanResult)
Emitted when a barcode with a new content has been detected, but not when merely the position of a ba...
void setFormats(Format::BarcodeFormats formats)
Sets the barcode formats to detect.
Format::BarcodeFormats formats() const
The barcode formats the scanner should look for.
QVideoSink * videoSink() const
The video sink being scanned for barcodes.
void setVideoSink(QVideoSink *sink)
Sets the video sink to scan for barcodes.
void resultChanged(const Prison::ScanResult &scanResult)
Emitted whenever we get a new scan result, as long as any property of the result changes.