#ifndef APPLICATION_H #define APPLICATION_H #include "Singleton.h" #include #include #include class QGuiApplication; class DeviceConnection; class VideoFrameProvider; class H264Palyer; class Application : public QObject { Q_OBJECT QML_NAMED_ELEMENT(App) QML_SINGLETON Q_PROPERTY(int DeviceWidth MEMBER DeviceWidth CONSTANT FINAL) Q_PROPERTY(bool currentOpenDoorAreaEnabled READ currentOpenDoorAreaEnabled WRITE setCurrentOpenDoorAreaEnabled NOTIFY currentOpenDoorAreaEnabledChanged) Q_PROPERTY(QList currentOpenDoorAreaPoints READ currentOpenDoorAreaPoints WRITE setCurrentOpenDoorAreaPoints NOTIFY currentOpenDoorAreaPointsChanged) Q_PROPERTY(bool currentShieldedAreaEnabled READ currentShieldedAreaEnabled WRITE setCurrentShieldedAreaEnabled NOTIFY currentShieldedAreaEnabledChanged) Q_PROPERTY(QList currentShieldedAreaPoints READ currentShieldedAreaPoints WRITE setCurrentShieldedAreaPoints NOTIFY currentShieldedAreaPointsChanged) Q_PROPERTY(bool currentAntiClipAreaEnabled READ currentAntiClipAreaEnabled WRITE setCurrentAntiClipAreaEnabled NOTIFY currentAntiClipAreaEnabledChanged) Q_PROPERTY(QList currentAntiClipAreaPoints READ currentAntiClipAreaPoints WRITE setCurrentAntiClipAreaPoints NOTIFY currentAntiClipAreaPointsChanged) friend class Amass::Singleton; public: constexpr static int DeviceWidth = 640; bool currentOpenDoorAreaEnabled() const; void setCurrentOpenDoorAreaEnabled(bool enabled); QList currentOpenDoorAreaPoints() const; void setCurrentOpenDoorAreaPoints(const QList &points); bool currentShieldedAreaEnabled() const; void setCurrentShieldedAreaEnabled(bool enabled); QList currentShieldedAreaPoints() const; void setCurrentShieldedAreaPoints(const QList &points); bool currentAntiClipAreaEnabled() const; void setCurrentAntiClipAreaEnabled(bool enabled); QList currentAntiClipAreaPoints() const; void setCurrentAntiClipAreaPoints(const QList &points); Q_INVOKABLE void updateOpenDoorAreaPoints(const QList &points); Q_INVOKABLE void updateAntiClipAreaPoints(const QList &points); Q_INVOKABLE void updateShieldedAreaPoints(const QList &points); int exec(); Q_INVOKABLE void open(); Q_INVOKABLE void start(); static Application *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine); signals: void newVideoFrame(); void currentOpenDoorAreaPointsChanged(); void currentShieldedAreaPointsChanged(); void currentAntiClipAreaPointsChanged(); void currentOpenDoorAreaEnabledChanged(); void currentShieldedAreaEnabledChanged(); void currentAntiClipAreaEnabledChanged(); protected: Application(int &argc, char **argv); void onDeviceOpenDoorArea(bool enabled, const QList &points); void onDeviceShieldedArea(bool enabled, const QList &points); void onDeviceAntiClipArea(bool enabled, const QList &points); private: std::shared_ptr m_app; VideoFrameProvider *m_videoFrameProvider = nullptr; std::shared_ptr m_player; DeviceConnection *m_device = nullptr; bool m_currentOpenDoorAreaEnabled = false; QList m_currentOpenDoorAreaPoints; bool m_currentShieldedAreaEnabled = false; QList m_currentShieldedAreaPoints; bool m_currentAntiClipAreaEnabled = false; QList m_currentAntiClipAreaPoints; }; #endif // APPLICATION_H