cFlightAnimation::cFlightAnimation(cInterface *_interface, cAnimationFrames *_frames,
	cImage *_image, QWidget *_imageWidget, cParameterContainer *_params, cFractalContainer *_fractal,
	QObject *parent)
		: QObject(parent), mainInterface(_interface), frames(_frames)
{
	if (mainInterface->mainWindow)
	{
		ui = mainInterface->mainWindow->ui;

		// connect flight control buttons
		connect(ui->pushButton_record_flight, SIGNAL(clicked()), this, SLOT(slotRecordFlight()));
		connect(
			ui->pushButton_continue_recording, SIGNAL(clicked()), this, SLOT(slotContinueRecording()));
		connect(ui->pushButton_render_flight, SIGNAL(clicked()), this, SLOT(slotRenderFlight()));
		connect(ui->pushButton_delete_all_images, SIGNAL(clicked()), this, SLOT(slotDeleteAllImages()));
		connect(ui->pushButton_show_animation, SIGNAL(clicked()), this, SLOT(slotShowAnimation()));
		connect(ui->pushButton_flight_refresh_table, SIGNAL(clicked()), this, SLOT(slotRefreshTable()));
		connect(ui->pushButton_flight_to_keyframe_export, SIGNAL(clicked()), this,
			SLOT(slotExportFlightToKeyframes()));
		connect(ui->button_selectAnimFlightImageDir, SIGNAL(clicked()), this,
			SLOT(slotSelectAnimFlightImageDir()));
		connect(ui->tableWidget_flightAnimation, SIGNAL(cellChanged(int, int)), this,
			SLOT(slotTableCellChanged(int, int)));
		connect(ui->spinboxInt_flight_first_to_render, SIGNAL(valueChanged(int)), this,
			SLOT(slotMovedSliderFirstFrame(int)));
		connect(ui->spinboxInt_flight_last_to_render, SIGNAL(valueChanged(int)), this,
			SLOT(slotMovedSliderLastFrame(int)));
		connect(ui->tableWidget_flightAnimation, SIGNAL(cellDoubleClicked(int, int)), this,
			SLOT(slotCellDoubleClicked(int, int)));

		// connect renderedImage signals
		connect(mainInterface->renderedImage, SIGNAL(StrafeChanged(CVector2<double>)), this,
			SLOT(slotFlightStrafe(CVector2<double>)));
		connect(mainInterface->renderedImage, SIGNAL(YawAndPitchChanged(CVector2<double>)), this,
			SLOT(slotFlightYawAndPitch(CVector2<double>)));
		connect(mainInterface->renderedImage, SIGNAL(SpeedChanged(double)), this,
			SLOT(slotFlightChangeSpeed(double)));
		connect(mainInterface->renderedImage, SIGNAL(RotationChanged(double)), this,
			SLOT(slotFlightRotation(double)));
		connect(mainInterface->renderedImage, SIGNAL(Pause()), this, SLOT(slotRecordPause()));
		connect(mainInterface->renderedImage, SIGNAL(ShiftModeChanged(bool)), this,
			SLOT(slotOrthogonalStrafe(bool)));

		// connect QuestionMessage signal
		connect(this, SIGNAL(QuestionMessage(const QString, const QString, QMessageBox::StandardButtons,
										QMessageBox::StandardButton *)),
			mainInterface->mainWindow, SLOT(slotQuestionMessage(const QString, const QString,
																	 QMessageBox::StandardButtons, QMessageBox::StandardButton *)));

		table = ui->tableWidget_flightAnimation;
	}
cKeyframeAnimation::cKeyframeAnimation(cInterface *_interface, cKeyframes *_frames, cImage *_image,
		QWidget *_imageWidget, cParameterContainer *_params, cFractalContainer *_fractal,
		QObject *parent) :
		QObject(parent), mainInterface(_interface), keyframes(_frames)
{
	image = _image;
	imageWidget = _imageWidget;
	params = _params;
	fractalParams = _fractal;

	if (mainInterface->mainWindow)
	{
		ui = mainInterface->mainWindow->ui;
		QApplication::connect(ui->pushButton_add_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotAddKeyframe()));
		QApplication::connect(ui->pushButton_insert_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotInsertKeyframe()));
		QApplication::connect(ui->pushButton_delete_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotDeleteKeyframe()));
		QApplication::connect(ui->pushButton_modify_keyframe,
													SIGNAL(clicked()),
													this,
													SLOT(slotModifyKeyframe()));
		QApplication::connect(ui->pushButton_render_keyframe_animation,
													SIGNAL(clicked()),
													this,
													SLOT(slotRenderKeyframes()));
		QApplication::connect(ui->pushButton_delete_all_keyframe_images,
													SIGNAL(clicked()),
													this,
													SLOT(slotDeleteAllImages()));
		QApplication::connect(ui->pushButton_show_keyframe_animation,
													SIGNAL(clicked()),
													this,
													SLOT(slotShowAnimation()));
		QApplication::connect(ui->pushButton_refresh_keyframe_table,
													SIGNAL(clicked()),
													this,
													SLOT(slotRefreshTable()));
		QApplication::connect(ui->pushButton_keyframe_to_flight_export,
													SIGNAL(clicked()),
													this,
													SLOT(slotExportKeyframesToFlight()));
		QApplication::connect(ui->pushButton_check_for_collisions,
													SIGNAL(clicked()),
													this,
													SLOT(slotValidate()));
		QApplication::connect(ui->pushButton_set_constant_target_distance,
													SIGNAL(clicked()),
													this,
													SLOT(slotSetConstantTargetDistance()));

		QApplication::connect(ui->button_selectAnimKeyframeImageDir,
													SIGNAL(clicked()),
													this,
													SLOT(slotSelectKeyframeAnimImageDir()));
		QApplication::connect(ui->tableWidget_keyframe_animation,
													SIGNAL(cellChanged(int, int)),
													this,
													SLOT(slotTableCellChanged(int, int)));

		QApplication::connect(ui->spinboxInt_keyframe_first_to_render,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(slotMovedSliderFirstFrame(int)));
		QApplication::connect(ui->spinboxInt_keyframe_last_to_render,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(slotMovedSliderLastFrame(int)));
		QApplication::connect(ui->spinboxInt_frames_per_keyframe,
													SIGNAL(valueChanged(int)),
													this,
													SLOT(UpdateLimitsForFrameRange()));

		QApplication::connect(ui->tableWidget_keyframe_animation,
													SIGNAL(cellDoubleClicked(int, int)),
													this,
													SLOT(slotCellDoubleClicked(int, int)));

		QApplication::connect(this,
													SIGNAL(QuestionMessage(const QString, const QString, QMessageBox::StandardButtons, QMessageBox::StandardButton*)),
													mainInterface->mainWindow,
													SLOT(slotQuestionMessage(const QString, const QString, QMessageBox::StandardButtons, QMessageBox::StandardButton*)));

		table = ui->tableWidget_keyframe_animation;

		//add default parameters for animation
		if (keyframes->GetListOfUsedParameters().size() == 0)
		{
			keyframes->AddAnimatedParameter("camera", params->GetAsOneParameter("camera"));
			keyframes->AddAnimatedParameter("target", params->GetAsOneParameter("target"));
			keyframes->AddAnimatedParameter("camera_top", params->GetAsOneParameter("camera_top"));
			if (mainInterface->mainWindow) PrepareTable();
		}
	}