#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtWidgets/qlabel.h>
#include <memory>
#include <machine.h>

class Machine;
namespace Ui {
class MainWindow;
}

class OE_interfaceDisplay;

class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	explicit MainWindow(QWidget *parent = nullptr);
	~MainWindow();
	void addTab();
	void keyPressEvent(QKeyEvent* event);
	void keyReleaseEvent(QKeyEvent* event);

private:
	OE_interfaceDisplay* getItfDisplay();
	void sendKeyPulse(Qt::Key key, Qt::KeyboardModifiers modifiers);

private slots:

	void on_tabWidget_tabCloseRequested(int index);

	void on_actionNew_triggered();

	void on_actionClose_triggered();

	void on_actionOpen_triggered();

	void on_actionSave_triggered();

	void on_actionLine_triggered();

	void on_actionUndo_triggered();

	void on_actionRedo_triggered();

	void on_actionBirail_triggered();

	void on_actionPattern1_triggered();
	void on_actionPattern2_triggered();
	void on_actionPattern3_triggered();
	void on_actionPattern4_triggered();
	void on_actionPattern5_triggered();
	void on_actionPattern6_triggered();
	void on_actionPattern7_triggered();
	void on_actionPattern8_triggered();
	void on_actionPattern9_triggered();

	void on_tabWidget_currentChanged(int index);

	void on_actionCloseCurve_triggered();

	void on_actionReverse_curve_R_triggered();

	void on_actionFill_triggered();

	void on_actionConnectToMachine_triggered(bool checked);

	void on_machineConnectionChanged(bool connected);
	void on_machineStateChanged(Machine::SlaveInfo info);

	void on_actionMachineRun_triggered();

	void on_actionMachineLoad_triggered();

	private:
	Ui::MainWindow *ui;
	QLabel status;
	std::unique_ptr<Machine> machine;
};

#endif // MAINWINDOW_H
