#ifndef SCRIPTEDITORDIALOG_H
#define SCRIPTEDITORDIALOG_H

#include <QDialog>
#include <QPointer>
#include <QCodeEditor>
#include <QPythonHighlighter>

class ScriptActor;

class ScriptEditorDialog : public QDialog
{
	Q_OBJECT
private:
	QPointer<ScriptActor> scriptActor_;
	QCodeEditor* editor_;
	QPythonHighlighter* highlighter_;
	QString originalCode_;

public:
	ScriptEditorDialog(ScriptActor* actor, QWidget* parent = nullptr);
	~ScriptEditorDialog();

private slots:
	void saveAndClose();
	void onTextChanged();
	void runNow();

private:
	void loadScript();
	void saveScript();
	static QString getExampleScript();
};

#endif // SCRIPTEDITORDIALOG_H