/*
QtWagon: a project about 3D objects.
Science and technology promotion license applied. Third party license automatically cascaded.
Zhikai Wang/ www.heteroclinic.net 2013
You can do anything with this file or any file(s) published as part QtWagon project, given this header is kept.
*/
#ifndef __QTCAMERA
#define __QTCAMERA
#include <QObject>
#include <QGLWidget>
#include <QWidget>
#include <QtGui>
#include <GL/glut.h>
#include <QGLWidget>
#include <QWidget>
#include <QtGui>
#include "enumops.h"
#include "camera.h"
//#include "glMovingObject.h"
#include "qtMovingObject.h"
//#include "glwidget.h"
//#include "camera.h"
//#include "qtMovingObject.h"

//class GLWidget;
////class qtMovingObject;
////class GLWidget;
//class GLWidget;
//class QWidget;
//class qtMovingObject;
class qtCamera: public qtMovingObject{
	Q_OBJECT
protected:
	virtual void emitGLWidgetOrders(int op,float val) ;

	// camera * cpt;
	
	camera * currentCamera;
	//void setCameraPt(camera * ncpt) ;
	//void setControlsByWagon();

	QGroupBox * myBox2 ; //!
	QVBoxLayout *myLayout2;
	QRadioButton * radioPerspective, * radioOrhorgonal;//!
	QCheckBox * checkShowFocus;//!

	//bool showFocus;
	QLineEdit * editFocusPositionx, * editFocusPositiony, * editFocusPositionz;//!
	QLineEdit *   editFocusSize;//!
	QLabel* labelLookAtRadius;//!

	//- perspectiveGroup
	QLineEdit *  editPerspectiveFarZ, *  editPerspectiveFovy, * editPerspectiveFovyMin, *  editPerspectiveFovyMax, *  editPerspectiveFovyNearZ;//!

	//- orthorgonalGroup
	QLineEdit *  editOrthorgonalFarZ, *  editOrthorgonalNearZ, * editOsize , * editOsizeLimit, *editSafeLookAtRadius;//!

	//QLineEdit *  editLookedAtx, *editLookedAty, *editLookedAtz;
	QLineEdit *  editZoomDeltaPerspective, * editZoomDeltaOrthogonal, * editLookAtRadiusDelta, * editSwirlDelta;
	QLineEdit *  editdefault_deta_pan;


	QDial  *  dialZoom, * dialFocalLength, * dialSwirlUpDown, * dialRightLeft;
	QDial  *  dialpanLeftRight, * dialpanUpDown, * dialpanLevelForwardBackward;
	int valDialZoomPrev,valDialFocalLengthPrev,valDialSwirlUpDownPrev,valDialRightLeftPrev;
	int valdialpanLeftRightPrev,valdialpanUpDownPrev, valdialpanLevelForwardBackwardPrev;



	////wagonsDiaoDu * diaoduPt;
	//QWidget * screen;
	//GLWidget *glwpt;
	//glMovingObject<GLfloat> * mvopt;

	//QGroupBox * myBox ;
	//QVBoxLayout *myLayout ;

	//QDial  * dialFB;
	//QLineEdit * editDialFBDelta;
	//GLfloat FBDelta_f;


	//QLineEdit * editGlbPosx, * editGlbPosy, * editGlbPosz;
	////GLfloat glbPosx_f,glbPosy_f,glbPosz_f;

	//QDial  * dialYAW;
	//QDial  * dialROLL;
	//QDial  * dialPITCH;
	//int valDialFBPrev,valDialRollPrev,valDialYawPrev,valDialPitchPrev;

	//GLfloat  RYPDelta_f;
	//QLineEdit * editRYPDelta;

	//QLabel *  editUpx,* editUpy,* editUpz; //these values are not editable
	//QLabel *  editLeftx,* editLefty,* editLeftz;//these values are not editable
	//QLabel *  editFrontx,* editFronty,* editFrontz; //these values are not editable

public:
	virtual void setConnections();
	virtual void setControlsByWagon(bool inited = true);
	//camera * qtCamera::getCurrentCamera () ;
	camera * getCurrentCamera () ;
	//qtCamera(QWidget * newScreen) ;
	qtCamera() ;
	virtual ~qtCamera() ;
	void setCameraPt(camera * ncpt) ;
	QGroupBox * getMyBox() ;
	//void setMovingObjPt(glMovingObject<GLfloat> * n_mvopt);
	//void setControlsByWagon();
	//int  dialDerivative(int nval,int & prevVal, int max);
	////void setControlsByVolk();
	//QLineEdit * createDoubleEditLine();
	//void setConnections();
	//QDial  * createDial(bool on = true);
	//QGroupBox * getMyBox() ;
	//void setGLWidgetPt(GLWidget * nglwpt);
	//void  setControlsDefaultValues(int inited = 0);

