Skip to content

Commit

Permalink
Refs #7964 Updated DataSelector to fix file validation bug.
Browse files Browse the repository at this point in the history
Also updated fury to properly validate the form.
  • Loading branch information
Samuel Jackson committed Sep 18, 2013
1 parent 3f28a3b commit 8fc7919
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
12 changes: 11 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/Fury.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,17 @@ namespace IDA

uiv.checkBins(eLow, eWidth, eHigh);

return uiv.generateErrorMessage();
QString message = uiv.generateErrorMessage();

if(message.isEmpty())
{
if(uiForm().fury_dsInput->getCurrentDataName().isEmpty())
{
message = "Please correct the following:\n\n The specified data file could not be found";
}
}

return message;
}

void Fury::loadSettings(const QSettings & settings)
Expand Down
26 changes: 18 additions & 8 deletions Code/Mantid/MantidQt/MantidWidgets/src/DataSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,31 @@ namespace MantidQt
*
* This will either return the base name of the filepath or
* the currently selected item in the workspace selector depending
* on what view is available.
* on what view is available. If there is no valid input the method returns
* an empty string.
*
* @return The name of the current data item
*/
QString DataSelector::getCurrentDataName()
{
QString filename("");
if(m_uiForm.rfFileInput->isValid())
{
QFileInfo qfio(m_uiForm.rfFileInput->getFirstFilename());
filename = qfio.completeBaseName();
}
else

int index = m_uiForm.stackedDataSelect->currentIndex();

switch(index)
{
filename = m_uiForm.wsWorkspaceInput->currentText();
case 0:
// the file selector is visible
if(m_uiForm.rfFileInput->isValid())
{
QFileInfo qfio(m_uiForm.rfFileInput->getFirstFilename());
filename = qfio.completeBaseName();
}
break;
case 1:
// the workspace selector is visible
filename = m_uiForm.wsWorkspaceInput->currentText();
break;
}

return filename;
Expand Down

0 comments on commit 8fc7919

Please sign in to comment.