Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -ra25dee6ed9a8cd343056d92bc3a78617eed66a6f -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision a25dee6ed9a8cd343056d92bc3a78617eed66a6f) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,37 +1,27 @@ /*! - * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * - * \file TreatmentStack.qml - * \author (last) Behrouz NematiPour - * \date (last) 16-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 27-Jan-2020 - * + * + * \file TreatmentStack.qml + * \author (last) Vy + * \date (last) 14-Jun-2023 + * \author (original) Behrouz NematiPour + * \date (original) 27-Jan-2020 + * */ // Qt import QtQuick 2.12 +//import QtCharts 2.3 -// Project -import Gui.Actions 0.1 -import VTreatmentRanges 0.1 -import VTreatmentAdjustmentSaline 0.1 -import VHDTreatmentStates 0.1 -import VTreatmentAdjustmentUltrafiltrationState 0.1 -import VTreatmentAdjustmentUltrafiltrationEdit 0.1 -import VTreatmentAdjustmentUltrafiltrationConfirm 0.1 -import VTreatmentAdjustmentPressuresLimits 0.1 -import VTreatmentAdjustmentHeparin 0.1 - // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" import "qrc:/pages/treatment/adjustments" -import "qrc:/pages/pretreatment/create" /*! * \brief TreatmentStack is the screen @@ -42,287 +32,196 @@ StackItem { id : _root objectName: "TreatmentStack" - stackView.initialItem : _treatmentHome + 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 + _treatmentAdjustmentPressuresLimits .close() + _treatmentAdjustmentDuration .close() + _treatmentUltrafiltrationItem .close() + } - // Views - VTreatmentRanges { id: vTreatmentRanges } - VTreatmentAdjustmentSaline { id: vTreatmentAdjustmentSaline } - VHDTreatmentStates { id: vHDTreatmentStates } - VTreatmentAdjustmentUltrafiltrationState { id: vTreatmentAdjustmentUltrafiltrationState } - VTreatmentAdjustmentUltrafiltrationEdit { id: vTreatmentAdjustmentUltrafiltrationEdit } - VTreatmentAdjustmentUltrafiltrationConfirm { id: vTreatmentAdjustmentUltrafiltrationConfirm } - VTreatmentAdjustmentPressuresLimits { id: vTreatmentAdjustmentPressuresLimits } - VTreatmentAdjustmentHeparin { id: vTreatmentAdjustmentHeparin } + stackView.initialItem : null // ultrafiltration state information bar properties readonly property bool isUFPaused : vHDTreatmentStates.ufPaused - readonly property bool isUFOff : vHDTreatmentStates.ufOff readonly property bool isUFRunning : vHDTreatmentStates.ufRunning - readonly property bool isUFCompleted : vHDTreatmentStates.ufCompleted - readonly property string ufInfoImageSource : isUFPaused ? "qrc:/images/iPauseGray" : - isUFOff ? "qrc:/images/iOffGray" : - isUFCompleted ? "qrc:/images/iDone" : "" - readonly property string ufInfoText : isUFPaused ? qsTr("Ultrafiltration is paused" ) : - isUFOff ? qsTr("Ultrafiltration is off" ) : - isUFCompleted ? qsTr("Ultrafiltration is completed" ) : "" - readonly property string ufInfoTextColor : isUFPaused ? "gray" : - isUFOff ? "gray" : - isUFCompleted ? "lightgray" : "" + 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 : ( vHDTreatmentStates.sbRunning || vHDTreatmentStates.sbWaitPump ) + readonly property bool isDialogOpened : _treatmentAdjustmentFlow .visible + || _treatmentAdjustmentPressuresLimits .visible + || _treatmentAdjustmentDuration .visible + || _treatmentUltrafiltrationItem .visible // Components - MainMenu { id: _treatmentMenu + MainMenu { id: _treatmentMenu y : Variables.mainMenuHeight * -1 position : MainMenu.Position.Top hidden : true - titles : [ qsTr("Back") , qsTr("Treatment") , qsTr("Trending") , qsTr("Settings") ] + titles : [ qsTr("Treatment") , qsTr("Trending") , qsTr("Settings") ] + visibleItems : [ true , false , false ] spacing : 20 leftPdding : 20 - partitionWidth : 100 // Todo Important : max width should be the width for all + rightPdding : 50 + partitionWidth : 100 // Todo Important : max width should be the width for all bottons hasRightText : true hasLogo : true + /* ----- TEST: Under the test code, for the plotting of the items ----- + onCurrentIndexChanged: { + console.debug(currentIndex) + if (currentIndex == 1) push(_treatmentTrending) + if (currentIndex == 0) pop() + } + */ } - TreatmentHome { id: _treatmentHome - onTreatmentStarted : push( _treatmentStart ) - onTreatmentCreated : vTreatmentCreate.doSelectParameters() - } + TreatmentBloodPrime { id: _treatmentBloodPrime } + TreatmentUltrafiltrationItem{ id: _treatmentUltrafiltrationItem } + TreatmentHome { id: _treatmentHome } - TreatmentStart { id: _treatmentStart - onBackClicked : popToItem(_treatmentHome) - onSectionFlowClicked : { + Connections { target: _treatmentHome + function onSectionFlowClicked ( vValue ) { _treatmentAdjustmentFlow.open() } - onSectionVitalsClicked: { - // no page yet + function onSectionVitalsClicked ( vValue ) { + _vitalEntry.open() } - onSectionPressuresClicked: { + function onSectionPressuresClicked ( vValue ) { _treatmentAdjustmentPressuresLimits.open() } - onSectionTimeClicked : { - _treatmentAdjustmentDuration.durationValue = vTreatmentTime.time_Total / 60 // minutes => hours + function onSectionTimeClicked ( vValue ) { + //DEBUG: console.log("time total minutes: " + vTreatmentTime.time_Total / 60 ) + _treatmentAdjustmentDuration.setDurationValue(vTreatmentTime.time_Total / 60) // minutes => hours _treatmentAdjustmentDuration.open() } - onSectionUltrafiltrationClicked: { - if ( isUFRunning ) { - _treatmentAdjustmentUltrafiltrationStart .open() - } else { - _treatmentAdjustmentUltrafiltrationPaused.open() - } + function onSectionUltrafiltrationClicked ( vValue ) { + _treatmentUltrafiltrationItem.open() } } - PreTreatmentCreate { id: _pretreatmentCreate - onBackClicked : {vTreatmentCreate.doCancelSelectingParameters() } - onContinueClicked : {vTreatmentCreate.doFinishedCreate(); } - } + ScreenItem { id: _treatmentTrending } - PreTreatmentConfirm { id: _pretreatmentConfirm - onBackClicked : {vTreatmentCreate.doCancelConfirmParameters() } - onConfirmClicked : {vTreatmentCreate.doFinishedConfirm(); } - } - - PreTreatmentPrime { id: _pretreatmentPrime - onBackClicked : {vTreatmentCreate.doRequestPop() } - onContinueClicked : {vTreatmentCreate.doFinishedPrime(); } - } - - PreTreatmentUltrafiltration { id: _pretreatmentUltrafiltration - onBackClicked : {vTreatmentCreate.doRequestPop() } - onStartClicked : {vTreatmentAdjustmentUltrafiltrationInit.doAdjustment(_pretreatmentUltrafiltration.ufVolume) } - } - //// Treatment Adjustment Dialogs - TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow - onCloseClicked : close() - onConfirmClicked : vTreatmentAdjustmentFlows.doAdjustment(bloodFlowRateValue, dialysateFlowRateValue) - } + TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow } + TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits } - TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits - onCloseClicked : close() - onConfirmClicked : vTreatmentAdjustmentPressuresLimits.doAdjustment( - arterialPressureLowerBound , - arterialPressureUpperBound , - venousPressureLowerBound , - venousPressureUpperBound - ) - - arterialPressureMinimum : Variables.arterialValueMin - arterialPressureLowerBound : vTreatmentAdjustmentPressuresLimits.arterialLimitLow - arterialPressureUpperBound : vTreatmentAdjustmentPressuresLimits.arterialLimitHigh - arterialPressureMaximum : Variables.arterialValueMax - - venousPressureMinimum : Variables.venousValueMin - venousPressureLowerBound : vTreatmentAdjustmentPressuresLimits.venousLimitLow - venousPressureUpperBound : vTreatmentAdjustmentPressuresLimits.venousLimitHigh - venousPressureMaximum : Variables.venousValueMax - - arterialPressureStep : Variables.arterialLimitStep - arterialPressureValue : vTreatmentPressureOcclusion.arterialPressure - - venousPressureStep : Variables.venousLimitStep - venousPressureValue : vTreatmentPressureOcclusion.venousPressure + Connections { target: _treatmentAdjustmentFlow + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentFlows.doAdjustment( + _treatmentAdjustmentFlow.bloodFlowRateValue , + _treatmentAdjustmentFlow.dialysateFlowRateValue ) + } } - - TreatmentAdjustmentDuration { id: _treatmentAdjustmentDuration - onCloseClicked : close() - onConfirmClicked : vTreatmentAdjustmentDuration.doAdjustment(durationValue) + Connections { target: _treatmentAdjustmentPressuresLimits + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentPressuresLimits.doAdjustment( + _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc ) + } } - TreatmentAdjustmentUltrafiltrationStart { id: _treatmentAdjustmentUltrafiltrationStart - onCloseClicked : close() - onPauseClicked : { - // send pause to HD and wait. - // if accepted close() - // not accepted show error in notification - vTreatmentAdjustmentUltrafiltrationState.doPause() + TreatmentAdjustmentDuration { id: _treatmentAdjustmentDuration } + Connections { target: _treatmentAdjustmentDuration + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentDuration.doAdjustment( + _treatmentAdjustmentDuration.durationValue ) } } - TreatmentAdjustmentUltrafiltrationPaused { id: _treatmentAdjustmentUltrafiltrationPaused - onCloseClicked : close() - onEditClicked : { - close() - _treatmentAdjustmentUltrafiltrationEdit.reset() // reset the slider to minimum value position - _treatmentAdjustmentUltrafiltrationEdit.open() + EntryDialog { id: _vitalEntry + function update(vSystolic, vDiastolic ,vHeartRate) { + _bphrEntry.systolic = vSystolic ? vSystolic : "" + _bphrEntry.diastolic = vDiastolic ? vDiastolic : "" + _bphrEntry.heartRate = vHeartRate ? vHeartRate : "" } - onResumeClicked : { - // send resume to HD and wait. - // if accepted close() - // not accepted show error in notification - vTreatmentAdjustmentUltrafiltrationState.doResume() + + titleText : qsTr("VITALS") + confirmEnabled : _bphrEntry.isValid + onConfirmClicked : { + _vitalEntry.close() + vTreatmentVitals.doConfirm( + _bphrEntry.systolic , + _bphrEntry.diastolic , + _bphrEntry.heartRate + ) } - } - TreatmentAdjustmentUltrafiltrationEdit { id: _treatmentAdjustmentUltrafiltrationEdit - onBackClicked : { - close() - _treatmentAdjustmentUltrafiltrationPaused.open() + onCloseClicked : { + vTreatmentVitals.doSkip() // only for logging } - onNextClicked : { - // send Volume to HD and wait. - // if accepted close() - // not accepted show error in notification - vTreatmentAdjustmentUltrafiltrationEdit.doAdjustment(vVolume) + + 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() } - } - TreatmentAdjustmentUltrafiltrationConfirm { id: _treatmentAdjustmentUltrafiltrationConfirm - onBackClicked : { - close() - _treatmentAdjustmentUltrafiltrationEdit.open () + BPHREntry { id : _bphrEntry + contentRectHeight : _vitalEntry.contentRect.height } - onConfirmRateClicked : { - vTreatmentAdjustmentUltrafiltrationConfirm.doOptionRate(vVolume) + + Connections { target: vTreatmentVitals + function onDidTrigger ( vSystolic, vDiastolic, vHeartRate ) { + if ( vTreatmentVitals.enableDialog ) { + _vitalEntry.update ( vSystolic, vDiastolic, vHeartRate ) + _vitalEntry.open () + } + } } - onConfirmDurationClicked: { - vTreatmentAdjustmentUltrafiltrationConfirm.doOptionDuration(vVolume) - } } // ---------- Manages Responses ---------- Connections { target: vTreatmentAdjustmentDuration - onAdjustmentTriggered : { + function onAdjustmentTriggered ( vValue ) { if ( vTreatmentAdjustmentDuration.adjustment_Accepted ) { vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentDuration.ultrafiltration _treatmentAdjustmentDuration.accept() } else { - _treatmentAdjustmentDuration.durationValue = vTreatmentAdjustmentDuration.duration; + _treatmentAdjustmentDuration.setDurationValue(vTreatmentAdjustmentDuration.duration); _treatmentAdjustmentDuration.notification.text = vTreatmentAdjustmentDuration.text(); } } } - Connections { target: vTreatmentAdjustmentUltrafiltrationInit - onAdjustmentTriggered : { - // the maximum ultrafiltration volume has to be set/revert regardless - vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentUltrafiltrationInit.volume - _pretreatmentUltrafiltration.ufVolume = vTreatmentAdjustmentUltrafiltrationInit.volume - // but only if it has been accepted it will navigate - if (vTreatmentAdjustmentUltrafiltrationInit.adjustment_Accepted) { - vTreatmentCreate.doStartTreatment() - } - else { - _pretreatmentUltrafiltration.reasonText = vTreatmentAdjustmentUltrafiltrationInit.text() - } - } - } + Connections { target: vTreatmentAdjustmentPressuresLimits + 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 - Connections { target: vTreatmentAdjustmentUltrafiltrationState - onAdjustmentTriggered : { - if ( vTreatmentAdjustmentUltrafiltrationState.adjustment_Accepted ) { - if (vHDTreatmentStates.ufPaused) { // handle screen regarding current accepted - _treatmentAdjustmentUltrafiltrationStart .close() - _treatmentAdjustmentUltrafiltrationPaused.open () - } else { - _treatmentAdjustmentUltrafiltrationPaused.close() - } + if (vTreatmentAdjustmentPressuresLimits.adjustment_Accepted) { + _treatmentAdjustmentPressuresLimits.close() } else { - if (vHDTreatmentStates.ufRunning) { // handle error messages regarding current accepted - _treatmentAdjustmentUltrafiltrationStart.notificationText = vTreatmentAdjustmentUltrafiltrationState.adjustment_ReasonText - } else { - _treatmentAdjustmentUltrafiltrationPaused.notificationText = vTreatmentAdjustmentUltrafiltrationState.adjustment_ReasonText - } + _treatmentAdjustmentPressuresLimits.notification.text = vTreatmentAdjustmentPressuresLimits.text() } } } - Connections { target: vTreatmentAdjustmentUltrafiltrationEdit - onAdjustmentTriggered : { - if (vTreatmentAdjustmentUltrafiltrationEdit.adjustment_Accepted) { - _treatmentAdjustmentUltrafiltrationConfirm.ultrafiltrationVolume = vTreatmentAdjustmentUltrafiltrationEdit.volume - _treatmentAdjustmentUltrafiltrationConfirm.treatmentDuration = vTreatmentAdjustmentUltrafiltrationEdit.duration - _treatmentAdjustmentUltrafiltrationConfirm.treatmentDurationDiff = vTreatmentAdjustmentUltrafiltrationEdit.durationDiff - _treatmentAdjustmentUltrafiltrationConfirm.ultrafiltrationRate = vTreatmentAdjustmentUltrafiltrationEdit.rate - _treatmentAdjustmentUltrafiltrationConfirm.ultrafiltrationRateDiff = vTreatmentAdjustmentUltrafiltrationEdit.rateDiff - _treatmentAdjustmentUltrafiltrationConfirm.ultrafiltrationRateOld = vTreatmentAdjustmentUltrafiltrationEdit.rateOld - - _treatmentAdjustmentUltrafiltrationEdit .close() - _treatmentAdjustmentUltrafiltrationConfirm.reset() - _treatmentAdjustmentUltrafiltrationConfirm.open () - } else { - _treatmentAdjustmentUltrafiltrationEdit.notification.text = vTreatmentAdjustmentUltrafiltrationEdit.text() - } - } + Connections { target: vHDOperationMode + // 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: vTreatmentAdjustmentUltrafiltrationConfirm - onAdjustmentTriggered : { - if (vTreatmentAdjustmentUltrafiltrationConfirm.adjustment_Accepted) { - vTreatmentUltrafiltration.maximum = vTreatmentAdjustmentUltrafiltrationConfirm.volume - _treatmentAdjustmentUltrafiltrationConfirm.close() - } else { - _treatmentAdjustmentUltrafiltrationConfirm.notification.text = vTreatmentAdjustmentUltrafiltrationConfirm.text() + Connections { target: _treatmentBloodPrime + function onVisibleChanged ( vValue ) { + if (_treatmentBloodPrime.visible) { + _treatmentMenu.hidden = true } } } - Connections { target: vTreatmentAdjustmentPressuresLimits - onAdjustmentTriggered : { - // 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.arterialPressureLowerBound = vTreatmentAdjustmentPressuresLimits.arterialLimitLow - _treatmentAdjustmentPressuresLimits.arterialPressureUpperBound = vTreatmentAdjustmentPressuresLimits.arterialLimitHigh - _treatmentAdjustmentPressuresLimits.venousPressureLowerBound = vTreatmentAdjustmentPressuresLimits.venousLimitLow - _treatmentAdjustmentPressuresLimits.venousPressureUpperBound = vTreatmentAdjustmentPressuresLimits.venousLimitHigh - - if (vTreatmentAdjustmentPressuresLimits.adjustment_Accepted) { - _treatmentAdjustmentPressuresLimits.close() - } - else { - _treatmentAdjustmentPressuresLimits.notification.text = vTreatmentAdjustmentPressuresLimits.text() - } - } + Connections { target: vHDTreatmentStates + // in-Treatmet + function onTxBloodPrimeChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} + function onTxDialysisChanged ( vValue ) { page( _treatmentHome , vValue )} } - Connections { target: vTreatmentCreate - onShowCreate : { push(_pretreatmentCreate) } - onShowConfirm : { push(_pretreatmentConfirm) } - onShowPrime : { push(_pretreatmentPrime) } - onShowBegin : { push(_pretreatmentUltrafiltration) } - onPop : { pop() } - onShowTreatmentStart : { push(_treatmentStart) } + Connections { target: _mainHome + function onStartTreatment ( vValue ) { page( _treatmentHome )} } }