Index: sources/gui/qml/main.qml =================================================================== diff -u -r8f71000a841da5e8f18efccbb30a7655d3a211cd -rcbea4224ad67eecc2e7c4c66df9a7db711c72832 --- sources/gui/qml/main.qml (.../main.qml) (revision 8f71000a841da5e8f18efccbb30a7655d3a211cd) +++ sources/gui/qml/main.qml (.../main.qml) (revision cbea4224ad67eecc2e7c4c66df9a7db711c72832) @@ -71,10 +71,29 @@ // TODO : When Testing data on Setting screen is removed // This needs to be moved into the Treatment______.qml + VAlarmStatus { id: vAlarmStatus + onRaiseAlarm: { + updateAlarm(); + _alarm_dialog.isSilenced = vAlarmStatus.alarm_Flag_alarmsSilenced + _alarm_bar.toggleSilence(vAlarmStatus.alarm_Flag_alarmsSilenced, + vAlarmStatus.alarm_MuteTimeout); - VAlarmStatus { id: vAlarmStatus } - VPowerOff { id: vPowerOff } + 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 } @@ -124,12 +143,56 @@ } } - NotificationBar { id: _alarm + NotificationBar { id: _alarm_bar + 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 + 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 @@ -146,6 +209,55 @@ 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) {