Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -r54221e0e6482d4124661190fab14551cba0ec535 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 54221e0e6482d4124661190fab14551cba0ec535) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,21 +1,21 @@ /*! * - * 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) 28-Feb-2021 + * \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 +//import QtCharts 2.3 // Qml imports import "qrc:/globals" @@ -32,6 +32,14 @@ StackItem { id : _root 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 + _treatmentAdjustmentPressuresLimits .close() + _treatmentAdjustmentDuration .close() + _treatmentUltrafiltrationItem .close() + } + stackView.initialItem : null // ultrafiltration state information bar properties @@ -43,207 +51,146 @@ readonly property bool isSBInProgress : ( vHDTreatmentStates.sbRunning || vHDTreatmentStates.sbWaitPump ) + readonly property bool isDialogOpened : _treatmentAdjustmentFlow .visible + || _treatmentAdjustmentPressuresLimits .visible + || _treatmentAdjustmentDuration .visible + || _treatmentUltrafiltrationItem .visible // Components MainMenu { id: _treatmentMenu y : Variables.mainMenuHeight * -1 position : MainMenu.Position.Top hidden : true titles : [ qsTr("Treatment") , qsTr("Trending") , qsTr("Settings") ] + visibleItems : [ true , false , false ] spacing : 20 leftPdding : 20 + 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() } + */ } TreatmentBloodPrime { id: _treatmentBloodPrime } TreatmentUltrafiltrationItem{ id: _treatmentUltrafiltrationItem } - TreatmentHome { id: _treatmentHome - onSectionFlowClicked : { + TreatmentHome { id: _treatmentHome } + + Connections { target: _treatmentHome + function onSectionFlowClicked ( vValue ) { _treatmentAdjustmentFlow.open() } - onSectionVitalsClicked : { + 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: { + function onSectionUltrafiltrationClicked ( vValue ) { _treatmentUltrafiltrationItem.open() } } - ScreenItem { id: _treatmentTrending -/* ----- TEST: Under the test code, for the plotting of the items ----- - Timer { id: _timer - property real x1: 0 - property real x2: 0 - interval: 500 - running: _treatmentTrending.visible - repeat: true - onTriggered: { - x1 = x1 + 1 - x2 = x2 + 0.1 + ScreenItem { id: _treatmentTrending } - var r = Math.random() - _lineSerries1.append(x1, r * 10 ) - _lineSerries2.append(x2, r ) - } - } - Column { - anchors.fill: parent - anchors.topMargin: Variables.mainMenuHeight - Slider { id : _zoomSlider - width : parent.width - minimum : 0 - maximum : 2 - step : 0.1 - value : 0 - onValueChanged: _chartView.zoom(value) - } - TouchRect { - width : 50 - height : 50 - onClicked: _chartView.zoomReset() - } + //// Treatment Adjustment Dialogs + TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow } + TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits } - ChartView { id: _chartView - title: "Line" - width: parent.width - height: parent.height - _zoomSlider.height - antialiasing: true - backgroundColor: Colors.transparent - - legend.labelColor: Colors.white - - ValueAxis { id: xAxis1 - color: Colors.white - min: 0 - max: _timer.x1 - } - ValueAxis { id: yAxis1 - color: Colors.white - min: 0 - max: 10 - } - SplineSeries { id: _lineSerries1 - name: "LineSeries" - axisX: xAxis1 - axisY: yAxis1 - } - ValueAxis { id: xAxis2 - color: Colors.white - min: 0 - max: _timer.x2 - } - ValueAxis { id: yAxis2 - color: Colors.white - labelsColor: Colors.red - min: 0 - max: 10 - } - SplineSeries { id: _lineSerries2 - name: "LineSeries" - axisX: xAxis2 - axisY: yAxis2 - } - } + Connections { target: _treatmentAdjustmentFlow + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentFlows.doAdjustment( + _treatmentAdjustmentFlow.bloodFlowRateValue , + _treatmentAdjustmentFlow.dialysateFlowRateValue ) } -*/ } + Connections { target: _treatmentAdjustmentPressuresLimits + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentPressuresLimits.doAdjustment( + _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow , + _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc ) + } + } - //// Treatment Adjustment Dialogs - TreatmentAdjustmentFlow { id: _treatmentAdjustmentFlow - onConfirmClicked : vTreatmentAdjustmentFlows.doAdjustment(bloodFlowRateValue, dialysateFlowRateValue) + TreatmentAdjustmentDuration { id: _treatmentAdjustmentDuration } + Connections { target: _treatmentAdjustmentDuration + function onConfirmClicked ( vValue ) { vTreatmentAdjustmentDuration.doAdjustment( + _treatmentAdjustmentDuration.durationValue ) + } } EntryDialog { id: _vitalEntry + function update(vSystolic, vDiastolic ,vHeartRate) { + _bphrEntry.systolic = vSystolic ? vSystolic : "" + _bphrEntry.diastolic = vDiastolic ? vDiastolic : "" + _bphrEntry.heartRate = vHeartRate ? vHeartRate : "" + } + titleText : qsTr("VITALS") - autoHide : true - autoHideDuration : vTreatmentVitals.timeout * 60000 // min => ms confirmEnabled : _bphrEntry.isValid onConfirmClicked : { + _vitalEntry.close() vTreatmentVitals.doConfirm( _bphrEntry.systolic , _bphrEntry.diastolic , _bphrEntry.heartRate ) - _vitalEntry.close() } - onCloseClicked : + onCloseClicked : { vTreatmentVitals.doSkip() // only for logging + } - onAutoHidden : - vTreatmentVitals.doTimeout() // only for logging + 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() + } + BPHREntry { id : _bphrEntry contentRectHeight : _vitalEntry.contentRect.height - onClicked : { - _vitalEntry.autoHideCancel = true + } + + Connections { target: vTreatmentVitals + function onDidTrigger ( vSystolic, vDiastolic, vHeartRate ) { + if ( vTreatmentVitals.enableDialog ) { + _vitalEntry.update ( vSystolic, vDiastolic, vHeartRate ) + _vitalEntry.open () + } } } } - TreatmentAdjustmentPressuresLimits { id: _treatmentAdjustmentPressuresLimits - 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 - } - - TreatmentAdjustmentDuration { id: _treatmentAdjustmentDuration - onConfirmClicked : vTreatmentAdjustmentDuration.doAdjustment(durationValue) - } - // ---------- 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: vTreatmentAdjustmentPressuresLimits - onAdjustmentTriggered : { + 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.arterialPressureLowerBound = vTreatmentAdjustmentPressuresLimits.arterialLimitLow - _treatmentAdjustmentPressuresLimits.arterialPressureUpperBound = vTreatmentAdjustmentPressuresLimits.arterialLimitHigh - _treatmentAdjustmentPressuresLimits.venousPressureLowerBound = vTreatmentAdjustmentPressuresLimits.venousLimitLow - _treatmentAdjustmentPressuresLimits.venousPressureUpperBound = vTreatmentAdjustmentPressuresLimits.venousLimitHigh + _treatmentAdjustmentPressuresLimits.arterialPressureLimitWindow = vTreatmentAdjustmentPressuresLimits.arterialPressureLimitWindow + _treatmentAdjustmentPressuresLimits.venousPressureLimitWindow = vTreatmentAdjustmentPressuresLimits.venousPressureLimitWindow + _treatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc = vTreatmentAdjustmentPressuresLimits.venousPressureLimitAsymtrc if (vTreatmentAdjustmentPressuresLimits.adjustment_Accepted) { _treatmentAdjustmentPressuresLimits.close() @@ -257,11 +204,11 @@ 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. - onInTreatmentChanged : { page( _treatmentBloodPrime , vinTreatment )} + function onInTreatmentChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} } Connections { target: _treatmentBloodPrime - onVisibleChanged: { + function onVisibleChanged ( vValue ) { if (_treatmentBloodPrime.visible) { _treatmentMenu.hidden = true } @@ -270,16 +217,11 @@ Connections { target: vHDTreatmentStates // in-Treatmet - onTxBloodPrimeChanged : { page( _treatmentBloodPrime , vtxBloodPrime )} - onTxDialysisChanged : { page( _treatmentHome , vtxDialysis )} + function onTxBloodPrimeChanged ( vValue ) { page( _treatmentBloodPrime , vValue )} + function onTxDialysisChanged ( vValue ) { page( _treatmentHome , vValue )} } Connections { target: _mainHome - onStartTreatment : { page ( _treatmentHome )} + function onStartTreatment ( vValue ) { page( _treatmentHome )} } - - Connections { target: vTreatmentVitals - onDidTrigger : { _vitalEntry.open() } - } - }