Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentPressuresLimits.qml =================================================================== diff -u -r874a982c1983fea20307a031e09f90a91ca34d75 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentPressuresLimits.qml (.../TreatmentAdjustmentPressuresLimits.qml) (revision 874a982c1983fea20307a031e09f90a91ca34d75) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentPressuresLimits.qml (.../TreatmentAdjustmentPressuresLimits.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file TreatmentAdjustmentPressuresLimits.qml - * \author (last) Behrouz NematiPour - * \date (last) 25-Oct-2022 + * \author (last) Vy + * \date (last) 07-Sep-2023 * \author (original) Behrouz NematiPour * \date (original) 01-Nov-2020 * @@ -30,65 +30,157 @@ TreatmentAdjustmentBase { id: _root contentItem.objectName: "TreatmentAdjustmentPressures" //SquishQt testability - property alias arterialPressureMinimum : _arterialPressure.minimum - property alias arterialPressureLowerBound : _arterialPressure.lowerBound - property alias arterialPressureUpperBound : _arterialPressure.upperBound - property alias arterialPressureMaximum : _arterialPressure.maximum - property alias arterialPressureValue : _arterialPressure.value - property real arterialPressureStep : vTreatmentRanges.arterialPressureLimitRes + property alias arterialPressureLimitWindow : _arterialWindow .value + property alias venousPressureLimitWindow : _venousWindow .value + property alias venousPressureLimitAsymtrc : _venousAsymmetric .value - property alias venousPressureMinimum : _venousPressure.minimum - property alias venousPressureLowerBound : _venousPressure.lowerBound - property alias venousPressureUpperBound : _venousPressure.upperBound - property alias venousPressureMaximum : _venousPressure.maximum - property alias venousPressureValue : _venousPressure.value - property real venousPressureStep : vTreatmentRanges.venousPressureLimitRes + titleText: qsTr("PRESSURES") - readonly property int textWidth : 200 + // Note : The slider values are not bound and will be set by user freely + // and will be used to be sent for adjustment + // if accepted will not changed and + // if rejected then will be reset to the values passed by adjustment response - titleText: qsTr("PRESSURES") + // reset the flow values to the current flow values + function currentFlows() { + // if the vTreatmentAdjustmentPressuresLimits.* is not set yet, use the default value + // TODO need to change to use the value used in treatment if these limits are being set in create treatment + _arterialWindow.reset( vTreatmentAdjustmentPressuresLimits.arterialPressureLimitWindow || _arterialWindow.defaultValue) + _venousWindow.reset( vTreatmentAdjustmentPressuresLimits.venousPressureLimitWindow || _venousWindow.defaultValue) + _venousAsymmetric.reset( vTreatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc || _venousAsymmetric.defaultValue) + } - PressureRangeSlider { id: _arterialPressure - titleText : qsTr("Arterial") - anchors.horizontalCenter: parent.horizontalCenter - progressColor : Colors.pressuresArterialBar - minimumMargin : Math.abs(vTreatmentRanges.arterialPressureMonitorMin - vTreatmentRanges.arterialPressureLimitLowMin ) - lowerBoundMin : vTreatmentRanges.arterialPressureLimitLowMin - lowerBoundMax : vTreatmentRanges.arterialPressureLimitLowMax - upperBoundMin : vTreatmentRanges.arterialPressureLimitHighMin - upperBoundMax : vTreatmentRanges.arterialPressureLimitHighMax - maximumMargin : Math.abs(vTreatmentRanges.arterialPressureMonitorMax - vTreatmentRanges.arterialPressureLimitHighMax) - limitGap : vTreatmentRanges.arterialPressureLimitLowGap // currently min & max are on the same slider/scale so used min as the main res - step : arterialPressureStep - ticksVisible : true - anchors.top:parent.top - anchors.topMargin: 125 - anchors.left : parent.left + // reset the flow values to the values of the adjustment response + function resetFlows() { + _arterialWindow.reset( vTreatmentAdjustmentPressuresLimits.arterialPressureLimitWindow ) + _venousWindow.reset( vTreatmentAdjustmentPressuresLimits.venousPressureLimitWindow ) + _venousAsymmetric.reset( vTreatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc ) } + onAboutToShow: { + // TODO : When Testing data on Setting screen is removed + // This needs to be moved into the Treatment______.qml + currentFlows() + } + + Connections { target: vTreatmentAdjustmentPressuresLimits + function onAdjustmentTriggered ( vValue ) { + if ( vTreatmentAdjustmentPressuresLimits.adjustment_Accepted ) { + accept() + } else { + resetFlows() + console.debug(vTreatmentAdjustmentPressuresLimits.text()) + notification.text = vTreatmentAdjustmentPressuresLimits.text() + } + } + } + component SliderPressure : Item { + property alias title : _title.text + property alias minimum : _slider.minimum + property alias maximum : _slider.maximum + property alias step : _slider.step + property alias value : _slider.value + property alias defaultValue : _slider.defaultValue + + property alias sliderWidth : _slider.width + property int hPadding : 30 + + function reset(vValue) { + _slider.reset(vValue) + } + + height : 150 + width : parent.width - hPadding * 2 + + Text { id: _title + height : 50 + anchors.top : parent.top + anchors.left : parent.left + horizontalAlignment : Text.AlignLeft + font.pixelSize : Fonts.fontPixelPresseuresLabel + color : Colors.textMain + } + + Text { id: _value + width : 120 + anchors.baseline : _title.baseline + anchors.right : parent.right + font.pixelSize : Fonts.fontPixelFluidUnit + color : Colors.textMain + text : _slider.value.toFixed(0) + " " + Variables.unitTextBloodPressure + horizontalAlignment : Text.AlignRight + } + + Slider { id : _slider + anchors.top : _title.bottom + anchors.topMargin : 15 + anchors.horizontalCenter: parent.horizontalCenter + width : 700 + height : Variables.sliderDefaultBodyHeight + diameter : Variables.progressbarHandler + touchMargin : Variables.createTreatmentSliderMargin + ticks : true + onValueChanged : reset( value ) + } + + SliderArrows{ id : _sliderArrows + anchors.left : _slider.right + anchors.leftMargin : 30 + anchors.verticalCenter : _slider.verticalCenter + onIncrementValue : _slider.incrementValue(true) + onDecrementValue : _slider.decrementValue(true) + } + } + + SliderPressure { id: _arterialWindow + objectName : "_arterialWindow" + anchors { + top : parent.top + topMargin : 125 + horizontalCenter: parent.horizontalCenter + } + title : qsTr("Arterial Window") + minimum : vTreatmentRanges.arterialPressureLimitWindowMin + maximum : vTreatmentRanges.arterialPressureLimitWindowMax + step : vTreatmentRanges.arterialPressureLimitWindowRes + value : vTreatmentRanges.arterialPressureLimitWindowDef + defaultValue : vTreatmentRanges.arterialPressureLimitWindowDef + } + Line { id: _divider anchors.horizontalCenter: parent.horizontalCenter length : _root.width - 100 color : Colors.separatorLine - anchors.top: _arterialPressure.bottom - anchors.topMargin: 25 + anchors.top: _arterialWindow.bottom + anchors.topMargin: 15 } - PressureRangeSlider { id: _venousPressure - titleText : qsTr("Venous") - anchors.horizontalCenter: parent.horizontalCenter - progressColor : Colors.pressuresVenousBar - minimumMargin : Math.abs(vTreatmentRanges.venousPressureMonitorMin - vTreatmentRanges.venousPressureLimitLowMin ) - lowerBoundMin : vTreatmentRanges.venousPressureLimitLowMin - lowerBoundMax : vTreatmentRanges.venousPressureLimitLowMax - upperBoundMin : vTreatmentRanges.venousPressureLimitHighMin - upperBoundMax : vTreatmentRanges.venousPressureLimitHighMax - maximumMargin : Math.abs(vTreatmentRanges.venousPressureMonitorMax - vTreatmentRanges.venousPressureLimitHighMax) - limitGap : vTreatmentRanges.venousPressureLimitLowGap // currently min & max are on the same slider/scale so used min as the main res - step : venousPressureStep - ticksVisible : true - anchors.top : _divider.bottom - anchors.topMargin : 25 - anchors.left: parent.left + SliderPressure { id: _venousWindow + objectName : "_venousWindow" + anchors { + top : _divider.bottom + topMargin : 30 + horizontalCenter: parent.horizontalCenter + } + title : qsTr("Venous Window") + minimum : vTreatmentRanges.venousPressureLimitWindowMin + maximum : vTreatmentRanges.venousPressureLimitWindowMax + step : vTreatmentRanges.venousPressureLimitWindowRes + value : vTreatmentRanges.venousPressureLimitWindowDef + defaultValue : vTreatmentRanges.venousPressureLimitWindowDef } + + SliderPressure { id: _venousAsymmetric + objectName : "_venousAsymmetric" + anchors { + top : _venousWindow.bottom + horizontalCenter: parent.horizontalCenter + } + title : qsTr("Venous Asymmetric") + minimum : vTreatmentRanges.venousPressureLimitAsymtrcMin + maximum : vTreatmentRanges.venousPressureLimitAsymtrcMax + step : vTreatmentRanges.venousPressureLimitAsymtrcRes + value : vTreatmentRanges.venousPressureLimitAsymtrcDef + defaultValue : vTreatmentRanges.venousPressureLimitAsymtrcDef + } }