Index: sources/view/VCreateTreatment.cpp =================================================================== diff -u -rfe1cc7af9637a8485b6948b50eb5fb06e4c83740 -r542278273f3d13ad5fb5ba8916178d747c78fe77 --- sources/view/VCreateTreatment.cpp (.../VCreateTreatment.cpp) (revision fe1cc7af9637a8485b6948b50eb5fb06e4c83740) +++ sources/view/VCreateTreatment.cpp (.../VCreateTreatment.cpp) (revision 542278273f3d13ad5fb5ba8916178d747c78fe77) @@ -22,20 +22,20 @@ connect(&_GuiController, SIGNAL(didActionReceive(GuiActionType,QVariantList)), this, SLOT(onFWValidationResponse(GuiActionType,QVariantList))); - loadTreatmentParameterRanges(); } /** - * @brief VCreateTreatment::loadTreatmentParameterRanges + * \brief VCreateTreatment::loadTreatmentParameterRanges * Loads treatment parameters from a json file - * @return QJsonObject holding the treatment parameters + * \return QJsonObject holding the treatment parameters */ QJsonObject VCreateTreatment::loadTreatmentParameterRanges() { + // coco begin validated: The treatment parameters file needs to be present QJsonObject obj; if (!FileHandler::readJSON(Treatment_Parameter_Ranges_Path, obj)) { - // TODO: handle error + // TODO: notify user } foreach (const QString& key, obj.keys()) @@ -117,13 +117,13 @@ } } - return obj; + // coco end } /** - * @brief VCreateTreatment::onResetCreateTreatment + * \brief VCreateTreatment::onResetCreateTreatment * Resets the create treatment page to the default values. * Disables the continue button. */ @@ -153,10 +153,10 @@ /** - * @brief VCreateTreatment::jsonArrayToStringList + * \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 + * \param arr (QJsonArray) to convert + * \return (QStringList) The list of strings in the array */ QStringList VCreateTreatment::jsonArrayToStringList(const QJsonArray &arr) { @@ -168,7 +168,7 @@ } /** - * @brief VCreateTreatment::setTreatmentData + * \brief VCreateTreatment::setTreatmentData * Assigns treatment parameters to the treatment data structure. */ void VCreateTreatment::setTreatmentData() { @@ -194,7 +194,7 @@ } /** - * @brief VCreateTreatment::onFinishedCreate + * \brief VCreateTreatment::onFinishedCreate * Validates the treatment profile locally, then requests validation of it with FW */ void VCreateTreatment::onFinishedCreate() { @@ -243,10 +243,10 @@ } /** - * @brief VCreateTreatment::enumToString + * \brief VCreateTreatment::enumToString * Convenience functiont to convert an enum to a string - * @param vEnum - the enum value - * @return QString - the enum name + * \param vEnum - the enum value + * \return QString - the enum name */ QString VCreateTreatment::enumToString(GuiRequestReasons vEnum) { @@ -260,10 +260,10 @@ } /** - * @brief VCreateTreatment::onFWValidationResponse + * \brief VCreateTreatment::onFWValidationResponse * Slot to handle a validation response from FW - * @param actionType The action type must be a create treatment response - * @param messageData The message data must contain the reject reason codes for all parameters + * \param actionType The action type must be a create treatment response + * \param messageData The message data must contain the reject reason codes for all parameters */ void VCreateTreatment::onFWValidationResponse(GuiActionType actionType, QVariantList messageData) { @@ -355,7 +355,7 @@ } /** - * @brief VCreateTreatment::onFinishedConfirm + * \brief VCreateTreatment::onFinishedConfirm * Emits treatment data to gui controller, * who emits to application controller and the * application controller will save the data to disk. @@ -392,11 +392,13 @@ } /** - * @brief ApplicationController::saveNewTreatment + * \brief ApplicationController::saveNewTreatment * Saves a new treatment to the filesystem. - * @param doc - QJsonDocument containing the new treatment parameters. + * \param doc - QJsonDocument containing the new treatment parameters. + * \returns QString - the file to be written to + * */ -void VCreateTreatment::saveNewTreatment(QJsonObject obj) +QString VCreateTreatment::saveNewTreatment(QJsonObject obj) { QJsonDocument document(obj); int i = 0; @@ -406,6 +408,7 @@ } QString filename = QString("%0treatment%1.json").arg(Treatment_Profiles_Dir).arg(i); _FileSaver.concurrentSave(filename, document.toJson(), false); + return filename; } @@ -419,7 +422,7 @@ } /** - * @brief VCreateTreatment::onFnishedPrime + * \brief VCreateTreatment::onFnishedPrime * Called when priming qml selections are complete. * TODO: Placed here for now. Likely will be moved eventually. */ @@ -430,7 +433,7 @@ } /** - * @brief VCreateTreatment::start + * \brief VCreateTreatment::start * Called when user is ready to begin a new treatment. * TODO: Placed here for now. Likely will be moved eventually. */ @@ -440,10 +443,10 @@ } /** - * @brief VCreateTreatment::validate + * \brief VCreateTreatment::validate * Validates the create new treatment input. - * @param vData - the selected TreatmentData - * @return true on success, false otherwise. + * \param vData - the selected TreatmentData + * \return true on success, false otherwise. */ bool VCreateTreatment::validate(const TreatmentData &vData) { @@ -464,6 +467,9 @@ if (!isheparinBolusVolumeSet) success = false; + if (!isheparinStopTimeSet) + success = false; + if (!issalineBolusVolumeSet) success = false; @@ -500,7 +506,6 @@ if (!success) { return false; } - if (vData.bloodFlowRate < _bloodFlowRateMin || vData.bloodFlowRate > _bloodFlowRateMax) { @@ -610,11 +615,11 @@ } /** - * @brief VCreateTreatment::indexInItems + * \brief VCreateTreatment::indexInItems * 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 + * \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 VCreateTreatment::indexInItems(quint32 idx, const QStringList &items) { @@ -626,7 +631,7 @@ } /** - * @brief VCreateTreatment::onUserModifiedParameters + * \brief VCreateTreatment::onUserModifiedParameters * Manages enabling / disabling the continue button */ void VCreateTreatment::onUserModifiedParameters()