Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -rbd01334f257c35b96b7b232beacbcd7fae60c852 -r7cc15ae5968205b241a08ca4646f283b8bf97b03 --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision bd01334f257c35b96b7b232beacbcd7fae60c852) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 7cc15ae5968205b241a08ca4646f283b8bf97b03) @@ -24,100 +24,14 @@ using namespace View; using namespace Storage; - VTreatmentCreate::VTreatmentCreate(QObject *parent) : QObject(parent) { - connect(&_FileSaver, SIGNAL(fileSaved(bool)), - this, SLOT(onFinishedSaveNewTreatment(bool))); - - connect(this, SIGNAL(requestValidateParameters(AdjustParametersValidationRequestData)), - &_GuiController, SLOT(doAdjustment(AdjustParametersValidationRequestData))); - - connect(&_GuiController, SIGNAL(didActionReceive(AdjustParametersValidationResponseData)), - this, SLOT(doActionReceive(AdjustParametersValidationResponseData))); - - connect(this, SIGNAL(requestSelectParameters(AdjustInitTreatmentRequestData)), - &_GuiController, SLOT(doAdjustment(AdjustInitTreatmentRequestData))); - - connect(this, SIGNAL(requestConfirm(AdjustParametersConfirmRequestData)), - &_GuiController, SLOT(doAdjustment(AdjustParametersConfirmRequestData))); - - connect(&_GuiController, SIGNAL(didActionReceive(AdjustInitTreatmentResponseData)), - this, SLOT(doActionReceive(AdjustInitTreatmentResponseData))); - - connect(this, SIGNAL(requestConcurrentSave(QString,QString,bool)), - &_FileSaver, SLOT(onConcurrentSave(QString,QString,bool))); - - loadTreatmentParameterRanges(); + ADJUST_VIEW_CONNECTION(AdjustParametersValidationRequestData ) + ACTION_VIEW_CONNECTION(AdjustParametersValidationResponseData) + ADJUST_VIEW_CONNECTION( AdjustParametersConfirmRequestData) } /** - * \brief VCreateTreatment::loadTreatmentParameterRanges - * Loads treatment parameters from a json file - * \return QJsonObject holding the treatment parameters - */ -QJsonObject VTreatmentCreate::loadTreatmentParameterRanges(const QString &path) -{ - QJsonObject obj; - if (!FileHandler::read(path, obj)) - { - // TODO: notify user - LOG_EVENT(tr("Could not load treatment parameter ranges from %1").arg(path)); - return QJsonObject(); - } - - foreach (const QString& key, obj.keys()) - { - QJsonValue value = obj.value(key); - - if (key == GET_VARIABLE_NAME(bloodFlowRateMin)) _bloodFlowRateMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(bloodFlowRateMax)) _bloodFlowRateMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(dialysateFlowRateMin)) _dialysateFlowRateMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(dialysateFlowRateMax)) _dialysateFlowRateMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(durationMin)) _durationMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(durationMax)) _durationMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinDispensingRateMin)) _heparinDispensingRateMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinDispensingRateMax)) _heparinDispensingRateMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinBolusVolumeMin)) _heparinBolusVolumeMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinBolusVolumeMax)) _heparinBolusVolumeMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinStopTimeMin)) _heparinStopTimeMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(heparinStopTimeMax)) _heparinStopTimeMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(salineBolusVolumeMin)) _salineBolusVolumeMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(salineBolusVolumeMax)) _salineBolusVolumeMax = value.toInt(); - // options - else if (key == GET_VARIABLE_NAME(acidConcentrateOptions)) _acidConcentrateOptions = jsonArrayToStringList(value.toArray()); - else if (key == GET_VARIABLE_NAME(bicarbonateConcentrateOptions)) _bicarbonateConcentrateOptions = jsonArrayToStringList(value.toArray()); - else if (key == GET_VARIABLE_NAME(dialyzerTypeOptions)) _dialyzerTypeOptions = jsonArrayToStringList(value.toArray()); - - else if (key == GET_VARIABLE_NAME(dialysateTempMin)) _dialysateTempMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(dialysateTempMax)) _dialysateTempMax = value.toInt(); - // arterial - else if (key == GET_VARIABLE_NAME(arterialPressureLimitLowMin)) _arterialPressureLimitLowMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(arterialPressureLimitLowMax)) _arterialPressureLimitLowMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(arterialPressureLimitHighMin)) _arterialPressureLimitHighMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(arterialPressureLimitHighMax)) _arterialPressureLimitHighMax = value.toInt(); - // venous - else if (key == GET_VARIABLE_NAME(venousPressureLimitLowMin)) _venousPressureLimitLowMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(venousPressureLimitLowMax)) _venousPressureLimitLowMax = value.toInt(); - else if (key == GET_VARIABLE_NAME(venousPressureLimitHighMin)) _venousPressureLimitHighMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(venousPressureLimitHighMax)) _venousPressureLimitHighMax = value.toInt(); - - else if (key == GET_VARIABLE_NAME(bloodPressureMeasureIntervalMin)) _bloodPressureMeasureIntervalMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(bloodPressureMeasureIntervalMax)) _bloodPressureMeasureIntervalMax = value.toInt(); - - else if (key == GET_VARIABLE_NAME(rinsebackFlowRateMin)) _rinsebackFlowRateMin = value.toInt(); - else if (key == GET_VARIABLE_NAME(rinsebackFlowRateMax)) _rinsebackFlowRateMax = value.toInt(); - else - { - qDebug() << "Invalid treatment parameter range: " << key; - LOG_EVENT(tr("Invalid treatment parameter found: %0").arg(key)); - } - } - - return obj; -} - -/** * \brief VCreateTreatment::onResetCreateTreatment * Resets the create treatment page to the default values. * Disables the continue button. @@ -147,23 +61,7 @@ emit resetCreateTreatment(); } - /** - * \brief VCreateTreatment::jsonArrayToStringList - * Converts a jsonarray of strings to a QStringList - * \param arr (QJsonArray) to convert - * \return (QStringList) The list of strings in the array - */ -QStringList VTreatmentCreate::jsonArrayToStringList(const QJsonArray &arr) -{ - QStringList result; - foreach (const QJsonValue &val, arr) { - result.append(val.toString()); - } - return result; -} - -/** * \brief VCreateTreatment::setTreatmentData * Assigns treatment parameters to the treatment data structure. */ @@ -190,25 +88,43 @@ } /** - * \brief VCreateTreatment::onFinishedCreate + * \brief VCreateTreatment::doValidation * Validates the treatment profile locally, then requests validation of it with FW */ -void VTreatmentCreate::doFinishedCreate() { +void VTreatmentCreate::doValidation() { setTreatmentData(); if (!validate(treatmentData)) { - qDebug() << "Local create treatment validation failed."; LOG_EVENT("Local create treatment validation failed."); return; } // Request that FW validates the selected parameters - emit requestValidateParameters(treatmentData); + emit didAdjustment(treatmentData); +} - LOG_DEBUG("Requesting FW validation of new treatment parameters"); +/** + * \brief VCreateTreatment::doConfirm + * \details Emits treatment data to GUI controller, + * who emits to application controller + * \note Finished create treatment confirm... + */ +void VTreatmentCreate::doConfirm() { + confirmTreatmentRequest.requestedState = AdjustParametersConfirmRequestData::eConfirm; + emit didAdjustment(confirmTreatmentRequest); +} +/** + * \brief VCreateTreatment::doCancel + * \details Notifies FW the user has canceled confirming the treatment parameters + * \note Telling FW user is canceling confirm treatment parameters... + */ +void VTreatmentCreate::doCancel() +{ + confirmTreatmentRequest.requestedState = AdjustParametersConfirmRequestData::eCancel; + emit didAdjustment(confirmTreatmentRequest); } /** @@ -235,8 +151,7 @@ * \param messageData The message data must contain the reject reason codes for all parameters * \returns True if FW OK's treatment parameters, false otherwise */ -bool VTreatmentCreate::doActionReceive(AdjustParametersValidationResponseData data) { - +bool VTreatmentCreate::onActionReceive(AdjustParametersValidationResponseData data) { bool success = true; if (data.bloodFlowRate != Gui::GuiRequestReasons::REQUEST_REJECT_REASON_NONE) { emit scrollToParameter(GET_VARIABLE_NAME(data.bloodFlowRate)); @@ -334,436 +249,41 @@ if (success) { emit fwValidationSuccess(); - - // goToNextPage(true); } return success; } /** - * \brief VCreateTreatment::doActionReceive - * Called when we receive a response back from firmware after requesting - * to start selecting treatment parameters, cancel, or start the treatment - * @param messageData - */ -void VTreatmentCreate::doActionReceive(const AdjustInitTreatmentResponseData &messageData) -{ - if (messageData.mAccepted != 1) - return; - - if (initTreatmentRequest.requestedState == AdjustInitTreatmentRequestData::eCancel) { - //goToNextPage(false); - } - else { - //goToNextPage(true); - } -} - -/** - * \brief VCreateTreatment::getNextPage - * \details Updates the current page to the next page after - * moving forward or backward - * \param forward - (bool) true if moving forward, if false pop the page - */ -void VTreatmentCreate::goToNextPage(bool forward) -{ - qDebug() << __FUNCTION__ << pageToShow; - - switch (pageToShow) - { - case None: { - // coco begin validated: Has been manually validated - if (forward) { - pageToShow = CreateTreatment; - emit showCreate(); - } - break; - } -// coco end - case CreateTreatment: { - if (forward) { - pageToShow = ConfirmTreatment; - emit showConfirm(); - } - else { - pageToShow = None; - emit pop(); - } - break; - } - case ConfirmTreatment: { - if (forward) { - pageToShow = Priming; - emit showPrime(); - } else { - pageToShow = CreateTreatment; - emit pop(); - } - break; - } - case Priming: { - if (forward) { - pageToShow = BeginTreatment; - emit showBegin(); - } else { - pageToShow = ConfirmTreatment; // TODO: won't be able to go back eventually - emit pop(); - } - break; - } - case BeginTreatment: { - if (forward) { - // reset for next time a treatment is created - pageToShow = None; - emit showTreatmentStart(); - } else { - pageToShow = Priming; - emit pop(); - } - break; - } - // coco begin validated: This has been validated manually. - default: { - LOG_EVENT("Invalid current page."); - } - } -} -// coco end - -/** - * \brief VCreateTreatment::onFinishedConfirm - * \details Emits treatment data to gui controller, - * who emits to application controller and the - * application controller will save the data to disk. - * \note Finished create treatment confirm... - */ -void VTreatmentCreate::doFinishedConfirm() { - QJsonObject obj { - {"bloodFlowRate", QString::number(treatmentData.bloodFlowRate)}, - {"dialysateFlowRate", QString::number(treatmentData.dialysateFlowRate)}, - {"duration", QString::number(treatmentData.duration)}, - {"heparinDispensingRate", QString::number(treatmentData.heparinDispensingRate)}, - {"heparinBolusVolume", QString::number(treatmentData.heparinBolusVolume)}, - {"heparinStopTime", QString::number(treatmentData.heparinStopTime)}, - {"acidConcentrate", QString::number(treatmentData.acidConcentrate)}, - {"bicarbonateConcentrate", QString::number(treatmentData.bicarbonateConcentrate)}, - {"dialyzerType", QString::number(treatmentData.dialyzerType)}, - {"dialysateTemp", QString::number(treatmentData.dialysateTemp)}, - {"arterialPressureLimitLow", QString::number(treatmentData.arterialPressureLimitLow)}, - {"arterialPressureLimitHigh", QString::number(treatmentData.arterialPressureLimitHigh)}, - {"venousPressureLimitLow", QString::number(treatmentData.venousPressureLimitLow)}, - {"venousPressureLimitHigh", QString::number(treatmentData.venousPressureLimitHigh)}, - {"bloodPressureMeasureInterval",QString::number(treatmentData.bloodPressureMeasureInterval)}, - {"rinsebackFlowRate", QString::number(treatmentData.rinsebackFlowRate)} - }; - - QString treatmentParameters = QJsonDocument(obj).toJson(QJsonDocument::Indented); - LOG_EVENT(QString("Create Treatment Confirm: %1").arg(treatmentParameters)); - if (saveTreatmentProfile()) - saveNewTreatment(obj); - - // Tell FW we confirm - confirmTreatmentRequest.requestedState = AdjustParametersConfirmRequestData::eConfirm; - emit requestConfirm(confirmTreatmentRequest); - - // no FW response required - // goToNextPage(true); -} - -/** - * \brief ApplicationController::saveNewTreatment - * \details Saves a new treatment to the file system. - * \param doc - QJsonDocument containing the new treatment parameters. - * \returns QString - the file to be written to - * - */ -QString VTreatmentCreate::saveNewTreatment(const QJsonObject &obj, const QString &dir) -{ - QJsonDocument document(obj); - int i = 0; - while (QFile(QString("%0treatment%1.json").arg(dir).arg(i)).exists()) - { - i++; - } - QString filename = QString("%0treatment%1.json").arg(dir).arg(i); - emit requestConcurrentSave(filename, document.toJson(), false); - return filename; -} - -/** - * \brief VCreateTreatment::getParameterRangesDataCSV - * \details Gets the parameter ranges data prepared for CSV file format - * \return QString - the data to write to CSV - */ -QString VTreatmentCreate::getParameterRangesDataCSV() -{ - QString csvData; - QString sep = ","; - - csvData += QString("bloodFlowRateMin,%0\n").arg(bloodFlowRateMin()); - csvData += QString("bloodFlowRateMax,%0\n").arg(bloodFlowRateMax()); - csvData += QString("dialysateFlowRateMin,%0\n").arg(dialysateFlowRateMin()); - csvData += QString("dialysateFlowRateMax,%0\n").arg(dialysateFlowRateMax()); - csvData += QString("durationMin,%0\n").arg(durationMin()); - csvData += QString("durationMax,%0\n").arg(durationMax()); - csvData += QString("heparinDispensingRateMin,%0\n").arg(heparinDispensingRateMin()); - csvData += QString("heparinDispensingRateMax,%0\n").arg(heparinDispensingRateMax()); - csvData += QString("heparinBolusVolumeMin,%0\n").arg(heparinBolusVolumeMin()); - csvData += QString("heparinBolusVolumeMax,%0\n").arg(heparinBolusVolumeMax()); - csvData += QString("heparinStopTimeMin,%0\n").arg(heparinStopTimeMin()); - csvData += QString("heparinStopTimeMax,%0\n").arg(heparinStopTimeMax()); - csvData += QString("salineBolusVolumeMin,%0\n").arg(salineBolusVolumeMin()); - csvData += QString("salineBolusVolumeMax,%0\n").arg(salineBolusVolumeMax()); - csvData += QString("acidConcentrateOptions,%0\n").arg(acidConcentrateOptions().join(sep)); - csvData += QString("bicarbonateConcentrateOptions,%0\n").arg(bicarbonateConcentrateOptions().join(sep)); - csvData += QString("dialyzerTypeOptions,%0\n").arg(dialyzerTypeOptions().join(sep)); - csvData += QString("dialysateTempMin,%0\n").arg(dialysateTempMin()); - csvData += QString("dialysateTempMax,%0\n").arg(dialysateTempMax()); - csvData += QString("arterialPressureLimitLowMin,%0\n").arg(arterialPressureLimitLowMin()); - csvData += QString("arterialPressureLimitLowMax,%0\n").arg(arterialPressureLimitLowMax()); - csvData += QString("arterialPressureLimitHighMin,%0\n").arg(arterialPressureLimitHighMin()); - csvData += QString("arterialPressureLimitHighMax,%0\n").arg(arterialPressureLimitHighMax()); - csvData += QString("venousPressureLimitLowMin,%0\n").arg(venousPressureLimitLowMin()); - csvData += QString("venousPressureLimitLowMax,%0\n").arg(venousPressureLimitLowMax()); - csvData += QString("venousPressureLimitHighMin,%0\n").arg(venousPressureLimitHighMin()); - csvData += QString("venousPressureLimitHighMax,%0\n").arg(venousPressureLimitHighMax()); - csvData += QString("bloodPressureMeasureIntervalMin,%0\n").arg(bloodPressureMeasureIntervalMin()); - csvData += QString("bloodPressureMeasureIntervalMax,%0\n").arg(bloodPressureMeasureIntervalMax()); - csvData += QString("rinsebackFlowRateMin,%0\n").arg(rinsebackFlowRateMin()); - csvData += QString("rinsebackFlowRateMax,%0\n").arg(rinsebackFlowRateMax()); - - return csvData; -} - -/*! - * \brief VCreateTreatment::saveTreatmentRangesCSV - * \details Saves the treatment ranges to a CSV file - * \param filename - the csv file to save the ranges to - * \return bool - true if successful, false otherwise - */ -bool VTreatmentCreate::saveTreatmentRangesCSV(const QString &filename) -{ - QString csvData = getParameterRangesDataCSV(); - return FileHandler::write(filename, csvData); -} - -void VTreatmentCreate::onFinishedSaveNewTreatment(bool success) -{ - if (success) { - qDebug() << "------------------> Saved a new treatment."; - } else { - qDebug() << "------------------> Failed to save new treatment."; - } -} - -/** - * \brief VCreateTreatment::onFnishedPrime - * \details Called when priming qml selections are complete. - * \note Finished create treatment prime... - * \todo Placed here for now. Likely will be moved eventually. - */ -void VTreatmentCreate::doFinishedPrime() { - // goToNextPage(true); -} - -/** - * \brief VCreateTreatment::start - * \details Called when user is ready to begin a new treatment. - */ -void VTreatmentCreate::doStartTreatment() { - qDebug() << "Requesting to start a treatment..."; - initTreatmentRequest.requestedState = AdjustInitTreatmentRequestData::eInitiate; - emit requestSelectParameters(initTreatmentRequest); -} - -/** * \brief VCreateTreatment::validate * \details Validates the create new treatment input. * \param vData - the selected TreatmentParametersData * \return true on success, false otherwise. */ bool VTreatmentCreate::validate(const AdjustParametersValidationRequestData &vData) { - bool success = true; - - if (!isbloodFlowRateSet) - success = false; - - if (!isdialysateFlowRateSet) - success = false; - - if (!isdurationSet) - success = false; - - if (!isheparinDispensingRateSet) - success = false; - - if (!isheparinBolusVolumeSet) - success = false; - - if (!isheparinStopTimeSet) - success = false; - - if (!issalineBolusVolumeSet) - success = false; - - if (!isacidConcentrateSet) - success = false; - - if (!isbicarbonateConcentrateSet) - success = false; - - if (!isdialyzerTypeSet) - success = false; - - if (!isdialysateTempSet) - success = false; - - if (!isarterialPressureLimitLowSet) - success = false; - - if (!isarterialPressureLimitHighSet) - success = false; - - if (!isvenousPressureLimitLowSet) - success = false; - - if (!isvenousPressureLimitHighSet) - success = false; - - if (!isbloodPressureMeasureIntervalSet) - success = false; - - if (!isrinsebackFlowRateSet) - success = false; - - if (!success) { - return false; - } - if (vData.bloodFlowRate < _bloodFlowRateMin || - vData.bloodFlowRate > _bloodFlowRateMax) - { - emit bloodFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.dialysateFlowRate < _dialysateFlowRateMin || - vData.dialysateFlowRate > _dialysateFlowRateMax ) - { - emit dialysateFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.duration < _durationMin || vData.duration > _durationMax) - { - emit duration_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.heparinDispensingRate < _heparinDispensingRateMin || - vData.heparinDispensingRate > _heparinDispensingRateMax) - { - emit heparinDispensingRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.heparinBolusVolume < _heparinBolusVolumeMin || - vData.heparinBolusVolume > _heparinBolusVolumeMax) - { - emit heparinBolusVolume_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - - if (vData.heparinStopTime < _heparinStopTimeMin || - vData.heparinStopTime > _heparinStopTimeMax) - { - emit heparinStopTime_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - - if (vData.salineBolus < _salineBolusVolumeMin || - vData.salineBolus > _salineBolusVolumeMax) - { - emit salineBolusVolume_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (!indexInItems(vData.acidConcentrate, _acidConcentrateOptions)) - { - emit acidConcentrate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (!indexInItems(vData.bicarbonateConcentrate, _bicarbonateConcentrateOptions)) - { - emit bicarbonateConcentrate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (!indexInItems(vData.dialyzerType, _dialyzerTypeOptions)) - { - emit dialyzerType_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.dialysateTemp < _dialysateTempMin || - vData.dialysateTemp > _dialysateTempMax) - { - emit dialysateTemp_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.arterialPressureLimitLow < _arterialPressureLimitLowMin || - vData.arterialPressureLimitLow > _arterialPressureLimitLowMax || - vData.arterialPressureLimitLow >= vData.arterialPressureLimitHigh) - { - emit arterialPressureLimitLow_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); - success = false; - } - if (vData.arterialPressureLimitHigh < _arterialPressureLimitHighMin || - vData.arterialPressureLimitHigh > _arterialPressureLimitHighMax || - vData.arterialPressureLimitHigh <= vData.arterialPressureLimitLow) - { - emit arterialPressureLimitHigh_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); - success = false; - } - if (vData.venousPressureLimitLow < _venousPressureLimitLowMin || - vData.venousPressureLimitLow > _venousPressureLimitLowMax || - vData.venousPressureLimitLow >= vData.venousPressureLimitHigh) - { - emit venousPressureLimitLow_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); - success = false; - } - if (vData.venousPressureLimitHigh < _venousPressureLimitHighMin || - vData.venousPressureLimitHigh > _venousPressureLimitHighMax || - vData.venousPressureLimitHigh <= vData.venousPressureLimitLow) - { - emit venousPressureLimitHigh_ValidationFailed(uiRejections.value(LOW_HIGH_INCOMPATIBLE)); - success = false; - } - if (vData.bloodPressureMeasureInterval < _bloodPressureMeasureIntervalMin || - vData.bloodPressureMeasureInterval > _bloodPressureMeasureIntervalMax) - { - emit bloodPressureMeasureInterval_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - if (vData.rinsebackFlowRate < _rinsebackFlowRateMin || - vData.rinsebackFlowRate > _rinsebackFlowRateMax) - { - emit rinsebackFlowRate_ValidationFailed(uiRejections.value(OUT_OF_RANGE)); - success = false; - } - return success; + Q_UNUSED(vData) + if (!isbloodFlowRateSet ) return false; + if (!isdialysateFlowRateSet ) return false; + if (!isdurationSet ) return false; + if (!isheparinDispensingRateSet ) return false; + if (!isheparinBolusVolumeSet ) return false; + if (!isheparinStopTimeSet ) return false; + if (!issalineBolusVolumeSet ) return false; + if (!isacidConcentrateSet ) return false; + if (!isbicarbonateConcentrateSet ) return false; + if (!isdialyzerTypeSet ) return false; + if (!isdialysateTempSet ) return false; + if (!isarterialPressureLimitLowSet ) return false; + if (!isarterialPressureLimitHighSet ) return false; + if (!isvenousPressureLimitLowSet ) return false; + if (!isvenousPressureLimitHighSet ) return false; + if (!isbloodPressureMeasureIntervalSet ) return false; + if (!isrinsebackFlowRateSet ) return false; + return true; } /** - * \brief VCreateTreatment::indexInItems - * \details Checks if the index is in the QStringList - * \param idx (int) the index - * \param items (QStringList) The list of strings to check - * \return True if it is in the list, false otherwise - */ -bool VTreatmentCreate::indexInItems(quint32 idx, const QStringList &items) -{ - if (idx > (quint32)items.size() - 1) - return false; - else - return true; -} - -/** * \brief VCreateTreatment::doUserModifiedParameters * Manages enabling / disabling the continue button */ @@ -837,6 +357,7 @@ QString aConcentrate; QString bCarbConcentrate; QString dType; + qDebug() << acidConcentrateOptions().length(); if ((acidConcentrateOptions().length() - 1 < (int)_acidConcentrate)) aConcentrate = "None"; else @@ -860,46 +381,3 @@ << QString("%0 min").arg(_bloodPressureMeasureInterval) << QString("%0 min").arg(_rinsebackFlowRate); } - -/** - * \brief VCreateTreatment::doSelectParameters - * \details Sends a request to FW to start selecting treatment parameters - * \note Sending request to FW to select parameters... - */ -void VTreatmentCreate::doSelectParameters() -{ - initTreatmentRequest.requestedState = AdjustInitTreatmentRequestData::eInitiate; - emit requestSelectParameters(initTreatmentRequest); -} - -/** - * \brief VCreateTreatment::doCancelSelectingParameters - * \details Sends a request to FW to cancel selecting parameters - * \note Sending request to FW to cancel selecting parameters... - */ -void VTreatmentCreate::doCancelSelectingParameters() -{ - initTreatmentRequest.requestedState = AdjustInitTreatmentRequestData::eCancel; - emit requestSelectParameters(initTreatmentRequest); -} - -/** - * \brief VCreateTreatment::doCancelConfirmParameters - * \details Notifies FW the user has canceled confirming the treatment parameters - * \note Telling FW user is canceling confirm treatment parameters... - */ -void VTreatmentCreate::doCancelConfirmParameters() -{ - confirmTreatmentRequest.requestedState = AdjustParametersConfirmRequestData::eCancel; - emit requestConfirm(confirmTreatmentRequest); - // goToNextPage(false); -} - -/** - * \brief VCreateTreatment::doRequestPop - * \details Navigates backward in the create treatment process. - */ -void VTreatmentCreate::doRequestPop() -{ - // goToNextPage(false); -}