Skip to content

Commit

Permalink
Tie all the properties to their widgets.
Browse files Browse the repository at this point in the history
This make the whole thing less error-prone and gives me a list of
all the property widgets.

Refs #7229
  • Loading branch information
arturbekasov committed Oct 14, 2013
1 parent 79cd8d6 commit 1df4cac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class PlotAsymmetryByLogValueDialog : public MantidQt::API::AlgorithmDialog
//@{
/// Create the layout
void initLayout();
void parseInput();
//@}

private slots:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,50 +56,36 @@ PlotAsymmetryByLogValueDialog::~PlotAsymmetryByLogValueDialog()
void PlotAsymmetryByLogValueDialog::initLayout()
{
m_uiForm.setupUi(this);

// Tie all the properties
tie(m_uiForm.firstRunBox, "FirstRun", m_uiForm.FirstRunLayout);
tie(m_uiForm.lastRunBox, "LastRun", m_uiForm.LastRunLayout);
tie( m_uiForm.outWSBox, "OutputWorkspace", m_uiForm.OutputWSLayout);
tie(m_uiForm.logBox, "LogValue");
tie(m_uiForm.outWSBox, "OutputWorkspace", m_uiForm.OutputWSLayout);
tie(m_uiForm.typeBox, "Type");
tie(m_uiForm.redBox, "Red");
tie(m_uiForm.greenBox, "Green");
tie(m_uiForm.forwardBox, "ForwardSpectra");
tie(m_uiForm.backwardBox, "BackwardSpectra");
tie(m_uiForm.timeMinBox, "TimeMin");
tie(m_uiForm.timeMaxBox, "TimeMax");

connect( m_uiForm.browseFirstButton, SIGNAL(clicked()), this, SLOT(browseFirstClicked()) );
connect( m_uiForm.browseLastButton, SIGNAL(clicked()), this, SLOT(browseLastClicked()) );
connect( m_uiForm.firstRunBox, SIGNAL(textChanged(const QString&)), this, SLOT(fillLogBox(const QString&)) );
connect( m_uiForm.btnOK,SIGNAL(clicked()),this,SLOT(accept()));
connect( m_uiForm.btnCancel,SIGNAL(clicked()),this,SLOT(reject()));
connect( m_uiForm.btnHelp,SIGNAL(clicked()),this,SLOT(helpClicked()));

fillLineEdit("FirstRun", m_uiForm.firstRunBox);
fillLineEdit("LastRun", m_uiForm.lastRunBox);
m_uiForm.logBox->setEditable(true);
fillLineEdit("OutputWorkspace", m_uiForm.outWSBox);
// Fill Type ComboBox with allowed values
fillAndSetComboBox("Type",m_uiForm.typeBox);
fillLineEdit("Red", m_uiForm.redBox);
fillLineEdit("Green", m_uiForm.greenBox);
fillLineEdit("ForwardSpectra", m_uiForm.forwardBox);
fillLineEdit("BackwardSpectra", m_uiForm.backwardBox);
fillLineEdit("TimeMin", m_uiForm.timeMinBox);
fillLineEdit("TimeMax", m_uiForm.timeMaxBox);

QString asdfdasasdf = m_uiForm.firstRunBox->text();


// Fill log values from the file
if ( !m_uiForm.firstRunBox->text().isEmpty() )
fillLogBox(m_uiForm.firstRunBox->text());
}

/**
* Retrieve the input from the dialog
*/
void PlotAsymmetryByLogValueDialog::parseInput()
{
storePropertyValue("FirstRun", m_uiForm.firstRunBox->text());
storePropertyValue("LastRun", m_uiForm.lastRunBox->text());
storePropertyValue("LogValue", m_uiForm.logBox->currentText());
storePropertyValue("OutputWorkspace", m_uiForm.outWSBox->text());
storePropertyValue("Type", m_uiForm.typeBox->currentText());
storePropertyValue("Red", m_uiForm.redBox->text());
storePropertyValue("Green", m_uiForm.greenBox->text());
storePropertyValue("ForwardSpectra", m_uiForm.forwardBox->text());
storePropertyValue("BackwardSpectra", m_uiForm.backwardBox->text());
storePropertyValue("TimeMin", m_uiForm.timeMinBox->text());
storePropertyValue("TimeMax", m_uiForm.timeMaxBox->text());
// So user can enter a custom value
m_uiForm.logBox->setEditable(true);
}

/**
Expand Down

0 comments on commit 1df4cac

Please sign in to comment.