#ifndef RECORDPLUGINWIDGET_H__
#define RECORDPLUGINWIDGET_H__

#include <QString>
#include <QMutex>
#include <QWidget>
#include "ui_RecordPluginWidget.h"
#include "ritkOpenGLRImageEntity.h"


class RecordPluginWidget : public QWidget, public Ui_RecordPluginWidget
{
	Q_OBJECT

public:
	/// Constructor
	RecordPluginWidget(QWidget *parent = 0);
	/// Destructor
	~RecordPluginWidget();

	/**	@name	States */
	//@{
	enum RecordStatesType
	{
		Enabled,
		Disabled
	};
	/// Set the state
	void SetState(RecordStatesType State);
	/// Get the state
	RecordStatesType GetState();
	//@}

public slots:
	/// Set the frame counter
	void SetFrameCounter(long Value);
	/// Sets the range data
	void SetRangeData(ritk::RImageF2::ConstPointer Data);
	void SetCustomFilename();
	void SetCustomFilenameEvent(const QString filename);	

signals:
  	void UpdateWidget();
	/// Signal that is emitted if recording is started
	void StartRecording();
	/// Signal that is emitted if recording is stopped
	void StopRecording();
	/// Signal that is emitted when the preview change
	void PreviewChanged(bool Enabled);
	///
	void CustomFilenamePrefixChanged(int state);
	///
	void CustomFilenameChanged(QString filename);

protected slots:
	/// Connected to the record button
	void RecordButtonClicked();
	/// Connected to the preview check box
	void PreviewChanged();

protected:
	/// Mutex used to lock member access
	QMutex m_Mutex;
	/// The current state of the widget
	RecordStatesType m_CurrentState;
	/// The filename
	QString m_FileName;
	/// The current frame
	ritk::RImageF2::ConstPointer m_CurrentFrame;
	/// Our rimage
	ritk::OpenGLRImageEntity::Pointer m_RImage;

	/**	@name	Keyboard events */
	//@{
	void keyPressEvent(QKeyEvent *e);
	//@}

};

#endif // RECORDPLUGINWIDGET_H__
