bool ISISDiagnostics::validate() { UserInputValidator uiv; // Check raw input uiv.checkMWRunFilesIsValid("Input", m_uiForm.dsInputFiles); if(m_uiForm.ckUseCalibration->isChecked()) uiv.checkMWRunFilesIsValid("Calibration", m_uiForm.dsInputFiles); // Check peak range auto rangeOne = std::make_pair(m_dblManager->value(m_properties["PeakStart"]), m_dblManager->value(m_properties["PeakEnd"])); uiv.checkValidRange("Range One", rangeOne); // Check background range bool useTwoRanges = m_blnManager->value(m_properties["UseTwoRanges"]); if(useTwoRanges) { auto rangeTwo = std::make_pair(m_dblManager->value(m_properties["BackgroundStart"]), m_dblManager->value(m_properties["BackgroundEnd"])); uiv.checkValidRange("Range Two", rangeTwo); uiv.checkRangesDontOverlap(rangeOne, rangeTwo); } // Check spectra range auto specRange = std::make_pair(m_dblManager->value(m_properties["SpecMin"]), m_dblManager->value(m_properties["SpecMax"]) + 1); uiv.checkValidRange("Spectra Range", specRange); QString error = uiv.generateErrorMessage(); bool isError = error != ""; if(isError) g_log.warning(error.toStdString()); return !isError; }
bool Elwin::validate() { UserInputValidator uiv; uiv.checkMWRunFilesIsValid("Input", m_uiForm.dsInputFiles); auto rangeOne = std::make_pair(m_dblManager->value(m_properties["IntegrationStart"]), m_dblManager->value(m_properties["IntegrationEnd"])); uiv.checkValidRange("Range One", rangeOne); bool useTwoRanges = m_blnManager->value(m_properties["BackgroundSubtraction"]); if (useTwoRanges) { auto rangeTwo = std::make_pair(m_dblManager->value(m_properties["BackgroundStart"]), m_dblManager->value(m_properties["BackgroundEnd"])); uiv.checkValidRange("Range Two", rangeTwo); uiv.checkRangesDontOverlap(rangeOne, rangeTwo); } QString error = uiv.generateErrorMessage(); showMessageBox(error); return error.isEmpty(); }