#ifndef KINECTOPENNISOURCEPLUGIN_H__
#define KINECTOPENNISOURCEPLUGIN_H__

#include "ritkSourcePlugin.h"
#include "KinectOpenNIRImageSource.h"
#include "KinectOpenNISourcePluginWidget.h"

#include <QTimer>

/// Automatically generated be plugin creator
class KinectOpenNISourcePlugin : public ritk::SourcePlugin
{
	Q_OBJECT

public:
	/// Constructor
	KinectOpenNISourcePlugin();
	/// Destructor
	~KinectOpenNISourcePlugin();

	/// Get the plugins GUI @sa Plugin::GetPluginGUI
	QWidget *GetPluginGUI();

	/** @name	Player states */
	//@{
	typedef enum StateType
	{
		Disconnected,
		Connected,
		Playing, 
	} StateType;
	//@}



signals:
	/// Can be connected to a widget to request a GUI update
	void UpdateGUI();

protected:
	/// The actual source that is provided by this player
	SourcePointer GetSource();

	/// Set the state of the player
	void SetState(StateType State);

protected slots:
	/// Is connected to the widgets connect/disconnect button
	void ConnectDisconnect();
	/// Is connected to the widget's play button
	void Play();
	/// Is connected to the widget's pause button
	void Pause();
	/// Is connected to the widget's request next frame button
	void RequestFrame();

protected:
	/// The widget for this player
	KinectOpenNISourcePluginWidget *m_Widget;

	/// The current state of the player
	StateType m_State;
	/// Mutex used to lock access to the state
	QMutex m_StateMutex;
	/// Timer for playing
	QTimer *m_Timer;


	/**	@name	The source provided by this player */
	//@{
	typedef KinectOpenNIRImageSourceF2 KinectOpenNIRImageSourceType;
	typedef KinectOpenNIRImageSourceType::Pointer KinectOpenNIRImageSourcePointer;
	KinectOpenNIRImageSourcePointer m_Source;
	//@}
};



#endif // KINECTOPENNISOURCEPLUGIN_H__
