Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml =================================================================== diff -u -rb77f1998463ef3391198cf8f00bfd713197a008e -r71bb1dea18ee4340d90d894a7ab8e147b5977bb4 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml (.../TreatmentAdjustmentUltrafiltrationEdit.qml) (revision b77f1998463ef3391198cf8f00bfd713197a008e) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml (.../TreatmentAdjustmentUltrafiltrationEdit.qml) (revision 71bb1dea18ee4340d90d894a7ab8e147b5977bb4) @@ -27,79 +27,160 @@ * \brief TreatmentAdjustmentUltrafiltrationEdit.qml is the screen * To adjust the treatment ultrafiltration */ -TreatmentAdjustmentBase { id: _root - contentItem.objectName: "TreatmentAdjustmentUltrafiltrationEdit" //SquishQt testability +Item { id: _root + objectName: "_TreatmentAdjustmentUltrafiltrationEdit" // SquishQt testability + QtObject { id: _private - readonly property real minimum : vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Min - readonly property real maximum : vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Max - readonly property real volumeRes : vTreatmentRanges.ultrafiltrationVolumeRes - readonly property real setVolume : vTreatmentUltrafiltration.setVolume - readonly property real volumeRemoved : vTreatmentUltrafiltration.volumeRemoved + objectName: "_private" + readonly property real minimum : calculatePrecisionValue( vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Min ) + readonly property real maximum : calculatePrecisionValue( vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Max ) + readonly property real volumeRes : calculatePrecisionValue( vTreatmentRanges.ultrafiltrationVolumeRes ) + readonly property real setVolume : calculatePrecisionValue( vTreatmentUltrafiltration.setVolume ) + readonly property real volumeRemoved : calculatePrecisionValue( vTreatmentUltrafiltration.volumeRemoved ) + + readonly property int multiplier : Math.pow(10, Variables.ultrafiltrationPrecision) + function calculatePrecisionValue(value) { + return Math.round(value * multiplier) / multiplier + } } signal continueClicked(real vVolume) function reset() { - _setVolumeSlider.reset(_private.setVolume) + _volumeGoalAdjuster.value = _private.setVolume } - closeVisible : false - confirmVisible : false - backVisible : true - - information { - visible : true && information.text && ! notification.visible - imageSource : ufInfoImageSource - text : ufInfoText - color : Colors.ufNotificationBarBg - textColor : Colors.ufVolumeGoalText - textfontSize : Fonts.fontPixelUltrafiltrationAdjustmentNotification - textfontWeight : Font.Medium - } - - titleText : qsTr("Ultrafiltration Volume ") + Variables.unitTextUltrafiltrationVolume - TreatmentAdjustmentUltrafiltrationMetrics { id: _ufMetrics + objectName : "_ufMetrics" anchors { top : parent.top - topMargin : Variables.ultrafiltrationHeaderMargin + topMargin : Variables.defaultMargin horizontalCenter: parent.horizontalCenter } - setVolume : _setVolumeSlider.value - volumeRemoved : _private.volumeRemoved + setVolume : _volumeGoalAdjuster.value + volumeRemoved : _private.volumeRemoved + volumeRemovedColor : Colors.ufVolumeGoalText } Item { id: _contentArea + objectName: "_contentArea" anchors { top : _ufMetrics.bottom bottom : _continueButton.top left : parent.left - leftMargin : 80 right : parent.right - rightMargin : anchors.leftMargin } - StoppedSlider { id: _setVolumeSlider - anchors { - left : parent.left - right : parent.right - verticalCenter : parent.verticalCenter + Column { id: _contentColumn + objectName : "_contentColumn" + anchors.centerIn : parent + width : Variables.ultrafiltrationProgressBarWidth + spacing : 80 + + ProgressBar { id: _maxVolumeBar + objectName : "_maxVolumeBar" + width : parent.width + height : Variables.ultraFiltrationProgressBarHeight + marker.visible : false + bgColor : Colors.ufAdjustmentProgressBarBg + color : Colors.ufAdjustmentDeltaFill + radius : Variables.ultrafiltrationProgressBarRadius + minText { + font { + pixelSize : Fonts.fontPixelUltrafiltrationMinMaxLabel + weight : Font.Normal + } + color : Colors.progressBarMinMax + text : minimum.toFixed(Variables.ultrafiltrationPrecision) + " " + Variables.unitVolume + } + maxText { + font { + pixelSize : minText.font.pixelSize + weight : minText.font.weight + } + color : Colors.progressBarMinMax + text : _private.maximum.toFixed(Variables.ultrafiltrationPrecision) + " " + Variables.unitVolume + } + minimum : _private.minimum + maximum : _private.maximum + decimal : Variables.ultrafiltrationPrecision + value : _volumeGoalAdjuster.value + + Rectangle { id: _removedFill + objectName: "_removedFill" + anchors { + top : parent.top + bottom : parent.bottom + left : parent.left + right : _lowMarker.right + // adjust margin so fill completely covers the underlying slider + leftMargin : -1 + } + z : parent.z + 1 + color : Colors.ufProgressBarFill + radius : parent.radius + } + + RangeMarker { id: _lowMarker + objectName : "_lowMarker" + anchors.bottom : parent.bottom + x : (_maxVolumeBar.width * ((value - _maxVolumeBar.minimum) / (_maxVolumeBar.maximum - _maxVolumeBar.minimum))) - ((width+1)/2) + z : _removedFill.z + 1 + width : Variables.ultrafiltrationRangeMarkerWidth + height : Variables.rangeMarkerHeight + hasHandle : false + valueOnTop : true + decimal : Variables.ultrafiltrationPrecision + value : Math.max(_private.volumeRemoved, _private.minimum) + text { + anchors.bottomMargin: Variables.ultrafiltrationRangeMarkerTextMargin + font { + pixelSize: Fonts.fontPixelUltrafiltrationRangeMarker + weight: Font.DemiBold + } + } + } } - decimal : Variables.ultrafiltrationPrecision - minimum : _private.minimum - minStop : _private.volumeRemoved - maximum : _private.maximum - step : _private.volumeRes.toFixed(Variables.ultrafiltrationPrecision) - unit : Variables.unitVolume - defaultValue : { defaultValue = _private.setVolume } // set without binding - active : true + + LabelUnitContainer { id: _volumeGoalContainer + objectName : "_volumeGoalContainer" + width : parent.width + height : _ufMetrics.height + text : qsTr("UF Volume Goal") + unitText : Variables.unitVolume + contentItem : ValueAdjuster { id: _volumeGoalAdjuster + objectName : "_volumeGoalAdjuster" + textColor : Colors.ufVolumeGoalText + isActive : true + decimal : Variables.ultrafiltrationPrecision + minimum : Math.ceil(_private.volumeRemoved / step) * step + maximum : Math.floor(_private.maximum / step) * step + step : _private.volumeRes + value : { value = _private.setVolume } // set without binding + + onDidChange : { + value = _private.calculatePrecisionValue(vValue) + } + onMinimumChanged: { + if (value < minimum) { + value = minimum + } + } + onMaximumChanged: { + if (value > maximum) { + value = maximum + } + } + } + } } } TouchRect { id: _continueButton + objectName : "_continueButton" anchors { - bottom : information.top - bottomMargin : Variables.ultrafiltrationButtonBottomMargin + bottom : parent.bottom + bottomMargin : Variables.defaultMargin horizontalCenter: parent.horizontalCenter } width : Variables.ultrafiltrationButtonWidth @@ -109,8 +190,10 @@ font.weight : Font.Medium } isDefault : true - enabled : _setVolumeSlider.value.toFixed(_setVolumeSlider.decimal) !== - _private.setVolume.toFixed(_setVolumeSlider.decimal) - onClicked : continueClicked(_setVolumeSlider.value.toFixed(_setVolumeSlider.decimal)) + enabled : _volumeGoalAdjuster.value !== _private.setVolume + + onClicked : { + continueClicked(_volumeGoalAdjuster.value) + } } }