Index: sources/gui/qml/components/RangeSlider.qml =================================================================== diff -u -r642f08650a7a88ad6a2305fdea6bd18365aab5c7 -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e --- sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision 642f08650a7a88ad6a2305fdea6bd18365aab5c7) +++ sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) @@ -51,6 +51,8 @@ property real maxValueLowerBound : 0 property real maxValueUpperBound : 0 + property bool lowerBoundValid : true + property bool upperBoundValid : true property int curHandler : RangeSlider.HandlerOption.None ///< current active slider handler property int diameter : Variables.progressbarHandler ///< handlers diameter @@ -103,15 +105,15 @@ minimum : 0 maximum : 0 - /// Lable of the minimum of range + /// The label under the rangeSlider for minimum value minText { visible : true anchors.topMargin: Variables.sliderTextMargin font.pixelSize : Fonts.fontPixelSliderMarker font.bold : false } - ///< Lable of the maximum of range + /// The label under the rangeSlider for maximum value maxText { visible : true anchors.topMargin: Variables.sliderTextMargin @@ -315,6 +317,20 @@ setBound(newX) } + function getColor(vIsActive, vIsValid) { + let color = Colors.textDisableButton + if ( vIsActive ) { + if ( vIsValid ) { + color = Colors.textMain + } + else { + color = Colors.createTreatmentInvalidParam + } + } + return color + } + + /// The main range rectangle bar - This is the "highlighted" area of the slider RangeRect { id: _rangeRect property alias lowerBound : _rangeRect.minimum @@ -332,13 +348,15 @@ decimal : _root.decimal - minText { - visible: false + minText { // The minimum value label above the handle + visible : false anchors.topMargin: -60 + color : _root.getColor((_root.minAdjusted && _root.maxAdjusted), lowerBoundValid) } - maxText { - visible: false + maxText { // the maximum value label above the handle + visible : false anchors.topMargin: -60 + color : _root.getColor((_root.minAdjusted && _root.maxAdjusted), upperBoundValid) } // propagation is not working on drag ! Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -r642f08650a7a88ad6a2305fdea6bd18365aab5c7 -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 642f08650a7a88ad6a2305fdea6bd18365aab5c7) +++ sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) @@ -91,7 +91,7 @@ } function setActiveValid() { - _root.active = _root.valid = true + _root.active = true } Text { id: _label 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 Index: sources/main.h =================================================================== diff -u -ra6586ea871f21a08e7d50552983360fb5e344b3a -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e --- sources/main.h (.../main.h) (revision a6586ea871f21a08e7d50552983360fb5e344b3a) +++ sources/main.h (.../main.h) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) @@ -301,7 +301,8 @@ //--------------------------------------------------------------------------------// #define VALUESET( vTYPE , vVARIABLE , vDEFVALUE ) \ PROPERTY( vTYPE , vVARIABLE , vDEFVALUE ) \ - PROPERTY( bool , vVARIABLE##Set , false ) + PROPERTY( bool , vVARIABLE##Set , false ) \ + TRIGGER ( bool , vVARIABLE##Accepted , true ) //--------------------------------------------------------------------------------// #define RANGESET( vTYPE , vVARIABLE , vDEFVALUE ) \ READONLY( vTYPE , vVARIABLE##Min , vDEFVALUE ) \ Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -r642f08650a7a88ad6a2305fdea6bd18365aab5c7 -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 642f08650a7a88ad6a2305fdea6bd18365aab5c7) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) @@ -106,7 +106,27 @@ * \returns True if FW OK's treatment parameters, false otherwise */ void VTreatmentCreate::onActionReceive(const AdjustParametersValidationResponseData &data) { + if (! data.mAccepted) { + bloodFlowRateAccepted (data.bloodFlowRate > 0); + dialysateFlowRateAccepted (data.dialysateFlowRate > 0); + treatmentDurationAccepted (data.duration > 0); + heparinDispensingRateAccepted (data.heparinDispensingRate > 0); + heparinBolusVolumeAccepted (data.heparinBolusVolume > 0); + heparinStopTimeAccepted (data.heparinStopTime > 0); + salineBolusVolumeAccepted (data.salineBolus > 0); + heparinTypeAccepted (data.heparinType > 0); + acidConcentrateAccepted (data.acidConcentrate > 0); + bicarbonateConcentrateAccepted (data.bicarbonateConcentrate > 0); + dialyzerTypeAccepted (data.dialyzerType > 0); + dialysateTempAccepted (data.dialysateTemp > 0); + arterialPressureLimitLowAccepted (data.arterialPressureLimitLow > 0); + arterialPressureLimitHighAccepted (data.arterialPressureLimitHigh > 0); + venousPressureLimitLowAccepted (data.venousPressureLimitLow > 0); + venousPressureLimitHighAccepted (data.venousPressureLimitHigh > 0); + bloodPressureMeasureIntervalAccepted (data.bloodPressureMeasureInterval> 0); + rinsebackFlowRateAccepted (data.rinsebackFlowRate > 0); + emit fwValidationFailed(""); } else {