Index: sources/gui/qml/main.qml =================================================================== diff -u -r93b6bd48e2aec1fca4f2b5b79dcefffa49e9ce16 -rc15ce613e372838316d42c40a86953e6f0aa05d3 --- sources/gui/qml/main.qml (.../main.qml) (revision 93b6bd48e2aec1fca4f2b5b79dcefffa49e9ce16) +++ sources/gui/qml/main.qml (.../main.qml) (revision c15ce613e372838316d42c40a86953e6f0aa05d3) @@ -5,11 +5,11 @@ * 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 main.qml - * \author (last) Peter Lucia - * \date (last) 15-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 24-Sep-2019 + * \file main.qml + * \author (last) Behrouz NematiPour + * \date (last) 28-Feb-2021 + * \author (original) Behrouz NematiPour + * \date (original) 24-Sep-2019 * */ @@ -30,8 +30,6 @@ import VTreatmentPressureOcclusion 0.1 import VTreatmentUltrafiltration 0.1 import VTreatmentTime 0.1 -import VAlarmStatus 0.1 -import VPowerOff 0.1 import VHDOperationMode 0.1 import VTreatmentRinseback 0.1 import VTreatmentRecirculate 0.1 @@ -80,26 +78,6 @@ width : Variables.applicationWidth height: Variables.applicationHeight - property alias powerOffDialog: _powerOffDialog - - GuiView { id: _GuiView - onDidActionReceive: { - //console.debug(vAction, vData) - switch(vAction) { - case GuiActions.ID_ShuttingDown: - _autoHideInfo.showDialog( - qsTr("System is shutting down"), - 5000 // if any error happens and shutdown is not successful then after 5 seconds dialog hides. - ) - break; - } - } - } - - // TODO : When Testing data on Setting screen is removed - // This needs to be moved into the Treatment______.qml - VAlarmStatus { id: vAlarmStatus } - VPowerOff { id: vPowerOff } VHDOperationMode { id: vHDOperationMode } VTreatmentBloodFlow { id: vTreatmentBloodFlow } VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } @@ -142,116 +120,39 @@ VTreatmentAdjustmentRecirculate { id: vTreatmentAdjustmentRecirculate } VTreatmentAdjustmentEnd { id: vTreatmentAdjustmentEnd } VTreatmentAdjustmentVersions { id: vTreatmentAdjustmentVersions } + + Background {} + + GuiView { id: _GuiView } + // ----- Follow the below Z order ----- // 1 - Screens // 1 - 1 - SettingsStack { id: _settingsStack } + SettingsStack { id: _settingsStack } // 1 - 2 - ManagerStack { id: _managerStack } + ManagerStack { id: _managerStack } // 1 - 3 - TreatmentStack { id: _treatmentStack } + MainStack { id: _mainStack } + PowerItem {} + // 3 - Footer MainMenu { id: _mainMenu titles: [ qsTr("Treatment") , qsTr("Manager") , qsTr("Settings") ] Component.onCompleted: { - _treatmentStack.visible = true + _settingsStack.visible = false + _managerStack .visible = false + _mainStack .visible = true } + onItemPressed: { - _treatmentStack.visible = vIndex == 0; + _mainStack .visible = vIndex == 0; _managerStack .visible = vIndex == 1; _settingsStack .visible = vIndex == 2; } } - // 4 - Modals - AutoHideInfo { id: _autoHideInfo } - PowerOff { id: _powerOffDialog - onAccepted: { - _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.Accepted) - } - onRejected: { - _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.Rejected) - } - } - - // Alarms - function alarmMinimize() { - _alarmDialog .visible = false - _alarmListDialog.visible = false - _alarmBar .visible = true - } - function alarmMaximize() { - _alarmDialog .visible = true - _alarmListDialog.visible = false - _alarmBar .visible = false - } - function alarmList() { - _alarmDialog .visible = false - _alarmListDialog.visible = true - _alarmBar .visible = false - } - function alarmHide() { - _alarmDialog .visible = false - _alarmListDialog.visible = false - _alarmBar .visible = false - } - - NotificationBar { id : _alarmBar - backgroundColor : _alarmDialog.backgroundColor - textColor : _alarmDialog.textColor - anchors.bottom : _mainMenu.top - text : vAlarmStatus.text; - isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced - timeout : vAlarmStatus.alarm_MuteTimeout - - onMuteClicked : vAlarmStatus.doSilence() - onListClicked : alarmList() - onMaximizeClicked : alarmMaximize() - onClicked : alarmMaximize() - } - - // TODO : Later need to create a base Notification dialog class - // and inherit NotificationDialog and AlarmListDialog from that - // Beter be the NotificationDialog defined as parent - // and two separate dialogs by the names of AlarmDialog , AlarmListDlialog creatd. - // Same for the Notification Bar - NotificationDialog { id : _alarmDialog - // this will change later to the actual message text - // and the instruction would be in the dialog content - titleText : "Alarm" - description : vAlarmStatus.text - alarmID : vAlarmStatus.alarm_AlarmID - isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced - timeout : vAlarmStatus.alarm_MuteTimeout - okVisible : vAlarmStatus.alarm_Flag_UserMustAck - resumeVisible : ! vAlarmStatus.alarm_Flag_noResume - rinsebackVisible : ! vAlarmStatus.alarm_Flag_noRinseback - endVisible : ! vAlarmStatus.alarm_Flag_noEndTreatment - - onMuteClicked : vAlarmStatus.doSilence () - onResumeClicked : vAlarmStatus.doUserActionResume () - onRinsebackClicked : vAlarmStatus.doUserActionRinseback() - onEndClicked : vAlarmStatus.doUserActionEnd () - onOkClicked : vAlarmStatus.doUserActionOk () - onMinimizeClicked : { - alarmMinimize() - // when user minimizes the alarm it can stay minimized until otherwize is set - // by the next alarm status received. - // see also the "Connections { target: vAlarmStatus" implementation - vAlarmStatus.alarm_KeepMinimized = true - // DEBUG: vAlarmStatus.doClearCondition() - } - } - - AlarmListDialog { id : _alarmListDialog - isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced - timeout : vAlarmStatus.alarm_MuteTimeout - onMuteClicked : vAlarmStatus.doSilence() - onMinimizeClicked : alarmMinimize() - } - // 9 - Others Text { // TEST : Application version should be moved into the information screen later. color : Colors.textMain @@ -283,62 +184,18 @@ anchors.fill: parent source: "qrc:/images/iMicroSD" } - visible: true // ! _GuiView.sdIsReady || _GuiView.sdIsReadOnly + visible: true } - Connections { target: vPowerOff - onPoweroffTriggered: { - switch (vpoweroff) { - case GuiActions.Command: - _powerOffDialog.open() - break; - - case GuiActions.Timeout: - _powerOffDialog.close() - break; - - case GuiActions.Rejected: - _autoHideInfo.showDialog( - qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() - 2000 // notifies user and hides the dialog - ) - break; - } - } + AlarmItem { id: _alarmItem } + // NotificationBar has to be anchored to the main menu and if it is moved into the AlarmItem + // then cannot be anchored. + NotificationBar { id: _alarmBar + anchors.bottom : _mainMenu.top + backgroundColor : _alarmItem.backgroundColor + textColor : _alarmItem.textColor + text : _alarmItem.text + isSilenced : _alarmItem.isSilenced + timeout : _alarmItem.timeout } - - Connections { target: vAlarmStatus - onAlarm_Flag_noResumeChanged : vAlarmStatus.alarm_KeepMinimized = false - onAlarm_Flag_noRinsebackChanged : vAlarmStatus.alarm_KeepMinimized = false - onAlarm_Flag_noEndTreatmentChanged : vAlarmStatus.alarm_KeepMinimized = false - onAlarm_Flag_UserMustAckChanged : vAlarmStatus.alarm_KeepMinimized = false - onAlarm_AlarmIDChanged : vAlarmStatus.alarm_KeepMinimized = false - onAlarm_Flag_alarmsSilencedChanged : vAlarmStatus.alarm_KeepMinimized = vAlarmStatus.alarm_Flag_alarmsSilenced - onAlarm_PriorityChanged: { - [ - _alarmDialog.titleBarBackground, - _alarmDialog.titleBarForeground, - _alarmDialog.backgroundColor , - _alarmDialog.textColor , - ] = Colors.alarmPriorityColors(vAlarmStatus.alarm_Priority) - } - - onDidAlarmRaise: { - let silenceMinimize = false - if (vAlarmStatus.alarm_Flag_alarmsSilenced && silenceMinimize) { - // this is the response to the silence request - // so the dialog should be closed when the request accepted - // if not then if can stay minimized nothing happens - // if can't stay minimized then it has to be shown - alarmMinimize() - } - else { - if (! vAlarmStatus.alarm_KeepMinimized) { - alarmMaximize() - } - } - } - - onDidAlarmEmpty: alarmHide() - } }