Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -rfcfa029b4a6d30ff8aa8162de7573545f3cf7052 -r656a6e14a253c7125fa8408ae2aa0c1223009565 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision fcfa029b4a6d30ff8aa8162de7573545f3cf7052) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 656a6e14a253c7125fa8408ae2aa0c1223009565) @@ -66,6 +66,31 @@ } } + function resetParameters() { + scrollTo(_titleTextPrescription) + + _bloodFlowRate .resetParameter() + _dialysateFlowRate .resetParameter() + _duration .resetParameter() + + _heparinDispensingRateSwitch.resetSwitch () + _heparinDispensingRate .resetParameter() + + _heparinBolusVolumeSwitch .resetSwitch () + _heparinBolusVolume .resetParameter() + + _heparinStopTime .resetParameter() + _salineBolus .resetParameter() + _heparinType .resetSelection() + _acidConcentrate .resetSelection() + _bicarbonateConcentrate .resetSelection() + _dialyzerType .resetSelection() + _dialysateTemperature .resetParameter() + + _bloodPressureIntervalSwitch.resetSwitch () + _bloodPressureInterval .resetParameter() + } + function setInteractive(vInteractive) { _flickable.interactive = vInteractive } @@ -74,7 +99,6 @@ _flickable.contentY = vItem.mapToItem(_flickable.contentItem, 0, 0).y } - ScrollBar { flickable : _flickable anchors.fill: _flickable @@ -109,6 +133,40 @@ font.bold: true } + TouchRect { id: _prepopulateApplyButton + textString: qsTr("Pre-populate last parameters") + anchors.horizontalCenter: parent.horizontalCenter + enabled : vTreatmentCreate.isLastConfirmedParametersPopulated + onClicked : { + // Update the underlying properties with the last confirmed stored parameter + vTreatmentCreate.prepopulateParameters() + + // Update the sliders, switches, and type selections on the screen + _bloodFlowRate .prepopulate(vTreatmentCreate.bloodFlowRate ) + _dialysateFlowRate .prepopulate(vTreatmentCreate.dialysateFlowRate) + _duration .prepopulate(vTreatmentCreate.treatmentDuration) + + _heparinDispensingRateSwitch.setSwitchActive(vTreatmentCreate.heparinDispensingRate != 0) // Switch for rates, considering 0 as OFF + _heparinDispensingRate .prepopulate (vTreatmentCreate.heparinDispensingRate ) + + _heparinBolusVolumeSwitch.setSwitchActive(vTreatmentCreate.heparinBolusVolume != 0) // Switch for rates, considering 0 as OFF + _heparinBolusVolume .prepopulate (vTreatmentCreate.heparinBolusVolume ) + + _heparinStopTime .prepopulate(vTreatmentCreate.heparinStopTime ) + _salineBolus .prepopulate(vTreatmentCreate.salineBolusVolume) + + _heparinType .setSelection(vTreatmentCreate.heparinType ) + _acidConcentrate .setSelection(vTreatmentCreate.acidConcentrate ) + _bicarbonateConcentrate .setSelection(vTreatmentCreate.bicarbonateConcentrate ) + _dialyzerType .setSelection(vTreatmentCreate.dialyzerType ) + + _dialysateTemperature .prepopulate(vTreatmentCreate.dialysateTemp ) + + _bloodPressureIntervalSwitch.setSwitchActive(vTreatmentCreate.bloodPressureMeasureInterval != 0) // Switch for rates, considering 0 as OFF + _bloodPressureInterval .prepopulate (vTreatmentCreate.bloodPressureMeasureInterval ) + } + } + SliderCreateTreatment { id: _bloodFlowRate objectName : "_bloodFlowRate" label : qsTr("Blood Flow Rate") @@ -218,16 +276,36 @@ // This is a full implementation of a Switch Switch { id: _heparinDispensingRateSwitch property bool active: false + function resetSwitch() { + // order of setting active and checked matters, need to set checked to + // false first before active to false to obtain the correct behavior. + checked = false + active = false + } + + function setSwitchActive(vChecked) { + // order of setting active and checked matters, need to set active to + // true first before checked to passed value to obtain the correct behavior. + active = true + checked = vChecked + } + onActiveChanged : { _heparinDispensingRate.active = active } + onCheckedChanged: { if ( ! active ) { active = true checked = ! checked } - vTreatmentCreate.heparinDispensingRate = 0 - _heparinDispensingRate.reset ( 0 ) + + if(!checked) { + // Reset the slider value to 0 only when we have it set to OFF + vTreatmentCreate.heparinDispensingRate = 0 + _heparinDispensingRate.reset ( 0 ) + } + _heparinDispensingRate.active = ! checked } @@ -304,11 +382,29 @@ active = true checked = ! checked } - vTreatmentCreate.heparinBolusVolume = 0 - _heparinBolusVolume.reset ( 0 ) + + if(!checked) { + // Reset the slider value to 0 only when we have it set to OFF + vTreatmentCreate.heparinBolusVolume = 0 + _heparinBolusVolume.reset ( 0 ) + } + _heparinBolusVolume.active = ! checked } + function resetSwitch() { + // order of setting active and checked matters, need to set checked to + // false first before active to false to obtain the correct behavior. + checked = false + active = false + } + function setSwitchActive(vChecked) { + // order of setting active and checked matters, need to set active to + // true first before checked to passed value to obtain the correct behavior. + active = true + checked = vChecked + } + x : width * -1.5 y : Variables.createTreatmentSwitchYDisplacement // these values are set to align the switch with slider width : 75 // these values are set to align the switch with slider @@ -416,6 +512,11 @@ valid : ! vTreatmentCreate.heparinTypeRejectReason onCurIndexChanged : vTreatmentCreate.heparinTypeRejectReason = Variables.noRejectReason + onSelectionResetted:{ + // not resetting enabled state since that is bind to checked state of swtiches + vTreatmentCreate.heparinType = -1 + vTreatmentCreate.heparinTypeSet = false + } } GridSelection { id : _acidConcentrate @@ -426,6 +527,11 @@ valid : ! vTreatmentCreate.acidConcentrateRejectReason onCurIndexChanged : vTreatmentCreate.acidConcentrateRejectReason = Variables.noRejectReason + onSelectionResetted:{ + // not resetting enabled state since that is bind to checked state of swtiches + vTreatmentCreate.acidConcentrate = -1 + vTreatmentCreate.acidConcentrateSet = false + } } GridSelection { id : _bicarbonateConcentrate @@ -436,6 +542,11 @@ valid : ! vTreatmentCreate.bicarbonateConcentrateRejectReason onCurIndexChanged : vTreatmentCreate.bicarbonateConcentrateRejectReason = Variables.noRejectReason + onSelectionResetted:{ + // not resetting enabled state since that is bind to checked state of swtiches + vTreatmentCreate.bicarbonateConcentrate = -1 + vTreatmentCreate.bicarbonateConcentrateSet = false + } } GridSelection { id : _dialyzerType @@ -446,6 +557,11 @@ valid : ! vTreatmentCreate.dialyzerTypeRejectReason onCurIndexChanged : vTreatmentCreate.dialyzerTypeRejectReason = Variables.noRejectReason + onSelectionResetted:{ + // not resetting enabled state since that is bind to checked state of swtiches + vTreatmentCreate.dialyzerType = -1 + vTreatmentCreate.dialyzerTypeSet = false + } } Item { height: 1; width: 1 /* TODO : there is a design flaw in here, this is a workaround */ } @@ -758,12 +874,30 @@ active = true checked = ! checked } - vTreatmentCreate.bloodPressureMeasureInterval = 0 - _bloodPressureInterval.reset ( 0 ) + + if(!checked) { + // Reset the slider value to 0 only when we have it set to OFF + vTreatmentCreate.bloodPressureMeasureInterval = 0 + _bloodPressureInterval.reset ( 0 ) + } + _bloodPressureInterval.active = ! checked } + function resetSwitch() { + // order of setting active and checked matters, need to set checked to + // false first before active to false to obtain the correct behavior. + checked = false + active = false + } + function setSwitchActive(vChecked) { + // order of setting active and checked matters, need to set active to + // true first before checked to passed value to obtain the correct behavior. + active = true + checked = vChecked + } + x : width * -1.5 y : Variables.createTreatmentSwitchYDisplacement // these values are set to align the switch with slider width : 75 // these values are set to align the switch with slider