#ifndef CALC_DIALOG_H
#define CALC_DIALOG_H

#include <QtGui>

#include "my_signal.h"
#include "MultiPlot.h"
#include "FftThread.h"

class MultiPlot;

class CalcDlg : public QDialog{
	Q_OBJECT
	private:
		MultiPlot * mPlot;
		QGridLayout * topLayout;
		QVBoxLayout * reqLayout;
		QDialogButtonBox * buttonBox;
		
		QComboBox * sourcePlot;
		QComboBox * calculation;
		
		QWidget * current;
		
		
		FftThread * fft_thread;
		
		//--- Sampling/Quantum Panel ---
		QWidget * SamplingQuant;
			QLineEdit * samplingStep;
			QComboBox * samplingTarget;
			QLineEdit * quantLevels;
			QComboBox * quantTarget;

		//--- Add/Multiply,Multiplication,Convolution ---
		QWidget * AddMulti;
			QLabel * withLab;
			QComboBox * with;
			QComboBox * calcTarget;
			
		//--- Fourier Tramsform ---
		QWidget * Fft;
			QComboBox * realTarget;
			QComboBox * imagTarget;
			QComboBox * powerTarget;
			
		
		QWidget * errorPane;
		
		
	
	public:
		CalcDlg(QWidget * parent,Qt::WindowFlags f=0);
		~CalcDlg();
		
	private:
		// One Function for every calculation to build UI
		void createSampQuantWidget();
		void createAddMultiWidget();
		void createFftWidget();
		void createErrorPane();
		int loadedSignals();
	
	public slots:
		void refresh2ndCombo();
		void refresh3dCombo();
		void refreshCombos();
		void okClicked();
		void cancelClicked();
		
		void calcChanged();
		void fftFinished();
		
};

#endif
