/**
    05Robot - Computer Vision Module

    @author P.Kaczmarek,J.Tomczynski,T.Mankowski
    @version 1.0 2017
*/
#ifndef CameraPreview_H
#define CameraPreview_H

#include <QWidget>
#include "ui_CameraPreview.h"
#include "CameraObject.h"
#include "CameraThread.h"
#include <QMenu>

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
/** \addtogroup ComputerVisionModule
 *  @{
 */
/**
 @brief Camera preview widget
 */
class CameraPreview : public QWidget
{
	Q_OBJECT

public:
	CameraThread * ct;
    CameraPreview(CameraThread*,QWidget *parent = 0, Qt::WindowFlags flags = 0);
	~CameraPreview();

public:
	Ui::CameraPreview ui;

public slots:
    /**
     @brief Update displayed picture
     
     @param id Frame ID
     @param frame Pointer to picture
     */
	void frameIn(cv::Mat*, int, int);
	/**
	 @brief Opens properties dialog
	 */
	void Properties();
    /**
     @brief Opens context menu
     */
    virtual void contextMenuRequested(QPoint point);
    /**
     @brief Triggers context menu event
     */
	virtual void contextMenuEvent ( QContextMenuEvent * event );


	
signals:
    /**
     @brief Emitted on window close
     */
	void closing(CameraPreview*);

private:
	void closeEvent(QCloseEvent * event);
	QDialog *dlg;
	QMenu*   contextMenu;	
	QAction* actionProperties;
	QAction* actionClose;
};
/** @}*/
#endif // MOCAP_H
