#ifndef PMDCAMCUBESOURCEPLUGINWIDGET_H__
#define PMDCAMCUBESOURCEPLUGINWIDGET_H__


#include <QWidget>
#include "ui_PMDCamCubeSourcePluginWidget.h"
#include <QMutex>

/**	@ingroup	Core
 *	@class		PMDCamCubeSourcePluginWidget
 *	@author		Sebastian Bauer / Jakob Wasza
 *	@brief		Widget for the camera player
 *
 *	@details
 *	More documentation asap.
 */
class PMDCamCubeSourcePluginWidget : public QWidget, public Ui_PMDCamCubeSourcePluginWidget
{
	Q_OBJECT

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

	/** @name	Camera states */
	//@{
	enum CamInterfaceStateType
	{
		DisconnectedState,
		ConnectingState, 
		ConnectedState, 
		PlayLiveState,
	};
	/// Set the state
	void SetState(CamInterfaceStateType Type);
	/// Get the state
	CamInterfaceStateType GetState();
	/// Update the state
	void UpdateState();
	//@}

public slots:
	/// Will update the GUI to match the current state.
	void UpdateGUI();
	/// Will be called when the check box for source data averaging changes
	void SourceDataAveragingEventSlot(bool);

	/** @name Usere interaction signals*/
	//@{
signals:
	/// Will be emitted when the user pushes the connect/disconnect button and the widget is in the disconnected state
	void ConnectEvent();
	/// Will be emitted when the user pushes the connect/disconnect button and the widget is in the connected state
	void DisconnectEvent();
	///Will be emitted if the integration time changes
	void IntegrationTimeEvent(int);
	/// Will be emitted when the user pushes the pause button
	void PauseEvent();
	/// Will be emitted when the user pushes the stop button
	void StopEvent();
	/// Will be emitted when the user pushes the play button
	void PlayEvent();
	/// Will be emitted when the user pushes the step forward button
	void StepForwardEvent();
	/// Will be emitted when the user pushes the enable source data average button
	void SourceDataAveragingEvent(bool);
	/// Will be emitted when the user changes the number of frames to average the source data
	void NumFramesToAverageSourceDataEvent(int);

protected slots:
	/// Intermediate slot: will morph a connect/disconnect button event into the correct event
	void ConnectDisconnectButtonEvent();

protected:
	/// The current state of the widget
	CamInterfaceStateType m_CurrentState;
	/// Mutex used to lock the current state
	QMutex m_StateMutex;

};

#endif // PMDCAMCUBESOURCEPLUGINWIDGET_H__
