Index: sources/gui/qml/dialogs/NotificationDialog.qml =================================================================== diff -u -rb61d8a3e01fef66eee8095c9cddf835d9bb32b66 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision b61d8a3e01fef66eee8095c9cddf835d9bb32b66) +++ sources/gui/qml/dialogs/NotificationDialog.qml (.../NotificationDialog.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 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) 06-Oct-2020 - * \author (original) Peter Lucia - * \date (original) 02-Jun-2020 + * \file NotificationDialog.qml + * \author (last) Behrouz NematiPour + * \date (last) 17-Apr-2023 + * \author (original) Peter Lucia + * \date (original) 02-Jun-2020 * */ @@ -27,82 +27,208 @@ 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 silenceBtn : _silence - property bool isSilenced : false - property int alarmID : -1 + property alias titleText : _title.text + property alias titlePixelSize : _title.font.pixelSize + property alias description : _desc.text + property alias descriptionPixelSize : _desc.font.pixelSize + 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(); - radius: 0; - Rectangle { - id: _titleBar; - color: Colors.alarmTopBarHighBg; - height: _root.height / 4; - width: _root.width; - radius: _root.radius; + property bool resumeVisible : false + property bool rinsebackVisible : false + property bool endVisible : false + property bool okVisible : false + property bool minVisible : true - Image { - id: _icon - source: "qrc:/images/iAlarm" - anchors.horizontalCenter: _title.horizontalCenter - anchors.verticalCenter: _title.verticalCenter; - anchors.horizontalCenterOffset: -_title.width + Variables.dialogIconHorizontalOffset; - sourceSize.height: Variables.dialogIconHeight; - sourceSize.width: Variables.dialogIconWidth; - } + property bool titleFading : false + Fader { + fadingProperyTarget : _root + fadingProperyRunning: titleFading + fadingProperyName : "titleBarBackground" + fadingProperyValue : titleBarBackground + } + // 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 + + 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.dialogIconHorizontalOffset; + // height : Variables.alarmListIconDiameter + // width : Variables.alarmListIconDiameter + // } + Text { id: _title color: Colors.textMain font.pixelSize: Fonts.fontPixelTitle text: qsTr("Notification") - anchors.centerIn: _titleBar; + + width: _titleBar.width + verticalAlignment : Text.AlignVCenter + horizontalAlignment : Text.AlignHCenter + anchors.centerIn: _titleBar } + + MouseArea { id: _minimizeArea + // this object is not exposed so cannot be missused by the child component, so here it can be enabled and being handled by the minVisible property + // enabled : _root.minVisible + anchors.fill : parent + onClicked : { if ( _root.minVisible ) _root.minimizeClicked() } // if can be minimized (minVisible = true ), call the minimizeClinked signal (norma behavior) + onDoubleClicked : { if ( ! _root.minVisible ) _sdcProgressItem.doubleClicked() } // if can NOT be minimized (minVisible = false), call the sdcard.double click to pop the DiagnosticsDialog + // TODO: disable doubleClicked later. this is only for diagnostic purpose when alarm dialog covers the entire screen. + } + + 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 : _minimizeButton.left + rightMargin : 15 + } + textPixelSize : 30 + textWeight : Font.Normal + secondsVisible : false + hourZero : false + minuteZero : true + } } - Text { id: _desc - objectName: "_NotificationDialog_Description" - color: Colors.textMain - font.pixelSize: Fonts.fontPixelButton + Rectangle { id: _descReect + color: Colors.transparent + clip : true anchors { - horizontalCenter: parent.horizontalCenter; - verticalCenter: parent.verticalCenter; + fill : parent + topMargin : _titleBar .height + 2 + bottomMargin : _buttonGroup .height } + + 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 : _silence - 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) + } } + + Text { id: _alarmID + text : qsTr("ID") + ":" + _root.alarmID + anchors { + left : parent.left + bottom : parent.bottom + leftMargin : 5 + bottomMargin: 5 + } + color : Colors.textMain + font.pixelSize : Fonts.fontPixelDialogText + } }