Index: sources/gui/qml/dialogs/NotificationDialog.qml =================================================================== diff -u -rd1907168ef46faa6de1ada400cad789f8379041f -rd0c1c6aa5856a7acbca29a4c5435cc20db3ea383 --- sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision d1907168ef46faa6de1ada400cad789f8379041f) +++ sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision d0c1c6aa5856a7acbca29a4c5435cc20db3ea383) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2022 Diality Inc. - All Rights Reserved. * \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 NotificationDialog.qml - * \author (last) Peter Lucia - * \date (last) 26-Jun-2020 - * \author (original) Peter Lucia - * \date (original) 02-Jun-2020 + * \file NotificationDialog.qml + * \author (last) Behrouz NematiPour + * \date (last) 07-Oct-2021 + * \author (original) Peter Lucia + * \date (original) 02-Jun-2020 * */ @@ -22,55 +22,65 @@ import "qrc:/components" /*! - * \brief Contains the PowerOff Dialog Implementation + * \brief Contains the Alarm Dialog Implementation */ ModalDialog { id : _root contentItem.objectName: "_NotificationDialog" // SquishQt - property alias titleText : _title.text; - property alias description : _desc.text; - property alias titleBarForeground : _title.color - property alias titleBarBackground : _titleBar.color; - property alias okayBtn : _okay; - property alias dismissBtn : _dismiss; - property bool isSilenced : false; - property int alarmID : -1 + property alias titleText : _title.text + property alias description : _desc.text + property alias titleBarForeground : _title.color + property alias titleBarBackground : _titleBar.color + property alias isSilenced : _muteButton.isSilenced + property alias timeout : _muteButton.timeout + property int alarmID : -1 - visible: description + property alias countDown : _timeoutText.countDown + property alias countDownVisible : _timeoutText.visible - signal clickedSilence(); - signal clickedOkay(); - // Placeholder animation - Timer { - id: _timer - interval: 1000; - running: false; - onTriggered: { - _root.visible = !_root.visible; - } - } + property bool resumeVisible : false + property bool rinsebackVisible : false + property bool endVisible : false + property bool okVisible : false + property bool minVisible : true - function setFlashing(enable) { - _timer.running = enable; + property bool titleFading : false + Fader { + fadingProperyTarget : _root + fadingProperyRunning: titleFading + fadingProperyName : "titleBarBackground" + fadingProperyValue : titleBarBackground } - radius: 0; - Rectangle { - id: _titleBar; - color: Colors.alarmTopBarHighBg; - height: _root.height / 4; - width: _root.width; - radius: _root.radius; + // 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 + visible : description && ! isSilenced + radius : Variables.dialogRadius - Image { - id: _icon - source: "qrc:/images/alarm.png" + signal muteClicked() + signal minimizeClicked() + + signal resumeClicked() + signal rinsebackClicked() + signal endClicked() + signal okClicked() + + Rectangle { id: _titleBar + height : Variables.mainMenuHeight + width : _root.width + radius : _root.radius + clip : true // the mute button expands so we need to clip the outside unwanted area. + + Image { id: _icon + source: "qrc:/images/iAlarm" anchors.horizontalCenter: _title.horizontalCenter - anchors.verticalCenter: _title.verticalCenter; - anchors.horizontalCenterOffset: -_title.width + Variables.dialogSVGIconOffset; - sourceSize.height: Variables.dialogSVGHeight; - sourceSize.width: Variables.dialogSVGWidth; + anchors.verticalCenter: _title.verticalCenter + anchors.horizontalCenterOffset: -_title.width + Variables.dialogIconHorizontalOffset; + height : Variables.alarmListIconDiameter + width : Variables.alarmListIconDiameter } Text { id: _title @@ -79,42 +89,131 @@ text: qsTr("Notification") anchors.centerIn: _titleBar; } + + MouseArea { id: _minimizeArea + enabled : _root.minVisible + anchors.fill: parent + onClicked : _root.minimizeClicked() + } + + UpDownButton { id: _minimizeButton + backgroundColor: _titleBar.color + isUp : false + isList : ! _root.minVisible + anchors { + verticalCenter : _titleBar.verticalCenter + right : _titleBar.right + rightMargin : Variables.silenceIconMargin + } + onClicked: _root.minimizeClicked() + } + + MuteButton { id: _muteButton + backgroundColor: _titleBar.color + anchors { + verticalCenter : _titleBar.verticalCenter + left : _titleBar.left + leftMargin : Variables.silenceIconMargin + } + onClicked: _root.muteClicked() + } + + TimeText { id: _timeoutText + property int countDown : 0 + seconds : countDown * 60 + + height: _titleBar.height + anchors { + verticalCenter : _titleBar.verticalCenter + right : _titleBar.right + rightMargin : _minimizeButton.width * 2 + } + textPixelSize : 30 + textWeight : Font.Normal + secondsVisible : false + hourZero : false + minuteZero : true + } + + // TODO: disable this later. this is only for diagnostic purpose when alarm dialog covers the entire screen. + MouseArea { + anchors.fill: _icon + onClicked : if ( _minimizeArea.enabled ) _root.minimizeClicked() + onDoubleClicked : _sdItem.doubleClicked() + } } - Text { id: _desc - objectName: "_NotificationDialog_Description" - color: Colors.textMain - font.pixelSize: Fonts.fontPixelButton + + Rectangle { id: _descReect + color: Colors.transparent anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; + fill : parent + topMargin : 5 + _titleBar .height + bottomMargin : 5 + _buttonGroup .height + _buttonGroup.spacing } + + Text { id: _desc + objectName: "_NotificationDialog_Description" + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter : parent.verticalCenter + } + } } - Row { - id: _buttons - spacing: Variables.buttonSpacing; + Row { id: _buttonGroup + property int buttonsWidth : 300 + spacing: 50 + anchors { - horizontalCenter: parent.horizontalCenter; - bottom: parent.bottom; - bottomMargin: Variables.dialogMargin / 2; + bottom : parent.bottom + horizontalCenter: parent.horizontalCenter + rightMargin : spacing + leftMargin : spacing + bottomMargin : spacing / 2 // give the content more space. } - TouchRect { id : _okay - width: _root.width / 3; - text.text: qsTr("OKAY") - borderColor: _root.textColor; - button.onPressed: { - clickedOkay(); + // 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 + borderColor : Colors.white + selectColor : Qt.darker(_root.backgroundColor, 1.15) + } - } + TouchRect { id : _rinsebackTouchRect + visible : rinsebackVisible + onPressed : rinsebackClicked() + text.text : qsTr("RINSEBACK") + width : _buttonGroup.buttonsWidth + borderColor : Colors.white + selectColor : Qt.darker(_root.backgroundColor, 1.15) } - TouchRect { id : _dismiss - width: _root.width / 3; - text.text: qsTr("SILENCE") - borderColor: _root.textColor; - button.onPressed: { - clickedSilence() - } + + TouchRect { id : _endTouchRect + visible : endVisible + onPressed : endClicked() + text.text : qsTr("END TREATMENT") + width : _buttonGroup.buttonsWidth + borderColor : Colors.white + selectColor : Qt.darker(_root.backgroundColor, 1.15) } + TouchRect { id : _okTouchRect + visible : okVisible + onPressed : okClicked() + text.text : qsTr("OK") + width : _buttonGroup.buttonsWidth + borderColor : Colors.white + selectColor : Qt.darker(_root.backgroundColor, 1.15) + } } }