#include "MenuDialogDemo.h"

MenuDialogDemo::MenuDialogDemo(QWidget *parent): QMainWindow(parent)
{
     setupUi(this);

	 specifyFunDialog = new SpecifyFunDialog();

     QObject::connect(actionSpecify_Function,SIGNAL(activated()), this, SLOT(OnSpecify()));
	 QObject::connect(actionExit,SIGNAL(activated()), this, SLOT(OnExit()));
}


void MenuDialogDemo::OnSpecify()
{
	// Show the specify function dialog

	int returnValue = specifyFunDialog->exec();


	if(returnValue == QDialog::Accepted) 
	{
		// Obtain function string from dialog class and
        // set the text in the text box. 

		fxTextEdit->setText(specifyFunDialog->currentFtext);
	}
	else
	{
		statusBar()->showMessage(tr("Cancel hit"));
	}
}

void MenuDialogDemo::OnExit()
{
	close();
}
