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(); }
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 IqtFit::validate() { UserInputValidator uiv; uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsSampleInput); auto range = std::make_pair(m_ffRangeManager->value(m_properties["StartX"]), m_ffRangeManager->value(m_properties["EndX"])); uiv.checkValidRange("Ranges", range); QString error = uiv.generateErrorMessage(); showMessageBox(error); return error.isEmpty(); }