#ifndef CONFIGURECAMERADIALOG_H
#define CONFIGURECAMERADIALOG_H

#include <QDialog>
#include "cameras.h"
#include "profile.h"

namespace Ui {
class ConfigureCameraDialog;
}

class ConfigureCameraDialog : public QDialog
{
	Q_OBJECT

	static constexpr int MODE_IDLE = 0;
	static constexpr int MODE_REMAP_GET = 1;
	static constexpr int MODE_BG_GET = 2;
	static constexpr int MODE_DARK_GET = 3;

	CameraSetup setup_;
	std::shared_ptr<Camera> camera_;
	int mode_ = MODE_IDLE;
	cv::Mat fgImage;
	double profileExposure_;
	bool nodistort_;

private:
	bool checkConfig();
	void gotImage(Camera::Image img);

private slots:
	void captureBg();
	void captureRemap();
	void captureDark();
	void takeImage();
	void setExposure(double value);
	void bayerIndexChanged(int index);

public slots:
	void accept() override;

public:
	explicit ConfigureCameraDialog(const CameraSetup& setup, const  std::shared_ptr<Camera> camera, double exposureTime = 1.0/60, bool nodistort = false, QWidget *parent = nullptr);
	~ConfigureCameraDialog();
	CameraSetup getCameraSetup(){return setup_;}


private:
	Ui::ConfigureCameraDialog *ui;
};

#endif // CONFIGURECAMERADIALOG_H
