Index: sources/gui/qml/main.qml =================================================================== diff -u -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a -r7ffe641e90fd076e4358d56ef9aa400e9a9c1f75 --- sources/gui/qml/main.qml (.../main.qml) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) +++ sources/gui/qml/main.qml (.../main.qml) (revision 7ffe641e90fd076e4358d56ef9aa400e9a9c1f75) @@ -1,35 +1,54 @@ /*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. - * \copyright \n - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n - * IN PART OR IN WHOLE, \n - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * \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 main.qml - * \date 2019/09/30 - * \author Behrouz NematiPour + * \file main.qml + * \author (last) Peter Lucia + * \date (last) 15-Oct-2020 + * \author (original) Behrouz NematiPour + * \date (original) 24-Sep-2019 * */ // Qt import QtQuick 2.12 -import QtQuick.Controls 2.12 // Project // C++ imports -import Gui.View 0.1; -import Gui.Actions 0.1; +import Gui.View 0.1 +import Gui.Actions 0.1 // TODO : When Testing data on Setting screen is removed // This needs to be moved into the TreatmentFlows.qml -import VTreatmentBloodFlow 0.1; -import VTreatmentDialysateFlow 0.1; -import VTreatmentUltrafiltration 0.1; -import VTreatmentTime 0.1; -import VAlarmStatus 0.1; -import VPowerOff 0.1; +import VTreatmentBloodFlow 0.1 +import VTreatmentDialysateFlow 0.1 +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 VTreatmentAdjustmentDuration 0.1 +import VTreatmentAdjustmentFlows 0.1 + +import VTreatmentCreate 0.1 +import VDGDrainPump 0.1 +import VDGHeaters 0.1 +import VDGLoadCellReadings 0.1 +import VDGOperationMode 0.1 +import VDGPressures 0.1 +import VDGROPump 0.1 +import VDGReservoir 0.1 +import VDGTemperatures 0.1 +import VDGValvesStates 0.1 +import VPriming 0.1 +import VTreatmentBegin 0.1 +import VTreatmentEnd 0.1 + // Qml imports import "qrc:/globals" import "qrc:/pages" @@ -48,55 +67,52 @@ GuiView { id: _GuiView onDidActionReceive: { - //console.debug(vData) + //console.debug(vAction, vData) switch(vAction) { - case GuiActions.PowerOffBroadcast: + case GuiActions.ID_ShuttingDown: _autoHideInfo.showDialog( qsTr("System is shutting down"), - 5000 // if there is any error happening then after 5 seconds dialog hides. + 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 TreatmentFlows.qml - VTreatmentBloodFlow { id: vTreatmentBloodFlow } - VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } - VTreatmentUltrafiltration { id: vTreatmentUltrafiltration } - VTreatmentTime { id: vTreatmentTime } - VAlarmStatus { id: vAlarmStatus } - VPowerOff { id: vPowerOff - onPoweroff_statusChanged: { - console.debug("vpoweroff_status", vpoweroff_status) - switch (vpoweroff_status) { - case GuiActions.Command: - _powerOffDialog.open() - break; + // This needs to be moved into the Treatment______.qml + VAlarmStatus { id: vAlarmStatus } + VPowerOff { id: vPowerOff } + VHDOperationMode { id: vHDOperationMode } + VTreatmentBloodFlow { id: vTreatmentBloodFlow } + VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } + VTreatmentPressureOcclusion { id: vTreatmentPressureOcclusion } + VTreatmentUltrafiltration { id: vTreatmentUltrafiltration } + VTreatmentTime { id: vTreatmentTime } - case GuiActions.Timeout: - _powerOffDialog.close() - break; + VDGDrainPump { id: vDGDrainPump } + VDGHeaters { id: vDGHeaters } + VDGLoadCellReadings { id: vDGLoadCellReadings } + VDGOperationMode { id: vDGOperationMode } + VDGPressures { id: vDGPressures } + VDGROPump { id: vDGROPump } + VDGReservoir { id: vDGReservoir } + VDGTemperatures { id: vDGTemperatures } + VDGValvesStates { id: vDGValvesStates } - case GuiActions.Rejected: - _autoHideInfo.showDialog( - qsTr("Cannot shutdown during 'Treatment'"), // '%1').arg() - 1000 // if there is any error happening then after 5 seconds dialog hides. - ) - break; + VTreatmentAdjustmentDuration { id: vTreatmentAdjustmentDuration } + VTreatmentAdjustmentFlows { id: vTreatmentAdjustmentFlows } + VTreatmentCreate { id: vTreatmentCreate } + VPriming { id: vPriming } + VTreatmentBegin { id: vTreatmentBegin } + VTreatmentEnd { id: vTreatmentEnd } - } - } - } - // ----- Follow the below Z order ----- // 1 - Screens // 1 - 1 SettingsStack { id: _settingsStack } // 1 - 2 - ManagerStack { id: _mansagerStack } + ManagerStack { id: _managerStack } // 1 - 3 TreatmentStack { id: _treatmentStack } @@ -107,9 +123,9 @@ _treatmentStack.visible = true } onItemPressed: { - _treatmentStack .visible = vIndex == 0; - _mansagerStack .visible = vIndex == 1; - _settingsStack .visible = vIndex == 2; + _treatmentStack.visible = vIndex == 0; + _managerStack .visible = vIndex == 1; + _settingsStack .visible = vIndex == 2; } } @@ -118,26 +134,176 @@ PowerOff { id: _powerOffDialog onAccepted: { - _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.Accepted) + _GuiView.doActionTransmit(GuiActions.ID_PowerOff, GuiActions.Accepted) } onRejected: { - _GuiView.doActionTransmit(GuiActions.PowerOff, GuiActions.Rejected) + _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 - x: 1172 - y: 767 - width: 104 - height: 27 - text: Qt.application.version - horizontalAlignment: Text.AlignRight - anchors.bottom: parent.bottom - anchors.bottomMargin: 6 - anchors.right: parent.right - anchors.rightMargin: 4 + color : Colors.textMain + anchors { + top : parent.top + left : parent.left + leftMargin : 10 + } + horizontalAlignment : Text.AlignRight + verticalAlignment : Text.AlignBottom + + height : 15 + text : Qt.application.version font.pixelSize: 14 } + + Rectangle { // TEST : SD-Card not present should be handled with better indication(s). + color : ! _GuiView.sdIsReady ? "red" : _GuiView.sdIsReadOnly ? "gray" : "green" + anchors { + top : parent.top + right : parent.right + topMargin : 5 + rightMargin : 5 + } + width : 25 + height: 25 + radius: width + Image { id: _imageMicrosd + anchors.fill: parent + source: "qrc:/images/iMicroSD" + } + visible: true // ! _GuiView.sdIsReady || _GuiView.sdIsReadOnly + } + + 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; + } + } + } + + 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() + } }