Index: sources/gui/qml/pages/MainStack.qml =================================================================== diff -u -rb50431293b0690d6071f0fd58044880909cef01d -r11a7a3223f8405b6cfba01f8f684fadb2090e0cc --- sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision b50431293b0690d6071f0fd58044880909cef01d) +++ sources/gui/qml/pages/MainStack.qml (.../MainStack.qml) (revision 11a7a3223f8405b6cfba01f8f684fadb2090e0cc) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2022 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 ManagerStack.qml + * \file MainStack.qml * \author (last) Behrouz NematiPour - * \date (last) 10-Mar-2021 + * \date (last) 28-Jan-2022 * \author (original) Behrouz NematiPour - * \date (original) 21-Oct-2019 + * \date (original) 01-Mar-2021 * */ @@ -34,8 +34,12 @@ * is selected from the main menu. */ StackItem { id : _root - stackView.initialItem : _initialModeScreen + // DEBUG: this property can mostly be used for debugging to get pass the initial screen + property var initialItem: _postModeScreen + + stackView.initialItem : _root.initialItem + function doSettingsDisinfect() { _mainMenu.currentIndex = 0 page( _disinfectStack ) @@ -69,19 +73,19 @@ onVisibleChanged: if (visible) _mainMenu.hidden = true } - ScreenItem { id: _initialModeScreen + ScreenItem { id: _postModeScreen onVisibleChanged: if (visible) _mainMenu.hidden = true Image { id: _dialityLogo Behavior on opacity { OpacityAnimator { duration: 1000 } } - opacity : _initialModeScreen.visible ? 1 : 0 + opacity : _postModeScreen.visible ? 1 : 0 anchors.centerIn: parent source : "qrc:/images/iLogoDiality" } ProgressBar { minimum : 0 maximum : vHDPOSTData.itemCount - value : vHDPOSTData.start ? vHDPOSTData.itemIndex + 1 : 0 // the index starts from 0 and 0 which is a valid test index will not show anything. So for progress we start from 1. + value : vHDPOSTData.itemIndex width : _dialityLogo.width + 50 height : 3 minText .visible: false @@ -104,20 +108,52 @@ visible : true // HD will pause for a few seconds before changing to stand-by mode // So we can show that POST has completed - done : vHDPOSTData.done fail : ! vHDPOSTData.doneResult + done : vHDPOSTData.done + pause : ! _postModeScreen.visible } } MainHome { id: _mainHome onStartTreatment : { page( _treatmentStack )} - onCreateTreatment : { vPreTreatmentAdjustmentInitTreatment.doInitiate() } + onCreateTreatment : { vPreTreatmentAdjustmentInitTreatment.doInitiate() + if ( vSettings.noCANBus ) + vHDOperationMode.validateParametersChanged(true) + } + onVisibleChanged: { + if (visible) { + _mainMenu.hidden = false // initially our landing screen is _initialModeScreen which should not have the Main menu. + } + } } + Connections { target: vSettings + onNoCANBusChanged: { + //// DEBUG: + // console.debug("vSettings.noCANBus" , vSettings .noCANBus , + // "vHDOperationMode.init" , vHDOperationMode .init , + // "vHDOperationMode.fault" , vHDOperationMode .fault , + // "vHDOperationMode.opMode" , vHDOperationMode .opMode ) + if ( vSettings.noCANBus ) { + page( _mainHome , + vHDOperationMode.fault || // in fault mode + vHDOperationMode.init || // in initial post mode + vHDOperationMode.opMode === 0 // has not even been initialized , which most probably is the case. + ) + } + } + } + Connections { target: vHDOperationMode - // onFaultChanged : { page( _faultModeScreen , vfault )} // may needed later. + onIsTreatmentChanged : { if( visTreatment ) _mainMenu.isTreatment() } + onIsManagerChanged : { if( visManager ) _mainMenu.isManager () } + onIsSettingsChanged : { if( visSettings ) _mainMenu.isSettings () } + + onFaultChanged : { page( _faultModeScreen , vfault )} onServiceChanged : { page( _serviceModeScreen , vservice )} - onInitChanged : { page( _initialModeScreen , vinit )} + onInitChanged : { page( _postModeScreen , vinit ) + if ( vinit ) vHDPOSTData.reset() // better to reset on vinit = true because the rest makes the screen animation to run + } onHomeChanged : { page( _mainHome , vhome )} onStandbyChanged : { /* It depends on the subModes of the standBy. Handled by onHome. */ } @@ -132,6 +168,20 @@ onInvalidModeChanged : { page( null , vinvalidMode )} } + // As long as UI is in In-Tx BP/HR is updated and the dialog will pop up on interval. + Connections { target: vHDOperationMode + onInTreatmentChanged : { + vTreatmentVitals.enableDialog = vinTreatment + if ( vinTreatment ) { + vTreatmentVitals.doTimerStart() + } + else { + vTreatmentVitals.doTimerStop() + vTreatmentVitals.doReset() + } + } + } + // the page function is more flixible regarding our current design // and it's easier(or may not need) to modify later if required. // and is more optimized and will never leave screen empty @@ -155,18 +205,7 @@ Connections { target: vPreTreatmentAdjustmentInitTreatment onAdjustmentTriggered: { - // this may be handled by alarm and in that case if it is shown, it would be duplicate or simply will be covered by alarm. - // if not it is not handled by alarm, removing the comment will make it work properly, since the MainHome modified to support this. - // _mainHome.reasonText = vPreTreatmentAdjustmentInitTreatment.text() + _mainHome.reasonText = vPreTreatmentAdjustmentInitTreatment.adjustment_ReasonText } } - - onVisibleChanged: { - if (visible) { - _mainMenu.hidden = true // initially our landing screen is _initialModeScreen which should not have the Main menu. - } - else { - stackView.initialItem = null - } - } }