	//signals:
	//	void sigForwardBackward(int);
	//	void sigUpdateGL();
	//
	//	void sigEditVolkLabel(std::string);//??
	//	void sig3dMoveOrders(int,GLfloat);
	//public slots:
	//		void dialYAW_valueChanged(int nval);
	//		void dialROLL_valueChanged(int nval) ;
	//		void dialPITCH_valueChanged(int nval);
	//		void dialFB_valueChanged(int nval);
	//		void slotUpdateWagonValueOnly();//??
	//
	//private slots:
	//			void editRYPDelta_editingFinished();
	//
	//			void editGlbPosx_editingFinished();
	//			void editGlbPosy_editingFinished();
	//			void editGlbPosz_editingFinished();
	//
	//			void editDialFBDelta_editingFinished ();

protected slots:
			void dialZoom_valueChanged(int);
			void dialFocalLength_valueChanged(int);
			void dialSwirlUpDown_valueChanged(int);
			void dialRightLeft_valueChanged(int);
			void   dialpanLeftRight_valueChanged(int);
			void   dialpanUpDown_valueChanged(int);
			void   dialpanLevelForwardBackward_valueChanged(int);

			//connect(dialZoom, SIGNAL(valueChanged(int)), this, SLOT(dialZoom_valueChanged(int)));
			//connect(dialFocalLength, SIGNAL(valueChanged(int)), this, SLOT(dialFocalLength_valueChanged(int)));
			//connect(dialSwirlUpDown, SIGNAL(valueChanged(int)), this, SLOT(dialSwirlUpDown_valueChanged(int)));
			//connect(dialRightLeft, SIGNAL(valueChanged(int)), this, SLOT(dialRightLeft_valueChanged(int)));
			void editZoomDeltaPerspective_editingFinished();
			void editZoomDeltaOrthogonal_editingFinished();
			void editLookAtRadiusDelta_editingFinished();
			void editSwirlDelta_editingFinished();
			void editdefault_deta_pan_editingFinished();

			//connect(editZoomDeltaPerspective, SIGNAL(editingFinished()), this, SLOT(editZoomDeltaPerspective_editingFinished()));
			//connect(editZoomDeltaOrthogonal, SIGNAL(editingFinished()), this, SLOT(editZoomDeltaOrthogonal_editingFinished()));
			//connect(editLookAtRadiusDelta, SIGNAL(editingFinished()), this, SLOT(editLookAtRadiusDelta_editingFinished()));

			void editOrthorgonalFarZ_editingFinished();
			void editOrthorgonalNearZ_editingFinished();
			void editOsize_editingFinished();
			void editOsizeLimit_editingFinished();
			void editSafeLookAtRadius_editingFinished();
			//connect(editOrthorgonalFarZ, SIGNAL(editingFinished()), this, SLOT(editOrthorgonalFarZ_editingFinished()));
			//connect(editOrthorgonalNearZ, SIGNAL(editingFinished()), this, SLOT(editOrthorgonalNearZ_editingFinished()));
			//connect(editOsize, SIGNAL(editingFinished()), this, SLOT(editOsize_editingFinished()));
			//connect(editOsizeLimit, SIGNAL(editingFinished()), this, SLOT(editOsizeLimit_editingFinished()));
			//connect(editSafeLookAtRadius, SIGNAL(editingFinished()), this, SLOT(editSafeLookAtRadius_editingFinished()));
			void editPerspectiveFarZ_editingFinished();
			void editPerspectiveFovy_editingFinished();
			void editPerspectiveFovyMin_editingFinished();
			void editPerspectiveFovyMax_editingFinished();
			void editPerspectiveFovyNearZ_editingFinished();
			//connect(editPerspectiveFarZ, SIGNAL(editingFinished()), this, SLOT(editPerspectiveFarZ_editingFinished()));
			//connect(editPerspectiveFovy, SIGNAL(editingFinished()), this, SLOT(editPerspectiveFovy_editingFinished()));
			//connect(editPerspectiveFovyMin, SIGNAL(editingFinished()), this, SLOT(editPerspectiveFovyMin_editingFinished()));
			//connect(editPerspectiveFovyMax, SIGNAL(editingFinished()), this, SLOT(editPerspectiveFovyMax_editingFinished()));
			//connect(editPerspectiveFovyNearZ, SIGNAL(editingFinished()), this, SLOT(editPerspectiveFovyNearZ_editingFinished()));
			void editFocusPositionx_editingFinished();
			void editFocusPositiony_editingFinished();
			void editFocusPositionz_editingFinished();

			void editFocusSize_editingFinished();
			void radioPerspective_toggled(bool);
			void radioOrhorgonal_toggled(bool);
			//	connect(checkShowFocus, SIGNAL(stateChanged(int)), this, SLOT(checkShowFocus_stateChanged(int)));
			void checkShowFocus_stateChanged(int);

	public slots:
		void slotCAMUpdateWagonValueOnly();
signals:
		void sigCAM3dMoveOrders(int,float);

};
#endif