Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -rea51c0546c7061d225e7b9d8b754554c65f0d1b1 -rb12cc2840bb819c5222bfd3bc2cc5ca6eb4c37fd --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision ea51c0546c7061d225e7b9d8b754554c65f0d1b1) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision b12cc2840bb819c5222bfd3bc2cc5ca6eb4c37fd) @@ -21,6 +21,7 @@ import "qrc:/compounds" import "qrc:/dialogs" import "qrc:/globals" +import "qrc:/pages/endtreatment" import "qrc:/pages/treatment/adjustments" /*! @@ -33,191 +34,239 @@ objectName: "TreatmentStack" onVisibleChanged : { // this should never happen by design, but in tests it can easily happen and will block the screen touch. - _treatmentAdjustmentFlow .close() - _vitalEntry .close( true ) // vQuit == true + _treatmentAdjustmentSetPoints .close() + _treatmentAdjustmentVitals .close() _treatmentAdjustmentPressuresLimits .close() + _treatmentAdjustmentBolusVolume .close() _treatmentAdjustmentDuration .close() - _treatmentUltrafiltrationItem .close() + _treatmentAdjustmentUltrafiltration .close() - if (! visible) { + if (visible) { + _headerBar.activeStack = stackView + } + else { _headerBar.menuHidden = true + stackView.initialItem = null } } - stackView.initialItem : null + stackView.initialItem : _treatmentHome - // ultrafiltration state information bar properties - readonly property bool isUFPaused : vTDTreatmentStates.ufPaused - readonly property bool isUFRunning : vTDTreatmentStates.ufRunning readonly property bool isTreatmentPaused : vTDTreatmentStates.txStop - - readonly property string ufInfoImageSource : isUFPaused ? "qrc:/images/iPauseGray" : "" - readonly property string ufInfoText : isUFPaused ? qsTr("Ultrafiltration Paused" ) : "" - readonly property string ufInfoTextColor : isUFPaused ? "gray" : "" - readonly property bool isSBInProgress : ( vTDTreatmentStates.sbRunning || vTDTreatmentStates.sbWaitPump ) + readonly property bool isTreatmentEnd : vTDTreatmentStates.txEnd + property int headerMenuIndex : _headerBar.headerMenuIndex - readonly property bool isDialogOpened : _treatmentAdjustmentFlow .visible - || _treatmentAdjustmentPressuresLimits .visible - || _treatmentAdjustmentDuration .visible - || _treatmentUltrafiltrationItem .visible - - property int headerMenuIndex: _headerBar.headerMenuIndex - onHeaderMenuIndexChanged: { - if ( _root.headerMenuIndex === 2) page(_treatmentHeparin) - if ( _root.headerMenuIndex === 1) page(_treatmentTrends) - if ( _root.headerMenuIndex === 0) pop(null) // unwind stack + switch( _headerBar.currentScreen ) { + case HeaderBar.Treatment: + pop(null) // unwind stack back to main treatment + break + case HeaderBar.Trends: + page( _treatmentTrends ) + break; + case HeaderBar.Heparin: + page( _treatmentHeparin ) + break + case HeaderBar.HDF: // TODO + page( _treatmentHDF ) + break + default: + pop(null) // unwind stack back to main treatment + break + } } // Components - TreatmentBloodPrime { id: _treatmentBloodPrime } - TreatmentUltrafiltrationItem{ id: _treatmentUltrafiltrationItem } - TreatmentHome { id: _treatmentHome } + TreatmentBloodPrime { id: _treatmentBloodPrime + onIncrementRate : function(newValue) { vTreatmentAdjustmentBloodFlowRate.doAdjustment(newValue) } + onDecrementRate : function(newValue) { vTreatmentAdjustmentBloodFlowRate.doAdjustment(newValue) } + onPause : { vTreatmentAdjustmentBloodPrime.doPause() } + onResume : { vTreatmentAdjustmentBloodPrime.doResume() } + } + TreatmentHome { id: _treatmentHome } + TreatmentTrends { id: _treatmentTrends } + TreatmentHeparin { id: _treatmentHeparin } + TreatmentHDF { id: _treatmentHDF } + + // End Treatment + EndTreatmentRinsebackStack { id: _endTreatmentRinsebackStack } + EndTreatmentRecirculateStack { id: _endTreatmentRecirculateStack } + + //// Treatment Adjustment Dialogs + TreatmentAdjustmentSetPoints { id: _treatmentAdjustmentSetPoints } + TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits } + TreatmentAdjustmentBolusVolume { id: _treatmentAdjustmentBolusVolume } + TreatmentAdjustmentUltrafiltrationStack { id: _treatmentAdjustmentUltrafiltration } + TreatmentAdjustmentHDF { id: _treatmentAdjustmentHDF } + TreatmentAdjustmentDurationStack { id: _treatmentAdjustmentDuration } + TreatmentAdjustmentVitalsInterval { id: _treatmentAdjustmentVitalsInterval } + Connections { target: _treatmentHome function onSectionFlowClicked ( vValue ) { - _treatmentAdjustmentFlow.open() + _treatmentAdjustmentSetPoints.open() } function onSectionVitalsClicked ( vValue ) { - _vitalEntry.open() + _treatmentAdjustmentVitalsInterval.open() } function onSectionPressuresClicked ( vValue ) { _treatmentAdjustmentPressuresLimits.open() } + function onSectionSalineClicked ( vValue ) { + _treatmentAdjustmentBolusVolume.open() + } function onSectionTimeClicked ( vValue ) { - //DEBUG: console.log("time total minutes: " + vTreatmentTime.time_Total / 60 ) - _treatmentAdjustmentDuration.setDurationValue(vTreatmentTime.time_Total / 60) // minutes => hours _treatmentAdjustmentDuration.open() } function onSectionUltrafiltrationClicked ( vValue ) { - _treatmentUltrafiltrationItem.open() + _treatmentAdjustmentUltrafiltration.open() } } - ScreenItem { id: _treatmentTrends } // TODO: make me! - ScreenItem { id: _treatmentHeparin } // TODO: make me! + Connections { target: _treatmentHeparin + function onIdleTimeout ( ) { + _headerBar.headerMenuIndex = HeaderBar.Treatment // on heparin idle timeout go to main treatment + } + } - //// Treatment Adjustment Dialogs - TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow } - TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits } + Connections { target: _treatmentHDF + function onSectionPressuresClicked ( ) { + _treatmentAdjustmentPressuresLimits.open() + } - Connections { target: _treatmentAdjustmentFlow - function onConfirmClicked ( vValue ) { vTreatmentAdjustmentFlows.doAdjustment( - _treatmentAdjustmentFlow.bloodFlowRateValue , - _treatmentAdjustmentFlow.dialysateFlowRateValue ) + function onTreatmentHDFEditClicked ( ) { + _treatmentAdjustmentHDF.open() + } } - Connections { target: _treatmentAdjustmentPressuresLimits - function onConfirmClicked ( vValue ) { vTreatmentAdjustmentPressuresLimits.doAdjustment( - _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow , - _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow , - _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc ) + + Connections { target: _treatmentAdjustmentSetPoints + function onConfirmClicked ( vValue ) { + vTreatmentAdjustmentSetPoints.doAdjustment( + _treatmentAdjustmentSetPoints.bloodFlowRate , + _treatmentAdjustmentSetPoints.dialysateFlowRate , + _treatmentAdjustmentSetPoints.dialysateTemperature , + _treatmentAdjustmentSetPoints.acidConcentrate , + vTreatmentRanges.acidConcentrateModel.get(_treatmentAdjustmentSetPoints.acidConcentrate).value, + _treatmentAdjustmentSetPoints.bicarbConcentrate , + _treatmentAdjustmentSetPoints.treatmentModality , + _treatmentAdjustmentSetPoints.hepatitus , + _treatmentAdjustmentSetPoints.sodium , + _treatmentAdjustmentSetPoints.bicarbonate + ) } } - TreatmentAdjustmentDuration { id: _treatmentAdjustmentDuration } - Connections { target: _treatmentAdjustmentDuration - function onConfirmClicked ( vValue ) { vTreatmentAdjustmentDuration.doAdjustment( - _treatmentAdjustmentDuration.durationValue ) + Connections { target: _treatmentAdjustmentPressuresLimits + function onConfirmClicked ( vValue ) { + vTreatmentAdjustmentPressuresLimits.doAdjustment( + _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc , + _treatmentAdjustmentPressuresLimits.tmpLimitWindow + ) } } - EntryDialog { id: _vitalEntry - function update(vSystolic, vDiastolic ,vHeartRate) { - _bphrEntry.systolic = vSystolic ? vSystolic : "" - _bphrEntry.diastolic = vDiastolic ? vDiastolic : "" - _bphrEntry.heartRate = vHeartRate ? vHeartRate : "" + Connections { target: _treatmentAdjustmentBolusVolume + function onConfirmClicked ( vValue ) { + vTreatmentAdjustmentBolusVolume.doAdjustment(_treatmentAdjustmentBolusVolume.fluidBolusVolume) } + } - titleText : qsTr("VITALS") - confirmEnabled : _bphrEntry.isValid - onConfirmClicked : { - _vitalEntry.close() - vTreatmentVitals.doConfirm( - _bphrEntry.systolic , - _bphrEntry.diastolic , - _bphrEntry.heartRate - ) - _treatmentHome.logVitalTime() + // ---------- Manages Responses ---------- + Connections { target: vTreatmentAdjustmentBolusVolume + function onAdjustmentTriggered ( vValue ) { + if ( vTreatmentAdjustmentBolusVolume.adjustment_Accepted ) { + _treatmentAdjustmentBolusVolume.close() + } + else { + _treatmentAdjustmentBolusVolume.notification.text = vTreatmentAdjustmentBolusVolume.text() + } } + } - onCloseClicked : { - vTreatmentVitals.doSkip() // only for logging + Connections { target: vTreatmentAdjustmentPressuresLimits + function onAdjustmentTriggered ( vValue ) { + if (vTreatmentAdjustmentPressuresLimits.adjustment_Accepted) { + if ( _treatmentAdjustmentPressuresLimits.isValid ) { _treatmentAdjustmentPressuresLimits.close() } + } + else { + _treatmentAdjustmentPressuresLimits.notification.text = vTreatmentAdjustmentPressuresLimits.text() + } } + } - onOpened : vTreatmentVitals.doTimerStop() // Can't be moved to C++, and has to be handled here because it can manually being opened by the user - - onClosed : { - if ( ! vQuit ) - vTreatmentVitals.doTimerStart() + Connections { target: vTreatmentAdjustmentSetPoints + function onAdjustmentTriggered ( vValue ) { + if (vTreatmentAdjustmentSetPoints.adjustment_Accepted) { + vTreatmentCreate.treatmentModality = _treatmentAdjustmentSetPoints.treatmentModality + vTreatmentCreate.acidConcentrate = _treatmentAdjustmentSetPoints.acidConcentrate + vTreatmentCreate.dryBicarbCartSize = _treatmentAdjustmentSetPoints.bicarbConcentrate + vTreatmentCreate.hepatitusBStatus = _treatmentAdjustmentSetPoints.hepatitus + vTreatmentCreate.sodium = _treatmentAdjustmentSetPoints.sodium + vTreatmentCreate.bicarbonate = _treatmentAdjustmentSetPoints.bicarbonate + if ( _treatmentAdjustmentSetPoints.isValid ) { _treatmentAdjustmentSetPoints.close() } + } + else { + _treatmentAdjustmentSetPoints.notification.text = vTreatmentAdjustmentSetPoints.text() + } } + } - BPHREntry { id : _bphrEntry - contentRectHeight : _vitalEntry.contentRect.height - } - Connections { target: vTreatmentVitals - function onDidTrigger ( vSystolic, vDiastolic, vHeartRate ) { - if ( vTreatmentVitals.enableDialog ) { - _vitalEntry.update ( vSystolic, vDiastolic, vHeartRate ) - _vitalEntry.open () - } + Connections { target: vTreatmentAdjustmentVitalsAlarmLimits + function onAdjustmentTriggered ( vValue ) { + if (vTreatmentAdjustmentVitalsAlarmLimits.adjustment_Accepted) { + if ( _treatmentAdjustmentVitalsInterval.isValid ) { _treatmentAdjustmentVitalsInterval.close() } } + else { + _treatmentAdjustmentVitalsInterval.notification.text = vTreatmentAdjustmentVitalsAlarmLimits.text() + } } } - // ---------- Manages Responses ---------- - Connections { target: vTreatmentAdjustmentDuration + Connections { target: vTreatmentAdjustmentBloodPrime function onAdjustmentTriggered ( vValue ) { - if ( vTreatmentAdjustmentDuration.adjustment_Accepted ) { - vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentDuration.ultrafiltration - _treatmentAdjustmentDuration.accept() - } else { - _treatmentAdjustmentDuration.setDurationValue(vTreatmentAdjustmentDuration.duration); - _treatmentAdjustmentDuration.notification.text = vTreatmentAdjustmentDuration.text(); + if (vTreatmentAdjustmentBloodPrime.adjustment_Accepted) { + _treatmentBloodPrime.notification.text = "" } + else { + _treatmentBloodPrime.notification.text = vTreatmentAdjustmentBloodPrime.text() + } } } - Connections { target: vTreatmentAdjustmentPressuresLimits + Connections { target: vTreatmentAdjustmentBloodFlowRate function onAdjustmentTriggered ( vValue ) { - // values have to be update even when rejected HD is reverting back the values. - // if accepted will be updated for later [may need refresh later] - _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow = vTreatmentAdjustmentPressuresLimits.arterialPressureLimitWindow - _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow = vTreatmentAdjustmentPressuresLimits.venousPressureLimitWindow - _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc = vTreatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc - - if (vTreatmentAdjustmentPressuresLimits.adjustment_Accepted) { - _treatmentAdjustmentPressuresLimits.close() + if (vTreatmentAdjustmentBloodPrime.adjustment_Accepted) { + _treatmentBloodPrime.notification.text = "" } else { - _treatmentAdjustmentPressuresLimits.notification.text = vTreatmentAdjustmentPressuresLimits.text() + _treatmentBloodPrime.notification.text = vTreatmentAdjustmentBloodFlowRate.text() } } } Connections { target: vTDOpMode // The initail screen should be the Blood Prime, since that one is the earlier state in the list. // also since it is being used in two stacks In-Treatment and also in End-Treatmet is has been defined in the MainStack. - function onInTreatmentChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} - } - - Connections { target: _treatmentBloodPrime - function onVisibleChanged ( vValue ) { - if (_treatmentBloodPrime.visible) { - _headerBar.menuHidden = true + function onInTreatmentChanged ( vValue ) { + page( _treatmentBloodPrime , vValue ) + if (vValue) { + _treatmentTrends.isParamExpanded = true + vTreatmentTrends.doClearData() } } } Connections { target: vTDTreatmentStates // in-Treatmet - function onTxBloodPrimeChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} - function onTxDialysisChanged ( vValue ) { page( _treatmentHome , vValue )} + function onTxBloodPrimeChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} + function onTxDialysisChanged ( vValue ) { page( _treatmentHome , vValue )} + function onTxEndChanged ( vValue ) { if ( vValue ) { _endTreatmentDialog.open() }} + function onTxRinsebackChanged ( vValue ) { page( _endTreatmentRinsebackStack , vValue )} + function onTxRecirculateChanged ( vValue ) { page( _endTreatmentRecirculateStack , vValue )} } - - Connections { target: _mainHome - function onStartTreatment ( vValue ) { page( _treatmentHome )} - } }