Index: leahi.qrc
===================================================================
diff -u -r975e1964b60365b24c74be139c6b84369a7248ce -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- leahi.qrc (.../leahi.qrc) (revision 975e1964b60365b24c74be139c6b84369a7248ce)
+++ leahi.qrc (.../leahi.qrc) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -175,7 +175,6 @@
sources/gui/qml/compounds/NumPad.qml
sources/gui/qml/compounds/LabelUnitContainer.qml
sources/gui/qml/compounds/ValueAdjuster.qml
- sources/gui/qml/compounds/StoppedSlider.qml
sources/gui/qml/compounds/TreatmentAdjustmentUltrafiltrationMetrics.qml
Index: sources/gui/qml/compounds/LabelUnitContainer.qml
===================================================================
diff -u -rb395fdadb1ad460eba7e45eaca94c100a5d0c804 -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- sources/gui/qml/compounds/LabelUnitContainer.qml (.../LabelUnitContainer.qml) (revision b395fdadb1ad460eba7e45eaca94c100a5d0c804)
+++ sources/gui/qml/compounds/LabelUnitContainer.qml (.../LabelUnitContainer.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -22,14 +22,15 @@
import "qrc:/pages/pretreatment"
Rectangle { id: _root
- property Item contentItem : null
- property alias contentArea : _contentArea
+ property Item contentItem : null
+ property alias contentArea : _contentArea
- property alias text : _title.text
- property string unitText: ""
- property bool valid : true
- property bool showUnit : true
- property bool showEdit : false
+ property alias text : _title.text
+ property alias textPixelSize : _title.font.pixelSize
+ property string unitText : ""
+ property bool valid : true
+ property bool showUnit : true
+ property bool showEdit : false
height : cellHeight
width : cellWidth
@@ -59,7 +60,7 @@
Text { id: _unit
anchors.bottom : _title.bottom
- text : ("(%1)").arg(_root.unitText)
+ text : _root.unitText.length > 0 ? ("(%1)").arg(_root.unitText) : ""
color : Colors.offWhite
font.pixelSize : 22
font.weight : Font.Thin
Fisheye: Tag f2aa3ee850de1023cfc011b845ed0364d251b749 refers to a dead (removed) revision in file `sources/gui/qml/compounds/StoppedSlider.qml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: sources/gui/qml/compounds/ValueAdjuster.qml
===================================================================
diff -u -r5f4b3aacfede4aa545a44c7f3b33ca649b81aac7 -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision 5f4b3aacfede4aa545a44c7f3b33ca649b81aac7)
+++ sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -30,11 +30,13 @@
property bool editable : true
property bool canOff : false
property bool canRefresh : false
+ property alias textColor : _text.color
// fix floating-point precision issue
- readonly property real stepVal : Math.round(step * 100) / 100
- readonly property real minVal : Math.round(minimum * 100) / 100
- readonly property real val : Math.round(value * 100) / 100
+ readonly property int multiplier : Math.pow(10, decimal)
+ readonly property real stepVal : calculatePrecisionValue(step)
+ readonly property real minVal : calculatePrecisionValue(minimum)
+ readonly property real val : calculatePrecisionValue(value)
readonly property bool canIncrement : isActive ? value < maximum : true
readonly property bool canDecrement : isActive ? canOff ? value > 0 :
@@ -49,27 +51,35 @@
if ( isActive ) { didChange(_root.defaultValue) }
}
+ // round the value based on the given precision (not step)
+ function calculatePrecisionValue(value) {
+ return Math.round(value * multiplier) / multiplier
+ }
+
function refresh() { canRefresh = true }
function clear() { didActiveChange(false) }
function increment() {
let tValue = value
+ let stepDelta = calculatePrecisionValue(stepVal - (val % stepVal))
+ let tStep = (stepDelta === 0) ? stepVal : stepDelta
if ( ! isActive ) { didActiveChange(true); return; }
- if ( canOff ) { tValue = val < minVal ? minVal : val + stepVal }
- else { tValue += stepVal }
+ if ( canOff ) { tValue = val < minVal ? minVal : val + tStep }
+ else { tValue += tStep }
didChange(tValue)
-
}
- function decrement(vValue) {
- let tValue = value
+ function decrement() {
+ let tValue = val
+ let stepDelta = calculatePrecisionValue(val % stepVal)
+ let tStep = (stepDelta === 0) ? stepVal : stepDelta
if ( ! isActive ) { didActiveChange(true); return; }
- if ( canOff ) { tValue = val > minVal ? val - stepVal : 0 }
- else { tValue -= stepVal }
+ if ( canOff ) { tValue = val > minVal ? val - tStep : 0 }
+ else { tValue -= tStep }
didChange(tValue)
}
@@ -137,8 +147,7 @@
}
onReleased: {
- _sliderMouseArea.grabbed = true
-. grabbed = false
+ _sliderMouseArea.grabbed = false
_slider.opacity = 0
}
Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltration.qml
===================================================================
diff -u -r975e1964b60365b24c74be139c6b84369a7248ce -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltration.qml (.../TreatmentAdjustmentUltrafiltration.qml) (revision 975e1964b60365b24c74be139c6b84369a7248ce)
+++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltration.qml (.../TreatmentAdjustmentUltrafiltration.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -36,7 +36,7 @@
backVisible : _ufStack.stackView.depth > 1
titleText : qsTr("Ultrafiltration Volume ") + Variables.unitTextUltrafiltrationVolume
- onOpened : { _ufStack.reset() }
+ onAboutToShow : { _ufStack.reset() }
onClosed : { _ufStack.reset() }
onBackClicked : { _ufStack.pop() }
onCloseClicked : { _ufStack.reset() }
Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationConfirm.qml
===================================================================
diff -u -r975e1964b60365b24c74be139c6b84369a7248ce -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationConfirm.qml (.../TreatmentAdjustmentUltrafiltrationConfirm.qml) (revision 975e1964b60365b24c74be139c6b84369a7248ce)
+++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentUltrafiltrationConfirm.qml (.../TreatmentAdjustmentUltrafiltrationConfirm.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -21,6 +21,7 @@
// Qml imports
import "qrc:/globals"
import "qrc:/components"
+import "qrc:/compounds"
/*!
* \brief TreatmentAdjustmentUltrafiltrationConfirm.qml is the screen
@@ -34,102 +35,48 @@
signal confirmVolumeClicked(real vVolume)
- Item { id: _contentArea
+ component ValueContainer: LabelUnitContainer { id: _valueContainer
+ property alias value : _value.text
+ property color valueColor : _value.color
+
+ implicitWidth : 400
+ implicitHeight : Variables.defaultButtonHeight
+ textPixelSize : Fonts.fontPixelButton
+ contentItem: Text { id: _value
+ font {
+ pixelSize : Fonts.fontPixelUltrafiltrationAdjustmentMetrics
+ weight : Font.DemiBold
+ }
+ horizontalAlignment : Text.AlignHCenter
+ verticalAlignment : Text.AlignVCenter
+ color : Colors.ufVolumeGoalText
+ }
+ }
+
+ Item {
anchors {
top : parent.top
bottom : _confirmButton.top
left : parent.left
right : parent.right
}
- Row { id: _contentRow
+ Row { id: _newValuesRow
anchors.centerIn: parent
- spacing : 150
+ spacing: Variables.columnSpacing
- Column { id: _leftContent
- spacing: 20
- Text {
- font {
- pixelSize : Fonts.fontPixelUltrafiltrationAdjustmentNotification
- weight : Font.Medium
- }
- color : "white"
- text : qsTr("New UF Volume:")
- }
-
- Item {
- width : childrenRect.width
- height : childrenRect.height
-
- Text { id: _newUfVolumeValue
- width: contentWidth
- font {
- pixelSize : Fonts.fontPixelUltrafiltrationAdjustmentConfirmation
- weight : Font.DemiBold
- }
- horizontalAlignment : Text.AlignVBottom
- color : Colors.ufVolumeGoalText
- text : _root.ultrafiltrationVolume.toFixed(Variables.ultrafiltrationPrecision)
- }
-
- Text { id: _newUfVolumeUnit
- anchors {
- left : _newUfVolumeValue.right
- verticalCenter : _newUfVolumeValue.verticalCenter
- verticalCenterOffset: (_newUfVolumeValue.height - height) * 0.25
- }
- font {
- pixelSize : _newUfVolumeValue.font.pixelSize * 0.6
- weight : Font.Medium
- }
- horizontalAlignment : Text.AlignVBottom
- color : _newUfVolumeValue.color
- text : " " + Variables.unitVolume
- }
- }
+ ValueContainer { id: _newVolumeContainer
+ text : qsTr("New UF Volume")
+ unitText : Variables.unitVolume
+ valueColor : Colors.ufVolumeGoalText
+ value : _root.ultrafiltrationVolume.toFixed(Variables.ultrafiltrationPrecision)
}
- Column { id: _rightContent
- spacing: _leftContent.spacing
- Text {
- font {
- pixelSize : Fonts.fontPixelUltrafiltrationAdjustmentNotification
- weight : Font.Medium
- }
- color : "white"
- text : qsTr("New UF Rate:")
- }
-
- Item {
- width : childrenRect.width
- height : childrenRect.height
-
- Text { id: _newUfRateValue
- width: contentWidth
- font {
- pixelSize : Fonts.fontPixelUltrafiltrationAdjustmentConfirmation
- weight : Font.DemiBold
- }
- horizontalAlignment : Text.AlignVCenter
- color : Colors.ufVolumeGoalText
- text : _root.ultrafiltrationRate.toFixed(Variables.ultrafiltrationPrecision)
- }
-
- Text { id: _newUfRateUnit
- anchors {
- left : _newUfRateValue.right
- verticalCenter : _newUfRateValue.verticalCenter
- verticalCenterOffset: (_newUfRateValue.height - height) * 0.25
- }
- font {
- pixelSize : _newUfVolumeUnit.font.pixelSize
- weight : _newUfVolumeUnit.font.weight
- }
- horizontalAlignment : Text.AlignVCenter
- color : _newUfVolumeValue.color
- text : " " + Variables.unitTextRate
- }
- }
+ ValueContainer { id: _newRateContainer
+ text : qsTr("New UF Rate")
+ unitText : Variables.unitTextRate
+ valueColor : Colors.ufVolumeGoalText
+ value : _root.ultrafiltrationRate.toFixed(Variables.ultrafiltrationPrecision)
}
}
}
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)
}
}
Index: sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml
===================================================================
diff -u -r038d30c2f22add13830b92a9775d70c9615861b2 -rf2aa3ee850de1023cfc011b845ed0364d251b749
--- sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision 038d30c2f22add13830b92a9775d70c9615861b2)
+++ sources/gui/qml/pages/treatment/sections/TreatmentUltrafiltration.qml (.../TreatmentUltrafiltration.qml) (revision f2aa3ee850de1023cfc011b845ed0364d251b749)
@@ -29,7 +29,7 @@
TreatmentSection { id: _root
readonly property real minimum : vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Min
- readonly property real maximum : vTreatmentRanges.treatmentRanges_Ultrafiltration_Volume_Max
+ readonly property real maximum : vTreatmentUltrafiltration.setVolume
readonly property real value : vTreatmentUltrafiltration.volumeRemoved
readonly property int topTextFontSize : 25
readonly property int bottomTextFontSize : 60