Index: leahi.qrc =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -r18567640c36d4bd3d2fa37ac929987cec7476309 --- leahi.qrc (.../leahi.qrc) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ leahi.qrc (.../leahi.qrc) (revision 18567640c36d4bd3d2fa37ac929987cec7476309) @@ -39,6 +39,7 @@ sources/gui/qml/dialogs/AcidConcentrateAdjustment.qml sources/gui/qml/dialogs/EndTreatmentDialog.qml sources/gui/qml/dialogs/RinsebackCompleteDialog.qml + sources/gui/qml/dialogs/AlarmDialog.qml sources/gui/qml/dialogs/diagnostics/DiagnosticsDialog.qml Index: sources/gui/qml/AlarmItem.qml =================================================================== diff -u -r0f83de066c8a116195a3cc60577d597ef9654c55 -r18567640c36d4bd3d2fa37ac929987cec7476309 --- sources/gui/qml/AlarmItem.qml (.../AlarmItem.qml) (revision 0f83de066c8a116195a3cc60577d597ef9654c55) +++ sources/gui/qml/AlarmItem.qml (.../AlarmItem.qml) (revision 18567640c36d4bd3d2fa37ac929987cec7476309) @@ -39,8 +39,8 @@ VAlarmStatus { id: vAlarmStatus } VAlarmActiveList { id: vAlarmActiveList } - readonly property alias backgroundColor: _alarmDialog.titleBarBackground - readonly property alias textColor : _alarmDialog.textColor + readonly property alias backgroundColor: _notificationDialog.titleBarBackground + readonly property alias textColor : _notificationDialog.textColor readonly property string title : vAlarmStatus.title readonly property alias isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced readonly property alias timeout : vAlarmStatus.alarm_MuteTimeout @@ -53,9 +53,7 @@ // Look at the PowerItem as an example. if ( ! vAlarmStatus.hasAlarm ) return - - _alarmDialog .visible = false - _alarmListDialog.visible = false + _notificationDialog.close() _alarmBar .visible = true } function alarmMaximize() { @@ -74,21 +72,18 @@ if ( _root._DEBUG_DISABLE_MAXIMIZE_ ) { alarmMinimize() } else { - _alarmDialog .visible = true - _alarmListDialog.visible = false + _notificationDialog.alarmMaximize() _alarmBar .visible = false } _powerItem.cancel() } function alarmList() { vAlarmActiveList.doRequest() - _alarmDialog .visible = false - _alarmListDialog.visible = true + _notificationDialog.alarmList() _alarmBar .visible = false } function alarmHide() { - _alarmDialog .visible = false - _alarmListDialog.visible = false + _notificationDialog.close() _alarmBar .visible = false } @@ -103,62 +98,15 @@ function onDidAlarmEmpty ( ) { alarmHide () } } - // TODO : Later need to create a base Notification dialog class - // and inherit NotificationDialog and AlarmListDialog from that - // Better be the NotificationDialog defined as parent - // and create two separate dialogs by the names of AlarmDialog , AlarmListDlialog. - // Same for the NotificationBar - NotificationDialog { id : _alarmDialog - // this will change later to the actual message text - // and the instruction would be in the dialog content + NotificationDialog { id : _notificationDialog } - titleText : vAlarmStatus.title - titlePixelSize : Fonts.fontPixelAlarmTitle - instructionModel : vAlarmStatus.instructions - 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 - temporaryBreakVisible : ! vAlarmStatus.alarm_Flag_noTemporaryBreak - minVisible : ! vAlarmStatus.alarm_Flag_noMinimize - countDown : vTreatmentStop.countDown - countDownVisible : vTDOpMode.inTreatment - && ( - vTDTreatmentStates.txStop - || vTDTreatmentStates.txRinseback - || vTDTreatmentStates.txEnd - ) - && vTreatmentStop.total - - onMuteClicked : vAlarmStatus.doSilence () - onResumeClicked : vAlarmStatus.doUserActionResume () - onRinsebackClicked : vAlarmStatus.doUserActionRinseback () - onEndClicked : vAlarmStatus.doUserActionEnd () - onTemporaryBreakClicked : vAlarmStatus.doUserActionTemporaryBreak () - onOkClicked : vAlarmStatus.doUserActionOk () - onListClicked : alarmList () - onMinimizeClicked : alarmMinimize () - } - - AlarmListDialog { id : _alarmListDialog - isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced - timeout : vAlarmStatus.alarm_MuteTimeout - minVisible : ! vAlarmStatus.alarm_Flag_noMinimize - onMuteClicked : vAlarmStatus.doSilence() - onMinimizeClicked : alarmMinimize() - onListClicked : alarmMaximize() - } - Connections { target: vAlarmStatus function onAlarm_PriorityChanged ( vValue ) { [ - _alarmDialog.titleBarBackground, - _alarmDialog.titleBarForeground, - _alarmDialog.backgroundColor , - _alarmDialog.textColor , + _notificationDialog.titleBarBackground, + _notificationDialog.titleBarForeground, + _notificationDialog.backgroundColor , + _notificationDialog.textColor , ] = Colors.alarmPriorityColors(vValue) } } Index: sources/gui/qml/dialogs/AlarmDialog.qml =================================================================== diff -u --- sources/gui/qml/dialogs/AlarmDialog.qml (revision 0) +++ sources/gui/qml/dialogs/AlarmDialog.qml (revision 18567640c36d4bd3d2fa37ac929987cec7476309) @@ -0,0 +1,356 @@ +// Qt +import QtQuick 2.12 +import QtGraphicalEffects 1.12 + +// Project +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +Item { id : _root + + property alias titleText : _title.text + property alias titlePixelSize : _title.font.pixelSize + property alias instructionModel : _listView.model + property alias titleBarForeground : _title.color + property alias titleBarBackground : _titleBar.color + property alias isSilenced : _headerButtonGroup.isSilenced + property alias timeout : _headerButtonGroup.timeout + property int alarmID : -1 + + property alias countDown : _timerRect.countDown + property alias countDownVisible : _timerRect.visible + property alias figureImageSource : _figureImage.source + + property bool resumeVisible : false + property bool rinsebackVisible : false + property bool temporaryBreakVisible: false + property bool endVisible : false + property bool okVisible : false + property bool minVisible : true + + property int headerOverlap : 30 + + anchors.fill: parent + + signal muteClicked() + signal minimizeClicked() + signal listClicked() + + signal resumeClicked() + signal temporaryBreakClicked() + signal rinsebackClicked() + signal endClicked() + signal okClicked() + + Rectangle { id: _titleBar + anchors.top: parent.top + height : Variables.alarmDialogHeaderHeight + _root.headerOverlap + width : _root.width + radius : Variables.alarmDialogRadius + clip : true // the mute button expands so we need to clip the outside unwanted area. + + // TODO: disable doubleClicked later. this is only for diagnostic purpose when alarm dialog covers the entire screen. + MouseArea { id: _minimizeArea + anchors.fill : parent + onDoubleClicked : { if ( ! _root.minVisible ) _diagnosticsDialog.open() } + } + + Text { id: _title + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTitle + text : qsTr("Notification") + font.weight : Font.DemiBold + width : _titleBar.width + + anchors { + left: parent.left + leftMargin: Variables.defaultMargin * 2 + verticalCenter: parent.verticalCenter + verticalCenterOffset: (_root.headerOverlap / 2) * -1 + } + } + + AlarmButtonRow { id: _headerButtonGroup + anchors { + verticalCenter : _titleBar.verticalCenter + verticalCenterOffset: (_root.headerOverlap / 2) * -1 + right : _titleBar.right + rightMargin : Variables.defaultMargin * 2 + } + + isMinButton : true + backgroundColor : _titleBar.color + minMaxVisible : _root.minVisible + + onMuteClicked : _root.muteClicked() + onMinMaxClicked : _root.minimizeClicked() + onListClicked : _root.listClicked() + } + } + + Rectangle { id: _descriptionRect + color : Colors.offWhite + clip : true + + anchors { + top : _titleBar.bottom + topMargin : _root.headerOverlap * -1 + left : parent.left + right : parent.right + bottom : _timerRect.top + } + + HelpNotification { id: _infoItem + anchors { + left : parent.left + leftMargin : Variables.defaultMargin * 4 + top : parent.top + topMargin : Variables.defaultMargin * 3 + } + } + + ListView {id: _listView + anchors { + top : _infoItem.bottom + topMargin : Variables.defaultMargin + bottom : parent.bottom + left : parent.left + leftMargin : Variables.defaultMargin * 4 + } + + height : _descriptionRect.height + width : _descriptionRect.width / 2 + currentIndex: 0 + interactive : false + clip : true + + delegate: Item { id: _delegateControl + width : _listView.width + height : Variables.instructionHeight + clip : true + + Rectangle { id: _stepRect + height : 40 + width : height + radius : height + color : _delegateControl.ListView.isCurrentItem ? Colors.backgroundMainMenu : Colors.offWhite + border { + color: Colors.backgroundMainMenu + width: 2 + } + + Text { id: _stepNumberRect + anchors.centerIn: parent + text : index + 1 + color : _delegateControl.ListView.isCurrentItem ? Colors.offWhite : Colors.backgroundMainMenu + font.pixelSize : 20 + font.weight : Font.Medium + } + + layer.enabled : true + layer.effect : DropShadow { id: _dropShadow + horizontalOffset: 0 + verticalOffset : 3 + radius : 3.0 + samples : 7 + color : "#50000000" + source : _stepRect + anchors.fill : _stepRect + } + } + + Text { id: _delegateText + anchors { + left : _stepRect.right + leftMargin : Variables.defaultMargin + right : _delegateControl.right + } + height : parent.height + width : parent.width + font.pixelSize : Fonts.fontPixelInstructionStep + font.weight : _delegateControl.ListView.isCurrentItem ? Font.DemiBold : Font.Normal + color : _delegateControl.ListView.isCurrentItem ? "#18559E" : Colors.alarmDialogText + text : model.instruction + wrapMode : Text.WordWrap + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (_listView.currentIndex !== index) { + _listView.currentIndex = index + _root.figureImageSource = model.image + } + } + } + } + } + + Image { id: _figureImage + anchors.right : parent.right + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { id: _timerRect + property int countDown : 0 + + height: 70 + width: parent.width / 3 + + anchors { + bottom : _alarmID.top + bottomMargin : Variables.defaultMargin * 2 + left : parent.left + leftMargin : Variables.defaultMargin * 4 + } + + color : "#FFECEC" + radius : 10 + + Text { id: _astrix + anchors { + left: parent.left + leftMargin: Variables.defaultMargin + top: _timerDescription.top + } + + color : "#AB352E" + text : "*" + font.pixelSize : 25 + font.weight : Font.Medium + } + + Text { id: _timerDescription + anchors { + verticalCenter: parent.verticalCenter + left: _astrix.right + } + + color : "black" + text : qsTr("Rinseback will not be allowed in:") + font.pixelSize : 25 + font.weight : Font.Medium + + } + + TimeText { id: _timeoutText + seconds : countDown * 60 + anchors { + verticalCenter : parent.verticalCenter + left: _timerDescription.right + } + height: _titleBar.height + textPixelSize : 35 + textWeight : Font.Bold + secondsVisible : false + hourZero : false + minuteZero : true + textColor : "#AB352E" + } + } + + Row { id: _buttonGroup + property int buttonsWidth : 350 + spacing: 50 + + anchors { + bottom : parent.bottom + horizontalCenter: parent.horizontalCenter + rightMargin : spacing + leftMargin : spacing + bottomMargin : Variables.defaultMargin * 4 + } + + // IMPORTANT NOTE : Alarm Dialog buttons + // It has been granteed by FW that there should never be more than 3 buttons on the ScreenItem + // Regarding the discussion there should be only 3 situations: + // 1 - Different combination of the Resume,Rinseback,End + // 2 - OK button for user to only ack the alarm + // 3 - No button at all for the situations that the alarm cannot be resolved by user. + // :: OK button and the other 3 buttons (Resume,Rinseback,End) should never come together + TouchRect { id : _resumeTouchRect + visible : resumeVisible + onPressed : resumeClicked() + text.text : qsTr("Resume") + width : _buttonGroup.buttonsWidth + isDefault : true + backgroundColor: Colors.white + fgColor : isPressed ? Colors.white : borderColor + selectColor : Qt.darker(borderColor, 1.15) + pixelSize : Fonts.fontPixelNotification + borderColor : Colors.alarmButton + } + + TouchRect { id : _temporaryBreak + visible : temporaryBreakVisible + onPressed : temporaryBreakClicked() + text.text : qsTr("Temporary Break") + width : _buttonGroup.buttonsWidth + backgroundColor: Colors.white + fgColor : isPressed ? Colors.white : borderColor + selectColor : Qt.darker(borderColor, 1.15) + pixelSize : Fonts.fontPixelNotification + borderColor : Colors.alarmButton + } + + TouchRect { id : _rinsebackTouchRect + visible : rinsebackVisible + onPressed : rinsebackClicked() + text.text : qsTr("Return Blood & End Treatment") + width : _buttonGroup.buttonsWidth + backgroundColor: Colors.white + fgColor : isPressed ? Colors.white : borderColor + selectColor : Qt.darker(borderColor, 1.15) + pixelSize : Fonts.fontPixelNotification + borderColor : Colors.alarmButton + } + + TouchRect { id : _endTouchRect + visible : endVisible + onPressed : endClicked() + text.text : qsTr("End Treatment Only") + width : _buttonGroup.buttonsWidth + backgroundColor: Colors.white + fgColor : isPressed ? Colors.white : borderColor + selectColor : Qt.darker(borderColor, 1.15) + pixelSize : Fonts.fontPixelNotification + borderColor : Colors.alarmButton + } + + TouchRect { id : _okTouchRect + visible : okVisible + onPressed : okClicked() + text.text : qsTr("OK") + width : _buttonGroup.buttonsWidth + backgroundColor: Colors.white + fgColor : isPressed ? Colors.white : borderColor + selectColor : Qt.darker(borderColor, 1.15) + pixelSize : Fonts.fontPixelNotification + borderColor : Colors.alarmButton + } + } + + Text { id: _alarmID + text : ("[%1:%2]") .arg(qsTr("ID")) + .arg(_root.alarmID) + anchors { + left : parent.left + bottom : parent.bottom + leftMargin : Variables.defaultMargin * 3 + bottomMargin: Variables.defaultMargin + } + color : Colors.alarmDialogGreyText + font.pixelSize : Fonts.fontPixelAlarmID + } + + Connections { target: vAlarmStatus + function onDidAlarmRaise ( ) { + // image is out of sync when a new alarm is appears so on new alarm go to step 1 image + if ( _root.instructionModel.rowCount() > 0) { + figureImageSource = _root.instructionModel.get(0).image + } + } + } +} Index: sources/gui/qml/dialogs/AlarmListDialog.qml =================================================================== diff -u -r16a8f25568b4636ebc31e76c86a8031940cc4ad7 -r18567640c36d4bd3d2fa37ac929987cec7476309 --- sources/gui/qml/dialogs/AlarmListDialog.qml (.../AlarmListDialog.qml) (revision 16a8f25568b4636ebc31e76c86a8031940cc4ad7) +++ sources/gui/qml/dialogs/AlarmListDialog.qml (.../AlarmListDialog.qml) (revision 18567640c36d4bd3d2fa37ac929987cec7476309) @@ -25,8 +25,7 @@ /*! * \brief Contains the Alarm Dialog Implementation */ -ModalDialog { id : _root - contentItem.objectName: "_NotificationDialog" // SquishQt +Item { id : _root property alias titleText : _title.text; property alias titleBarForeground : _title.color @@ -39,8 +38,7 @@ property color contentbackgroundColor : Colors.offWhite property int headerOverlap : 30 - backgroundColor : contentbackgroundColor - radius : Variables.alarmDialogRadius + anchors.fill: parent signal muteClicked() signal minimizeClicked() @@ -51,7 +49,7 @@ color : Colors.backgroundButtonSelect height : Variables.alarmDialogHeaderHeight + _root.headerOverlap width : _root.width - radius : _root.radius + radius : Variables.alarmDialogRadius clip : true Image { @@ -125,13 +123,7 @@ } TouchGrid { id: _alarmGrid - anchors { - top : _content.top - topMargin : Variables.minVGap - bottom : _root.bottom - bottomMargin : Variables.mainMenuHeight + Variables.minVGap - horizontalCenter: parent.horizontalCenter - } + anchors.fill : parent visible : vAlarmActiveList.adjustment_Accepted alignCenter : false @@ -140,7 +132,7 @@ colCount : 1 rowCount : vAlarmActiveList.alarmIDs.length itemHeight : 75 - itemWidth : _content.width - Variables.minVGap * (2 + 1) // * 2 : for each side & the +1 to not cover the scrollbar + itemWidth : _content.width rowSpacing : 0 colSpacing : 0 lineColor : Colors.alarmDialogText Index: sources/gui/qml/dialogs/NotificationDialog.qml =================================================================== diff -u -r2f524fd1b0badc222cd772417234770e5488cf56 -r18567640c36d4bd3d2fa37ac929987cec7476309 --- sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision 2f524fd1b0badc222cd772417234770e5488cf56) +++ sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision 18567640c36d4bd3d2fa37ac929987cec7476309) @@ -28,351 +28,69 @@ ModalDialog { id : _root contentItem.objectName: "_NotificationDialog" // SquishQt - property alias titleText : _title.text - property alias titlePixelSize : _title.font.pixelSize - property alias instructionModel : _listView.model - property alias titleBarForeground : _title.color - property alias titleBarBackground : _titleBar.color - property alias isSilenced : _headerButtonGroup.isSilenced - property alias timeout : _headerButtonGroup.timeout - property int alarmID : -1 + property alias titleBarBackground : _alarmDialog.titleBarBackground + property alias titleBarForeground : _alarmDialog.titleBarForeground + property int currentScreen : NotificationDialog.AlarmMain - property alias countDown : _timerRect.countDown - property alias countDownVisible : _timerRect.visible - property alias figureImageSource : _figureImage.source - - property bool resumeVisible : false - property bool rinsebackVisible : false - property bool temporaryBreakVisible: false - property bool endVisible : false - property bool okVisible : false - property bool minVisible : true - - property int headerOverlap : 30 - - // Look for this tag: #First_Time_Message_Sent_With_Silenced - // the isSilenced is helping not to show this dialog maximized and - // then if the silence is set minimize it immediately - // this behaviour does not look nice on the screen and it bounces radius : Variables.alarmDialogRadius - signal muteClicked() - signal minimizeClicked() - signal listClicked() - - signal resumeClicked() - signal temporaryBreakClicked() - signal rinsebackClicked() - signal endClicked() - signal okClicked() - - Rectangle { id: _titleBar - height : Variables.alarmDialogHeaderHeight + _root.headerOverlap - width : _root.width - radius : _root.radius - clip : true // the mute button expands so we need to clip the outside unwanted area. - - // TODO: disable doubleClicked later. this is only for diagnostic purpose when alarm dialog covers the entire screen. - MouseArea { id: _minimizeArea - anchors.fill : parent - onDoubleClicked : { if ( ! _root.minVisible ) _diagnosticsDialog.open() } - } - - Text { id: _title - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTitle - text : qsTr("Notification") - font.weight : Font.DemiBold - width : _titleBar.width - - anchors { - left: parent.left - leftMargin: Variables.defaultMargin * 2 - verticalCenter: parent.verticalCenter - verticalCenterOffset: (_root.headerOverlap / 2) * -1 - } - } - - AlarmButtonRow { id: _headerButtonGroup - anchors { - verticalCenter : _titleBar.verticalCenter - verticalCenterOffset: (_root.headerOverlap / 2) * -1 - right : _titleBar.right - rightMargin : Variables.defaultMargin * 2 - } - - isMinButton : true - backgroundColor : _titleBar.color - minMaxVisible : _root.minVisible - - onMuteClicked : _root.muteClicked() - onMinMaxClicked : _root.minimizeClicked() - onListClicked : _root.listClicked() - } + enum AlarmPage { + AlarmMain , + AlarmList } - Rectangle { id: _descriptionRect - color : Colors.offWhite - clip : true - - anchors { - top : _titleBar.bottom - topMargin : _root.headerOverlap * -1 - left : parent.left - right : parent.right - bottom : _timerRect.top - } - - HelpNotification { id: _infoItem - anchors { - left : parent.left - leftMargin : Variables.defaultMargin * 4 - top : parent.top - topMargin : Variables.defaultMargin * 3 - } - } - - ListView {id: _listView - anchors { - top : _infoItem.bottom - topMargin : Variables.defaultMargin - bottom : parent.bottom - left : parent.left - leftMargin : Variables.defaultMargin * 4 - } - - height : _descriptionRect.height - width : _descriptionRect.width / 2 - currentIndex: 0 - interactive : false - clip : true - - delegate: Item { id: _delegateControl - width : _listView.width - height : Variables.instructionHeight - clip : true - - Rectangle { id: _stepRect - height : 40 - width : height - radius : height - color : _delegateControl.ListView.isCurrentItem ? Colors.backgroundMainMenu : Colors.offWhite - border { - color: Colors.backgroundMainMenu - width: 2 - } - - Text { id: _stepNumberRect - anchors.centerIn: parent - text : index + 1 - color : _delegateControl.ListView.isCurrentItem ? Colors.offWhite : Colors.backgroundMainMenu - font.pixelSize : 20 - font.weight : Font.Medium - } - - layer.enabled : true - layer.effect : DropShadow { id: _dropShadow - horizontalOffset: 0 - verticalOffset : 3 - radius : 3.0 - samples : 7 - color : "#50000000" - source : _stepRect - anchors.fill : _stepRect - } - } - - Text { id: _delegateText - anchors { - left : _stepRect.right - leftMargin : Variables.defaultMargin - right : _delegateControl.right - } - height : parent.height - width : parent.width - font.pixelSize : Fonts.fontPixelInstructionStep - font.weight : _delegateControl.ListView.isCurrentItem ? Font.DemiBold : Font.Normal - color : _delegateControl.ListView.isCurrentItem ? "#18559E" : Colors.alarmDialogText - text : model.instruction - wrapMode : Text.WordWrap - } - - MouseArea { - anchors.fill: parent - onClicked: { - if (_listView.currentIndex !== index) { - _listView.currentIndex = index - _root.figureImageSource = model.image - } - } - } - } - } - - Image { id: _figureImage - anchors.right : parent.right - anchors.verticalCenter: parent.verticalCenter - } + function alarmMaximize() { + currentScreen = NotificationDialog.AlarmMain + open() } - Rectangle { id: _timerRect - property int countDown : 0 - - height: 70 - width: parent.width / 3 - - anchors { - bottom : _alarmID.top - bottomMargin : Variables.defaultMargin * 2 - left : parent.left - leftMargin : Variables.defaultMargin * 4 - } - - color : "#FFECEC" - radius : 10 - - Text { id: _astrix - anchors { - left: parent.left - leftMargin: Variables.defaultMargin - top: _timerDescription.top - } - - color : "#AB352E" - text : "*" - font.pixelSize : 25 - font.weight : Font.Medium - } - - Text { id: _timerDescription - anchors { - verticalCenter: parent.verticalCenter - left: _astrix.right - } - - color : "black" - text : qsTr("Rinseback will not be allowed in:") - font.pixelSize : 25 - font.weight : Font.Medium - - } - - TimeText { id: _timeoutText - seconds : countDown * 60 - anchors { - verticalCenter : parent.verticalCenter - left: _timerDescription.right - } - height: _titleBar.height - textPixelSize : 35 - textWeight : Font.Bold - secondsVisible : false - hourZero : false - minuteZero : true - textColor : "#AB352E" - } + function alarmList() { + currentScreen = NotificationDialog.AlarmList + open() } - Row { id: _buttonGroup - property int buttonsWidth : 350 - spacing: 50 + AlarmDialog { id : _alarmDialog + // this will change later to the actual message text + // and the instruction would be in the dialog content + visible : currentScreen === NotificationDialog.AlarmMain + titleText : vAlarmStatus.title + titlePixelSize : Fonts.fontPixelAlarmTitle + instructionModel : vAlarmStatus.instructions + 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 + temporaryBreakVisible : ! vAlarmStatus.alarm_Flag_noTemporaryBreak + minVisible : ! vAlarmStatus.alarm_Flag_noMinimize + countDown : vTreatmentStop.countDown + countDownVisible : vTDOpMode.inTreatment + && ( + vTDTreatmentStates.txStop + || vTDTreatmentStates.txRinseback + || vTDTreatmentStates.txEnd + ) + && vTreatmentStop.total - anchors { - bottom : parent.bottom - horizontalCenter: parent.horizontalCenter - rightMargin : spacing - leftMargin : spacing - bottomMargin : Variables.defaultMargin * 4 - } - - // IMPORTANT NOTE : Alarm Dialog buttons - // It has been granteed by FW that there should never be more than 3 buttons on the ScreenItem - // Regarding the discussion there should be only 3 situations: - // 1 - Different combination of the Resume,Rinseback,End - // 2 - OK button for user to only ack the alarm - // 3 - No button at all for the situations that the alarm cannot be resolved by user. - // :: OK button and the other 3 buttons (Resume,Rinseback,End) should never come together - TouchRect { id : _resumeTouchRect - visible : resumeVisible - onPressed : resumeClicked() - text.text : qsTr("Resume") - width : _buttonGroup.buttonsWidth - isDefault : true - backgroundColor: Colors.white - fgColor : isPressed ? Colors.white : borderColor - selectColor : Qt.darker(borderColor, 1.15) - pixelSize : Fonts.fontPixelNotification - borderColor : Colors.alarmButton - } - - TouchRect { id : _temporaryBreak - visible : temporaryBreakVisible - onPressed : temporaryBreakClicked() - text.text : qsTr("Temporary Break") - width : _buttonGroup.buttonsWidth - backgroundColor: Colors.white - fgColor : isPressed ? Colors.white : borderColor - selectColor : Qt.darker(borderColor, 1.15) - pixelSize : Fonts.fontPixelNotification - borderColor : Colors.alarmButton - } - - TouchRect { id : _rinsebackTouchRect - visible : rinsebackVisible - onPressed : rinsebackClicked() - text.text : qsTr("Return Blood & End Treatment") - width : _buttonGroup.buttonsWidth - backgroundColor: Colors.white - fgColor : isPressed ? Colors.white : borderColor - selectColor : Qt.darker(borderColor, 1.15) - pixelSize : Fonts.fontPixelNotification - borderColor : Colors.alarmButton - } - - TouchRect { id : _endTouchRect - visible : endVisible - onPressed : endClicked() - text.text : qsTr("End Treatment Only") - width : _buttonGroup.buttonsWidth - backgroundColor: Colors.white - fgColor : isPressed ? Colors.white : borderColor - selectColor : Qt.darker(borderColor, 1.15) - pixelSize : Fonts.fontPixelNotification - borderColor : Colors.alarmButton - } - - TouchRect { id : _okTouchRect - visible : okVisible - onPressed : okClicked() - text.text : qsTr("OK") - width : _buttonGroup.buttonsWidth - backgroundColor: Colors.white - fgColor : isPressed ? Colors.white : borderColor - selectColor : Qt.darker(borderColor, 1.15) - pixelSize : Fonts.fontPixelNotification - borderColor : Colors.alarmButton - } + onMuteClicked : vAlarmStatus.doSilence () + onResumeClicked : vAlarmStatus.doUserActionResume () + onRinsebackClicked : vAlarmStatus.doUserActionRinseback () + onEndClicked : vAlarmStatus.doUserActionEnd () + onTemporaryBreakClicked : vAlarmStatus.doUserActionTemporaryBreak () + onOkClicked : vAlarmStatus.doUserActionOk () + onListClicked : alarmList () + onMinimizeClicked : alarmMinimize () } - Text { id: _alarmID - text : ("[%1:%2]") .arg(qsTr("ID")) - .arg(_root.alarmID) - anchors { - left : parent.left - bottom : parent.bottom - leftMargin : Variables.defaultMargin * 3 - bottomMargin: Variables.defaultMargin - } - color : Colors.alarmDialogGreyText - font.pixelSize : Fonts.fontPixelAlarmID + AlarmListDialog { id : _alarmListDialog + visible : currentScreen === NotificationDialog.AlarmList + isSilenced : vAlarmStatus.alarm_Flag_alarmsSilenced + timeout : vAlarmStatus.alarm_MuteTimeout + minVisible : ! vAlarmStatus.alarm_Flag_noMinimize + onMuteClicked : vAlarmStatus.doSilence() + onMinimizeClicked : alarmMinimize() + onListClicked : alarmMaximize() } - - Connections { target: vAlarmStatus - function onDidAlarmRaise ( ) { - // image is out of sync when a new alarm is appears so on new alarm go to step 1 image - if ( _root.instructionModel.rowCount() > 0) { - figureImageSource = _root.instructionModel.get(0).image - } - } - } }