Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -r642f08650a7a88ad6a2305fdea6bd18365aab5c7 -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 642f08650a7a88ad6a2305fdea6bd18365aab5c7) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) @@ -50,7 +50,6 @@ _bloodPressureInterval .active && _rinsebackFlowRate .active - function setInteractive(vInteractive) { _flickable.interactive = vInteractive } @@ -62,6 +61,12 @@ } Flickable { id: _flickable + function setFlickableFocus(vIsMovingTo, vYPosition) { + if ( vIsMovingTo ) { + _flickable.contentY = vYPosition + } + } + objectName: "TreatmentCreateFlickable" clip: true anchors { @@ -98,7 +103,18 @@ maximum : vTreatmentRanges.bloodFlowRateMax step : vTreatmentRanges.bloodFlowRateRes value : vTreatmentRanges.bloodFlowRateDef - onValueChanged: vTreatmentCreate.bloodFlowRate = value + valid : vTreatmentCreate.bloodFlowRateAccepted + onValueChanged : { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.bloodFlowRateAccepted = true + vTreatmentCreate.bloodFlowRate = value + } + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onBloodFlowRateAcceptedChanged() { _flickable.setFlickableFocus(!_bloodFlowRate.valid, _bloodFlowRate.y)} + } } SliderCreateTreatment { id: _dialysateFlowRate @@ -110,7 +126,17 @@ maximum : vTreatmentRanges.dialysateFlowRateMax step : vTreatmentRanges.dialysateFlowRateRes value : vTreatmentRanges.dialysateFlowRateDef - onValueChanged : vTreatmentCreate.dialysateFlowRate = value + valid : vTreatmentCreate.dialysateFlowRateAccepted + onValueChanged : { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.dialysateFlowRateAccepted = true + vTreatmentCreate.dialysateFlowRate = value + } + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onDialysateFlowRateAcceptedChanged() { _flickable.setFlickableFocus(!_dialysateFlowRate.valid, _dialysateFlowRate.y);} + } } SliderCreateTreatment { id: _duration @@ -122,7 +148,16 @@ maximum : vTreatmentRanges.treatmentDurationMax step : vTreatmentRanges.treatmentDurationRes value : vTreatmentRanges.treatmentDurationDef - onValueChanged: vTreatmentCreate.treatmentDuration = value; + valid : vTreatmentCreate.treatmentDurationAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.treatmentDurationAccepted = true + vTreatmentCreate.treatmentDuration = value + } + Connections { + target:vTreatmentCreate + function onTreatmentDurationAcceptedChanged() { _flickable.setFlickableFocus(!_duration.valid, _duration.y);} + } } Connections { target : _heparinDispensingRateSwitch @@ -166,7 +201,18 @@ maximum : vTreatmentRanges.heparinDispensingRateMax step : vTreatmentRanges.heparinDispensingRateRes value : vTreatmentRanges.heparinDispensingRateDef - onValueChanged : vTreatmentCreate.heparinDispensingRate = value + valid : vTreatmentCreate.heparinDispensingRateAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.heparinDispensingRateAccepted = true + vTreatmentCreate.heparinDispensingRate = value + } + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onHeparinDispensingRateAcceptedChanged() { _flickable.setFlickableFocus(!_heparinDispensingRate.valid, _heparinDispensingRate.y);} + } + adjustable : _heparinDispensingRateSwitch.checked inActiveZero : true enableAdjustButtons: _heparinDispensingRateSwitch.checked @@ -237,7 +283,19 @@ maximum : vTreatmentRanges.heparinBolusVolumeMax step : vTreatmentRanges.heparinBolusVolumeRes value : vTreatmentRanges.heparinBolusVolumeDef - onValueChanged : vTreatmentCreate.heparinBolusVolume = value + valid : vTreatmentCreate.heparinBolusVolumeAccepted + onValueChanged : { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.heparinBolusVolumeAccepted = true + vTreatmentCreate.heparinBolusVolume = value + } + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onHeparinBolusVolumeAcceptedChanged() { _flickable.setFlickableFocus(!_heparinBolusVolume.valid, _heparinBolusVolume.y);} + } + adjustable : _heparinBolusVolumeSwitch.checked inActiveZero : true enableAdjustButtons: _heparinBolusVolumeSwitch.checked @@ -306,7 +364,19 @@ maximum : vTreatmentRanges.heparinStopTimeMax step : vTreatmentRanges.heparinStopTimeRes value : vTreatmentRanges.heparinStopTimeDef - onValueChanged : vTreatmentCreate.heparinStopTime = value + valid : vTreatmentCreate.heparinStopTimeAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.heparinStopTimeAccepted = true + vTreatmentCreate.heparinStopTime = value + } + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onHeparinStopTimeAcceptedChanged() { _flickable.setFlickableFocus(!_heparinStopTime.valid, _heparinStopTime.y);} + } + enabled : false // this switch depends on the heparin dispencing enableAdjustButtons: _heparinDispensingRateSwitch.checked } @@ -320,7 +390,17 @@ maximum : vTreatmentRanges.salineBolusVolumeMax step : vTreatmentRanges.salineBolusVolumeRes value : vTreatmentRanges.salineBolusVolumeDef - onValueChanged : vTreatmentCreate.salineBolusVolume = value + valid : vTreatmentCreate.salineBolusVolumeAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.salineBolusVolumeAccepted = true + vTreatmentCreate.salineBolusVolume = value + } + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onSalineBolusVolumeAcceptedChanged() { _flickable.setFlickableFocus(!_salineBolus.valid, _salineBolus.y);} + } } Text { id: _titleTextOperation @@ -371,7 +451,17 @@ maximum : vTreatmentRanges.dialysateTempMax step : vTreatmentRanges.dialysateTempRes value : vTreatmentRanges.dialysateTempDef - onValueChanged : vTreatmentCreate.dialysateTemp = value + valid : vTreatmentCreate.dialysateTempAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.dialysateTempAccepted = true + vTreatmentCreate.dialysateTemp = value + } + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onDialysateTempAcceptedChanged() { _flickable.setFlickableFocus(!_dialysateTemperature.valid, _dialysateTemperature.y);} + } } // TODO : This has to be a Component @@ -385,6 +475,11 @@ if ( slider.minAdjusted && slider.maxAdjusted ) { color = Colors.textMain } + + // if it's invalid upper or lower bound, set invalid color + if (!_arterialPressureLimits.lowerBoundValid || !_arterialPressureLimits.upperBoundValid) { + color = Colors.createTreatmentInvalidParam + } return color } width : parent.width @@ -429,6 +524,16 @@ upperText.anchors.topMargin : -60 upperTextHorizontalCenter : true + lowerBoundValid: vTreatmentCreate.arterialPressureLimitLowAccepted + upperBoundValid: vTreatmentCreate.arterialPressureLimitHighAccepted + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onArterialPressureLimitLowAcceptedChanged() { _flickable.setFlickableFocus(!_arterialPressureLimits.lowerBoundValid, _arterialPressureLimits.y);} + function onArterialPressureLimitHighAcceptedChanged(){ _flickable.setFlickableFocus(!_arterialPressureLimits.upperBoundValid, _arterialPressureLimits.y);} + } + minText.visible : true minText.font.bold : false minVerticalEdgeVisible : false @@ -485,6 +590,11 @@ if ( slider.minAdjusted && slider.maxAdjusted ) { color = Colors.textMain } + + // if it's invalid upper or lower bound, set invalid color + if (!_venousPressureLimits.lowerBoundValid || !_venousPressureLimits.upperBoundValid) { + color = Colors.createTreatmentInvalidParam + } return color } width : parent.width @@ -534,6 +644,15 @@ upperText.anchors.topMargin : -60 upperTextHorizontalCenter : true + lowerBoundValid : vTreatmentCreate.venousPressureLimitLowAccepted + upperBoundValid : vTreatmentCreate.venousPressureLimitHighAccepted + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onVenousPressureLimitLowAcceptedChanged() { _flickable.setFlickableFocus(!_venousPressureLimits.lowerBoundValid, _venousPressureLimits.y);} + function onVenousPressureLimitHighAcceptedChanged(){ _flickable.setFlickableFocus(!_venousPressureLimits.upperBoundValid, _venousPressureLimits.y);} + } + minText.visible : true minText.font.bold : false minVerticalEdgeVisible : false @@ -557,10 +676,20 @@ onPressed : { setInteractive(false) } onDragged : { setInteractive(false) } onReleased : { setInteractive(true ) } - onMinValueChanged : { if ( minAdjusted ) vTreatmentCreate.venousPressureLimitLow = minValue } - onMaxValueChanged : { if ( maxAdjusted ) vTreatmentCreate.venousPressureLimitHigh = maxValue } - onClicked : { if ( minAdjusted ) vTreatmentCreate.venousPressureLimitLow = minValue - if ( maxAdjusted ) vTreatmentCreate.venousPressureLimitHigh = maxValue } + onMinValueChanged : { + if ( minAdjusted ) { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.venousPressureLimitLowAccepted = true + vTreatmentCreate.venousPressureLimitLow = minValue + } + } + onMaxValueChanged : { + if ( maxAdjusted ) { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.venousPressureLimitHighAccepted = true + vTreatmentCreate.venousPressureLimitHigh = maxValue + } + } SliderArrows{ id:_venousPressureLimitsMaxArrows anchors.verticalCenter : _venousPressureLimits.verticalCenter @@ -590,7 +719,19 @@ maximum : vTreatmentRanges.bloodPressureMeasureIntervalMax step : vTreatmentRanges.bloodPressureMeasureIntervalRes value : vTreatmentRanges.bloodPressureMeasureIntervalDef - onValueChanged: vTreatmentCreate.bloodPressureMeasureInterval = value + valid : vTreatmentCreate.bloodPressureMeasureIntervalAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.bloodPressureMeasureIntervalAccepted = true + vTreatmentCreate.bloodPressureMeasureInterval = value + } + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onBloodPressureMeasureIntervalAcceptedChanged() { _flickable.setFlickableFocus(!_bloodPressureInterval.valid, _bloodPressureInterval.y);} + } + adjustable : _bloodPressureIntervalSwitch.checked inActiveZero: true enableAdjustButtons: _bloodPressureIntervalSwitch.checked @@ -660,7 +801,18 @@ maximum : vTreatmentRanges.rinsebackFlowRateMax step : vTreatmentRanges.rinsebackFlowRateRes value : vTreatmentRanges.rinsebackFlowRateDef - onValueChanged : vTreatmentCreate.rinsebackFlowRate = value + valid : vTreatmentCreate.rinsebackFlowRateAccepted + onValueChanged: { + // Reset the valid state to allow repositioning to the next invalid parameter + vTreatmentCreate.rinsebackFlowRateAccepted = true + vTreatmentCreate.rinsebackFlowRate = value + } + + Connections { + // To do a visual update to show the parameter/slider with invalid value on the screen + target:vTreatmentCreate + function onRinsebackFlowRateAcceptedChanged() { _flickable.setFlickableFocus(!_rinsebackFlowRate.valid, _rinsebackFlowRate.y);} + } } Item { width : 50