Index: sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml =================================================================== diff -u -ra5760947d3ed0d2748ba023a1c25e3c6aa0b1de1 -rf91362971e3b7af39c96e20fd553cdbd49741f85 --- sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml (.../TreatmentSaline.qml) (revision a5760947d3ed0d2748ba023a1c25e3c6aa0b1de1) +++ sources/gui/qml/pages/treatment/sections/TreatmentSaline.qml (.../TreatmentSaline.qml) (revision f91362971e3b7af39c96e20fd553cdbd49741f85) @@ -23,54 +23,134 @@ import "qrc:/globals" import "qrc:/components" +import "../../../globals" +import "../../../components" +import "../../treatment" + /*! * \brief Treatment Screen Saline Management section */ -TreatmentFluid { id: _root +TreatmentSection { id: _root readonly property bool isStarted : vHDTreatmentStates.sbRunning readonly property bool isIdle : vHDTreatmentStates.sbIdle // other that max saline bolus delivered, // if saline started but still is waiting for pump the button is disabled so user won't tap multiple times. readonly property bool isDisabled : vHDTreatmentStates.sbMaxReached readonly property bool isWaitPump : vHDTreatmentStates.sbWaitPump + readonly property string unit : Variables.unitTextFluid + property int valueDecimal : Variables.salinePrecision + property int valueTarget : vTreatmentSaline.target || vTreatmentAdjustmentSaline.target + property int valueCumulative: vTreatmentSaline.cumulative + property int valueDelivered : vTreatmentSaline.delivered + property string buttonText : ( isDisabled || isWaitPump ) ? _private.textStart : + isStarted ? _private.textStop : + _private.textStart + + + header.title: qsTr("Saline" ) + header.showEdit: false + QtObject { id: _private - readonly property string textStart : qsTr("START BOLUS") - readonly property string textStop : qsTr("STOP BOLUS" ) - readonly property string textVolumeTarget : "(" + valueTarget + unit + ")" + readonly property string textStart : qsTr("START BOLUS") + textVolumeTarget + readonly property string textStop : qsTr("STOP BOLUS" ) + textVolumeTarget + readonly property string textVolumeTarget : " (" + valueTarget + unit + ")" readonly property string mesgDisabled : qsTr("Maximum cumulative saline bolus volume delivered") readonly property string mesgWaitForPump : "" // qsTr("Saline Bolus is starting") // Not sure if we shouls show any message at this point readonly property string mesgRejectReason : vTreatmentAdjustmentSaline.adjustment_ReasonText } - hasArrow : false - isTouchable : false - buttonEnabled : ! ( _root.isDisabled || _root.isWaitPump ) - buttonText : ( _root.isDisabled || _root.isWaitPump ) ? _private.textStart : - _root.isStarted ? _private.textStop : - _private.textStart + VTreatmentSaline { id: vTreatmentSaline } - fluidProgressBarColor: _root.isStarted ? Colors.sliderHighlightColor : Colors.highlightProgressBar + Column { id :_column + spacing : Variables.defaultMargin * 4 + leftPadding : Variables.defaultMargin + rightPadding: Variables.defaultMargin - title : qsTr("SALINE BOLUS") - unit : Variables.unitTextSaline + anchors { + fill : parent + topMargin : header.height + Variables.defaultMargin * 2 + margins : Variables.defaultMargin + } - valueDecimal : Variables.salinePrecision - valueTarget : vTreatmentSaline.target || vTreatmentAdjustmentSaline.target - valueCumulative : vTreatmentSaline.cumulative - valueDelivered : vTreatmentSaline.delivered + Text { id: _descriptionText + text : qsTr("Total Saline Delivered") + font.pixelSize : Fonts.fontPixelFluidText + color : Colors.fluidText + horizontalAlignment: Text.AlignHCenter + } - VTreatmentSaline { id: vTreatmentSaline } + Item { id: progressBarArea + height: Variables.contentHeight + width: parent.width - Variables.defaultMargin - onClicked: { - if ( isIdle ) vTreatmentAdjustmentSaline.doStart() // IDLE - if ( isStarted ) vTreatmentAdjustmentSaline.doStop () // IN_PROGRESS - } + ProgressBar { id: _fluidProgressBar + width: progressBarArea.width - Variables.defaultMargin - notification { - visible : true - text : isDisabled ? _private.mesgDisabled : - isWaitPump ? _private.mesgWaitForPump : - _private.mesgRejectReason + height : Variables.progressbarFluidHeight * 4 + minText.visible : false + maxText.visible : false + marker.visible : false + color: "cyan"// update later + + maximum : _fluidTarget.value + value : valueDelivered + decimal : _root.valueDecimal + radius: 9 + progressRadius: radius + } + + Label { id: _fluidTarget + property real value: valueCumulative + anchors { + verticalCenter: _fluidTargetUnit.verticalCenter + right: _fluidTargetUnit.left + } + font.pixelSize : Fonts.fontPixelFluidText + font.weight : Font.DemiBold + text: value + width: contentWidth + + } + + Label { id: _fluidTargetUnit + property real value: 0 + anchors { + bottom: _fluidProgressBar.top + right: _fluidProgressBar.right + } + font.pixelSize : Fonts.fontPixelFluidText + text: _root.unit + width: contentWidth + } + } + + TouchRect { id: _startFluidButton + width : progressBarArea.width - Variables.defaultMargin + height: Variables.contentHeight + + text.text: buttonText + backgroundColor: borderColor + textColor: isDisabled || isWaitPump ? Colors.textButton : Colors.textDisableButton + text.font { + weight: Font.DemiBold + pixelSize : 16 + } + onPressed : { + if ( isIdle ) vTreatmentAdjustmentSaline.doStart() // IDLE + if ( isStarted ) vTreatmentAdjustmentSaline.doStop () // IN_PROGRESS + } + + } + } + + // TODO: +// notification { +// visible : true +// text : isDisabled ? _private.mesgDisabled : +// isWaitPump ? _private.mesgWaitForPump : +// _private.mesgRejectReason +// } +// } }