#ifndef __PLUGIN_NAME__SOURCEPLUGIN_H__
#define __PLUGIN_NAME__SOURCEPLUGIN_H__

#include "ritkSourcePlugin.h"
#include "__PLUGIN_NAME__SourcePluginRImageSource.h"
#include "__PLUGIN_NAME__SourcePluginWidget.h"

#include <QTimer>

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

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

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

	/** @name	Player states */
	//@{
	typedef enum StateType
	{
		Idle,
		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 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
	__PLUGIN_NAME__SourcePluginWidget *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 */
	//@{
	// Implicit template instantiation
	//typedef __PLUGIN_NAME__SourcePluginSource<RImageF2> __PLUGIN_NAME__SourcePluginSourceType;
	/// Explicit template instantiation (default)
	typedef __PLUGIN_NAME__SourcePluginSourceF2 __PLUGIN_NAME__SourcePluginSourceType;
	typedef __PLUGIN_NAME__SourcePluginSourceType::Pointer __PLUGIN_NAME__SourcePluginSourcePointer;
	/// The filter
	__PLUGIN_NAME__SourcePluginSourcePointer m_Source;
	//@}
};



#endif // __PLUGIN_NAME__SOURCEPLUGIN_H__