Index: sources/gui/qml/main.qml =================================================================== diff -u -r95c671ab7037af055db551456a719ff67bf10262 -reedecdb4324b51307e4cf94f782d05591d6ceba9 --- sources/gui/qml/main.qml (.../main.qml) (revision 95c671ab7037af055db551456a719ff67bf10262) +++ sources/gui/qml/main.qml (.../main.qml) (revision eedecdb4324b51307e4cf94f782d05591d6ceba9) @@ -12,45 +12,6 @@ * */ -/* --Item - Circle - LogoD - MainMenu - PlaceHolderText - ProgressCircle - ScreenItem - StackItem - TextRect - TimeText - TouchArea - RangeMarker - --Text - TitleText - --Rectangle - Line - Background - CloseButton - TouchRect - BackButton - ConfirmButton - ExportButton - USBButton - RangeRect - ProgressBar - ProgressBarEx - ProgressRect - Slider - RangeBar - --Dialog - ModalDialog - AutoHideInfo - PowwerOff -*/ - // Qt import QtQuick 2.12 @@ -61,14 +22,23 @@ // TODO : When Testing data on Setting screen is removed // This needs to be moved into the TreatmentFlows.qml -import VTreatmentAdjustmentsResponse 0.1; -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 VTreatmentAdjustmentDuration 0.1; +import VTreatmentAdjustmentFlows 0.1; +import VTreatmentAdjustmentUltrafiltrationState 0.1; +import VTreatmentAdjustmentUltrafiltrationEdit 0.1; +import VTreatmentAdjustmentUltrafiltrationConfirm 0.1; + +import VLoadCellReadings 0.1; +import VTemperatureSensors 0.1; + // Qml imports import "qrc:/globals" import "qrc:/pages" @@ -87,55 +57,64 @@ GuiView { id: _GuiView onDidActionReceive: { - //console.debug(vData) + //console.debug(vAction, vData) switch(vAction) { case GuiActions.PowerOffBroadcast: _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 - VTreatmentAdjustmentsResponse { id: vTreatmentAdjustmentsResponse } - VTreatmentBloodFlow { id: vTreatmentBloodFlow } - VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } - VTreatmentUltrafiltration { id: vTreatmentUltrafiltration } - VTreatmentTime { id: vTreatmentTime } - VAlarmStatus { id: vAlarmStatus } - VPowerOff { id: vPowerOff - onPoweroffTriggered: { - switch (vpoweroff) { - case GuiActions.Command: - _powerOffDialog.open() - break; + VAlarmStatus { id: vAlarmStatus + onRaiseAlarm: { + updateAlarm(); + _alarm_dialog.isSilenced = vAlarmStatus.alarm_Flag_alarmsSilenced + _alarm_bar.toggleSilence(vAlarmStatus.alarm_Flag_alarmsSilenced, + vAlarmStatus.alarm_MuteTimeout); - 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; - + if (isAlarmHighPriority()) { + _alarm_dialog.visible = true; + _alarm_bar.visible = false; + } else { + if (!_alarm_dialog.visible) { + _alarm_bar.visible = true; + } } + } + + onHideAlarm: { + _alarm_bar.visible = false; + _alarm_dialog.visible = false; } } + VPowerOff { id: vPowerOff } + VTreatmentBloodFlow { id: vTreatmentBloodFlow } + VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } + VTreatmentPressureOcclusion { id: vTreatmentPressureOcclusion } + VTreatmentUltrafiltration { id: vTreatmentUltrafiltration } + VTreatmentTime { id: vTreatmentTime } + VLoadCellReadings { id: vLoadCellReadings } + VTemperatureSensors { id: vTemperatureSensors } + + VTreatmentAdjustmentDuration { id: vTreatmentAdjustmentDuration } + VTreatmentAdjustmentFlows { id: vTreatmentAdjustmentFlows } + VTreatmentAdjustmentUltrafiltrationState { id: vTreatmentAdjustmentUltrafiltrationState } + VTreatmentAdjustmentUltrafiltrationEdit { id: vTreatmentAdjustmentUltrafiltrationEdit } + VTreatmentAdjustmentUltrafiltrationConfirm { id: vTreatmentAdjustmentUltrafiltrationConfirm } + // ----- 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 } @@ -146,9 +125,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; } } @@ -164,13 +143,57 @@ } } + NotificationBar { id: _alarm_bar - NotificationBar { id: _alarm anchors.bottom: _mainMenu.top level : vAlarmStatus.alarm_Priority - text : vAlarmStatus.text + text : vAlarmStatus.text; + isSilenced: vAlarmStatus.alarm_Flag_alarmsSilenced; + + onClickedNotificationBar: { + updateAlarm(); + _alarm_bar.setFlashing(false); + _alarm_bar.visible = false; + _alarm_dialog.visible = true; + } + + } + function isAlarmHighPriority() { + return vAlarmStatus.alarm_Priority === GuiActions.ALARM_PRIORITY_HIGH; + } + + function updateAlarm() { + _alarm_dialog.titleText = "Alarm"; + _alarm_dialog.description = vAlarmStatus.text; + _alarm_dialog.alarmID = vAlarmStatus.alarm_AlarmID; + [_alarm_dialog.backgroundColor, _alarm_dialog.textColor] = getRootTextFromAlarmLevel(vAlarmStatus.alarm_Priority); + [_alarm_dialog.titleBarBackground, _alarm_dialog.titleBarForeground] = getAlarmTopBarColors(vAlarmStatus.alarm_Priority); + _alarm_bar.backgroundColor = _alarm_dialog.titleBarBackground; + } + + NotificationDialog { id: _alarm_dialog + alarmID: -1 + onClosed: { + _alarm_bar.visible = true; + } + onClickedOkay: { + _alarm_dialog.visible = false; + vAlarmStatus.requestOkay(alarmID) + if (isAlarmHighPriority()) { + _alarm_bar.setFlashing(true); + return; + } + _alarm_bar.setFlashing(false); + } + + onClickedSilence: { + _alarm_dialog.visible = false; + vAlarmStatus.requestSilence(); + } + } + // 9 - Others Text { // TEST : Application version should be moved into the information screen later. color: Colors.textMain @@ -186,4 +209,75 @@ text: Qt.application.version font.pixelSize: 14 } + + function getRootTextFromAlarmLevel(level) { + let root_color = ""; + let text_color = ""; + switch (level) { + case GuiActions.ALARM_PRIORITY_HIGH: + root_color = Colors.textNotificationHighBg; + text_color = Colors.textNotificationHighFg; + break; + case GuiActions.ALARM_PRIORITY_MEDIUM: + root_color = Colors.textNotificationMedBg; + text_color = Colors.textNotificationMedFg; + break; + case GuiActions.ALARM_PRIORITY_LOW: + root_color = Colors.textNotificationLowBg; + text_color = Colors.textNotificationLowFg; + break; + default : // GuiActions.ALARM_PRIORITY_NONE + root_color = Colors.textNotificationNoneBg; + text_color = Colors.textNotificationNoneFg; + + } + return [root_color, text_color]; + + } + + function getAlarmTopBarColors(level) { + let background = ""; + let foreground = ""; + switch (level) { + case GuiActions.ALARM_PRIORITY_HIGH: + background = Colors.alarmTopBarHighBg; + foreground = Colors.alarmTopBarHighFg; + break; + case GuiActions.ALARM_PRIORITY_MEDIUM: + background = Colors.alarmTopBarMedBg; + foreground = Colors.alarmTopBarMedFg; + break; + case GuiActions.ALARM_PRIORITY_LOW: + background = Colors.alarmTopBarLowBg; + foreground = Colors.alarmTopBarLowFg; + break; + default : // GuiActions.ALARM_PRIORITY_NONE + background = Colors.alarmTopBarLowBg; + foreground = Colors.alarmTopBarLowFg; + + } + return [background, foreground]; + } + + 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; + + } + } + } }