#ifndef KINECTNITESOURCEPLUGIN_H__
#define KINECTNITESOURCEPLUGIN_H__

#include "ritkSourcePlugin.h"
#include "KinectNITERImageSource.h"
#include "KinectNITESourcePluginWidget.h"

#include <QTimer>

/// Automatically generated by the plugin creator
class KinectNITESourcePlugin : public ritk::SourcePlugin
{
	Q_OBJECT

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

	/// 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();
	/// Is connected to the widget's user interaction checkbox
	void UserInteraction();

protected:
	/// The widget for this player
	KinectNITESourcePluginWidget *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;

	/// The flag of the pose estimation
	bool m_PoseFlag;

	/**	@name	The source */
	//@{
	typedef KinectNITERImageSourceF2 SourceType;
	typedef SourceType::Pointer SourcePointer;
	SourcePointer m_Source;
	//@}
};



#endif // KINECTNITESOURCEPLUGIN_H__
