#ifndef FORM_WIDGET_H
#define FORM_WIDGET_H

#include <QWidget>
#include "ui_form_widget.h"
#include "serverscriptedit.h"
#include "serverdesigner_core.h"
#include "SH_ui_loader.h"


class FormWidget: public QWidget, protected Ui::FormWidget {
	Q_OBJECT
public:
	explicit FormWidget(QWidget * parent = 0);

	bool loadForTest();
	void startTest();

	void reset();
	void editForm();

	QWidget * testForm() const {return tform;}
	bool hasForm() const {return form;}

	void prepareUI(const QString & path);

private:
	virtual bool eventFilter(QObject * o, QEvent * e);

	QMenu * widgetPopupMenu(QWidget * w);
	void invokeSignalPopup(QWidget * w, QPoint global_pos);

	QWidget * form, * tform;
	QString signal_src;
	SHSUiLoader ui_loader;

public slots:
	void loadFile(const QString & path);
	void stopTest();

private slots:
	void addSignal();

};


#endif // FORM_WIDGET_H
