Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml =================================================================== diff -u -r975e1964b60365b24c74be139c6b84369a7248ce -rf2aa3ee850de1023cfc011b845ed0364d251b749 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml (.../TreatmentAdjustmentUltrafiltrationEdit.qml) (revision 975e1964b60365b24c74be139c6b84369a7248ce) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationEdit.qml (.../TreatmentAdjustmentUltrafiltrationEdit.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749) @@ -31,17 +31,22 @@ 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 + 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 } TreatmentAdjustmentUltrafiltrationMetrics { id: _ufMetrics @@ -50,34 +55,124 @@ topMargin : Variables.defaultMargin horizontalCenter: parent.horizontalCenter } - setVolume : _setVolumeSlider.value + setVolume : _volumeGoalAdjuster.value volumeRemoved : _private.volumeRemoved } Item { id: _contentArea + objectName: "_contentArea" anchors { top : _ufMetrics.bottom bottom : _continueButton.top left : parent.left - leftMargin : 80 + leftMargin : parent.width * 0.1667 right : parent.right rightMargin : anchors.leftMargin } - StoppedSlider { id: _setVolumeSlider + Column { id: _contentColumn + objectName : "_contentColumn" anchors { left : parent.left right : parent.right verticalCenter : parent.verticalCenter } - 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 + spacing : 80 + + ProgressBar { id: _maxVolumeBar + objectName: "_maxVolumeBar" + width : parent.width + height : Variables.ultraFiltrationProgressBarHeight + marker.visible : false + bgColor : Colors.ufAdjustmentProgressBarBg + color : Colors.ufAdjustmentDeltaFill + 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 + 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 + } + + RangeMarker { id: _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) + handle.width : Variables.ultrafiltrationRangeMarkerHandleWidth + text { + anchors.bottomMargin: _lowMarker.valueOnTop ? 15 : 0 + font { + pixelSize: Fonts.fontPixelUltrafiltrationRangeMarker + weight: Font.DemiBold + } + } + } + } + + LabelUnitContainer { id: _volumeGoalContainer + objectName : "_volumeGoalContainer" + width : parent.width + height : Variables.defaultButtonHeight + text : qsTr("UF Volume Goal") + unitText : Variables.unitVolume + textPixelSize : Fonts.fontPixelButton + 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 : function(vValue) { + value = _private.calculatePrecisionValue(vValue) + } + onMinimumChanged: { + if (value < minimum) { + value = minimum + } + } + onMaximumChanged: { + if (value > maximum) { + value = maximum + } + } + } + } } } @@ -94,8 +189,7 @@ 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) } }