Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml =================================================================== diff -u -r1f6d3544ea05941cd4c4d5ebf48603d2668cb421 -r40ddf63592b60608ae34aeb3099fe4e62ae45054 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml (.../PreTreatmentCreateContent.qml) (revision 1f6d3544ea05941cd4c4d5ebf48603d2668cb421) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateContent.qml (.../PreTreatmentCreateContent.qml) (revision 40ddf63592b60608ae34aeb3099fe4e62ae45054) @@ -39,10 +39,41 @@ property bool editingEnabled : true - onIsValidatedChanged : if ( ! isValidated ) { enableEditing () } + onIsValidatedChanged : canEdit ( ! isValidated ) - function enableEditing () { editingEnabled = true } + function canEdit (state) { editingEnabled = state } + function activateAndSync() { + syncAll () // needs to be first + _bloodFlowRateControl .active = true + _dialysateFlowRateControl .active = true + _durationControl .active = true + _heparinDispensingRateControl .active = true + _heparinBolusVolumeControl .active = true + _heparinStopTimeControl .active = true + _acidConcentrateComboBox .active = true + _bicarbonateConcentrateComboBox .active = true + _dialyzerTypeComboBox .active = true + _dialysateTemperatureControl .active = true + _salineBolusVolumeControl .active = true + _bpMeasurementIntervalControl .active = true + } + + function syncAll () { + _bloodFlowRateControl .sync() + _dialysateFlowRateControl .sync() + _durationControl .sync() + _heparinDispensingRateControl .sync() + _heparinBolusVolumeControl .sync() + _heparinStopTimeControl .sync() + _acidConcentrateComboBox .sync() + _bicarbonateConcentrateComboBox .sync() + _dialyzerTypeComboBox .sync() + _dialysateTemperatureControl .sync() + _salineBolusVolumeControl .sync() + _bpMeasurementIntervalControl .sync() + } + function clear () { vTreatmentCreate.patientID = "" _bloodFlowRateControl .clear() @@ -58,7 +89,7 @@ _salineBolusVolumeControl .clear() _bpMeasurementIntervalControl .clear() clearErrors() - enableEditing () + canEdit (true) } function clearErrors() { @@ -108,10 +139,13 @@ function onDidValidationPass ( vValue ) { vPostTreatmentAdjustmentTreatmentLog.heparinDispensingRateOff = vTreatmentCreate.heparinDispensingRateOff = ! vTreatmentCreate.heparinDispensingRate vPostTreatmentAdjustmentTreatmentLog.heparinBolusVolumeOff = vTreatmentCreate.heparinBolusVolumeOff = ! vTreatmentCreate.heparinBolusVolume - + activateAndSync() // sync on validation clearErrors() - _root.editingEnabled = false } + + function onDidClear() { + _root.clear() + } } Connections { target: _acidConcentrateAdjustment @@ -146,7 +180,8 @@ verticalCenterOffset: 5 } - model : [qsTr("Edit Rx"), qsTr("Select Rx"), qsTr("Clear All")] + model : ! vTreatmentCreate.parametersValidated ? [ qsTr("Select Rx"), qsTr("Clear All") ]: + [ qsTr("Edit Rx"), qsTr("Select Rx"), qsTr("Clear All") ] height : 50 width : 75 dropDownWidth : 250 @@ -155,18 +190,24 @@ displayText : "" iconSource : "qrc:/images/iMenuDot" backgroundColor : Colors.transparent - visible : ! vTreatmentCreate.parametersValidated + visible : ! vTDOpMode.inTreatment onActivated: { - switch (currentIndex) { + let actualIndex = currentIndex + // only send AdjustParametersConfirmRequestData::eCancel when validated + // Telling FW user is canceling confirm treatment parameters + if ( vTreatmentCreate.parametersValidated ) { vTreatmentCreate.doCancel() } + else { actualIndex++ } + + switch (actualIndex) { case PreTreatmentCreateContent.Edit: - _root.enableEditing() + // now handled above by 'vTreatmentCreate.doCancel()' monitoring 'vTreatmentCreate.parametersValidated' break case PreTreatmentCreateContent.Select: - print("TODO: Open and Select from Prescription Manager " ) + print("TODO: Open and Select from Prescription Manager" ) break case PreTreatmentCreateContent.Clear: - _root.clear() + vTreatmentCreate.doClear() break default: // Unknown state break @@ -236,6 +277,7 @@ maximum : vTreatmentRanges.bloodFlowRateMax step : vTreatmentRanges.bloodFlowRateRes defaultValue : vTreatmentRanges.bloodFlowRateDef + actualValue : vTreatmentCreate.bloodFlowRate onValueChanged : { if ( ! _bloodFlowRate.valid ) { vTreatmentCreate.bloodFlowRateRejectReason = Variables.noRejectReason } vTreatmentCreate.bloodFlowRate = value @@ -254,6 +296,7 @@ maximum : vTreatmentRanges.dialysateFlowRateMax step : vTreatmentRanges.dialysateFlowRateRes defaultValue : vTreatmentRanges.dialysateFlowRateDef + actualValue : vTreatmentCreate.dialysateFlowRate onValueChanged : { if ( ! _dialysateFlowRate.valid ) { vTreatmentCreate.dialysateFlowRateRejectReason = Variables.noRejectReason } vTreatmentCreate.dialysateFlowRate = value @@ -272,6 +315,7 @@ maximum : vTreatmentRanges.treatmentDurationMax step : vTreatmentRanges.treatmentDurationRes defaultValue : vTreatmentRanges.treatmentDurationDef + actualValue : vTreatmentCreate.treatmentDuration onValueChanged : { if ( ! _duration.valid ) { vTreatmentCreate.treatmentDurationRejectReason = Variables.noRejectReason } vTreatmentCreate.treatmentDuration = value @@ -293,6 +337,7 @@ maximum : vTreatmentRanges.heparinBolusVolumeMax step : vTreatmentRanges.heparinBolusVolumeRes defaultValue : vTreatmentRanges.heparinBolusVolumeDef + actualValue : vTreatmentCreate.heparinBolusVolume decimal : Variables.heparinPrecision allowOff : true onValueChanged : { @@ -313,6 +358,7 @@ maximum : vTreatmentRanges.heparinDispensingRateMax step : vTreatmentRanges.heparinDispensingRateRes defaultValue : vTreatmentRanges.heparinDispensingRateDef + actualValue : vTreatmentCreate.heparinDispensingRate decimal : Variables.heparinPrecision allowOff : true onValueChanged : { @@ -349,6 +395,7 @@ maximum : _durationControl.value step : _durationControl.step defaultValue : _durationControl.value + actualValue : vTreatmentCreate.heparinStopTime enabled : vTreatmentCreate.heparinDispensingRate allowOff : true onValueChanged : { @@ -398,6 +445,7 @@ enabled : _root.editingEnabled currentIndex : vTreatmentCreate.acidConcentrate model : vTreatmentRanges.acidConcentrateOptions + actualValue : vTreatmentCreate.acidConcentrate onClear : { vTreatmentRanges.doClearAcidConcentrate(vTreatmentCreate.acidConcentrateSet) vTreatmentCreate.acidConcentrateSet = false @@ -425,6 +473,7 @@ enabled : _root.editingEnabled currentIndex : vTreatmentCreate.bicarbonateConcentrate model : vTreatmentRanges.bicarbonateConcentrateOptions + actualValue : vTreatmentCreate.bicarbonateConcentrate onClear : vTreatmentCreate.bicarbonateConcentrateSet = false onActivated : { if ( ! _bicarbonateConcentrate.valid ) { vTreatmentCreate.bicarbonateConcentrateRejectReason = Variables.noRejectReason } @@ -448,6 +497,7 @@ enabled : _root.editingEnabled currentIndex : vTreatmentCreate.dialyzerType model : vTreatmentRanges.dialyzerTypeOptions + actualValue : vTreatmentCreate.dialyzerType onClear : vTreatmentCreate.dialyzerTypeSet = false onActivated : { if ( ! _dialyzerType.valid ) { vTreatmentCreate.dialyzerTypeRejectReason = Variables.noRejectReason } @@ -468,6 +518,7 @@ maximum : vTreatmentRanges.dialysateTempMax step : vTreatmentRanges.dialysateTempRes defaultValue : vTreatmentRanges.dialysateTempDef + actualValue : vTreatmentCreate.dialysateTemp decimal : Variables.dialysateTempPrecision onValueChanged : { if ( ! _dialysateTemperature.valid ) { vTreatmentCreate.dialysateTempRejectReason = Variables.noRejectReason } @@ -487,6 +538,7 @@ maximum : vTreatmentRanges.salineBolusVolumeMax step : vTreatmentRanges.salineBolusVolumeRes defaultValue : vTreatmentRanges.salineBolusVolumeDef + actualValue : vTreatmentCreate.salineBolusVolume onValueChanged : { if ( ! _salineBolusVolume.valid ) { vTreatmentCreate.salineBolusVolumeRejectReason = Variables.noRejectReason } vTreatmentCreate.salineBolusVolume = value @@ -505,6 +557,7 @@ maximum : vTreatmentRanges.bloodPressureMeasureIntervalMax step : vTreatmentRanges.bloodPressureMeasureIntervalRes defaultValue : vTreatmentRanges.bloodPressureMeasureIntervalDef + actualValue : vTreatmentCreate.bloodPressureMeasureInterval allowOff : true onValueChanged : { if ( ! _bpMeasurementInterval.valid ) { vTreatmentCreate.bloodPressureMeasureIntervalRejectReason = Variables.noRejectReason }