#pragma once
#include <QtWidgets/QMainWindow>
#include <QSettings>
#include <vector>
#include "ui_metavis.h"
#include "RunData.h"
#include "GraphView.h"
#include "tsneIteractive.h"


/**
 * Main class of the GUI.
 */
class metavis : public QMainWindow
{
	Q_OBJECT

public:
	metavis(QWidget *parent = Q_NULLPTR);
	~metavis();
	GraphView* actualBestAverageGraph;
	GraphView* actualParticleGraph;
	GraphView* actualMinMaxGraph;
	GraphView* actualMeanHmmingDistanceGraph;

	GraphView* multiBestGraph;
	GraphView* multiAvgGraph;
	GraphView* multiMinGraph;
	GraphView* multiMaxGraph;
	GraphView* multiMeanHammingDistanceGraph;
	

	tsneIteractive* tsneWidget;
	GraphView* bitField;
private:
	Ui::metavisClass ui;
	QSettings* settings;
	std::list<RunData> runList;

	//To Tab all 
	QDockWidget* lastDocked;

private:
	/* Widget functions */
	GraphView* createCustomWidget(QString titleString, bool tabToLast = false);
	void createBitField();
	void createProjectManager();
	void createTSNE();
	/* Setting functions*/
	void writeActualMainWindowSettings();
	void readMainWindowSettings();

	//Bitfield color interpolation
	static QColor interpolate(QColor& first, QColor& second, double alpha);
	void updateBitFieldColors();



public slots:
	/**
	 * Opens the settingWindows Dialog.
	 */
	void openSetting();
	/**
	 * Open a logFile.	
	 */
	void openFile();
};
