Index: sources/gui/qml/components/NotificationBar.qml =================================================================== diff -u -r909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd -r7c684ec97418a7f4808f6d97235a0666115ae47e --- sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision 909090c5bae8b2fcc9aed6c2b55078b4f3d26fdd) +++ sources/gui/qml/components/NotificationBar.qml (.../NotificationBar.qml) (revision 7c684ec97418a7f4808f6d97235a0666115ae47e) @@ -21,47 +21,99 @@ import "qrc:/globals" Rectangle { id: _root - objectName: "NotificationBar" - property alias text : _text.text - property int level : 0 + objectName: "NotificationBar" // SquishQt + property alias text : _text.text + property alias textColor : _text.color + property int level : 0 + property bool isSilenced : false + property int muteTimeoutSec : 0 + property color backgroundColor : Colors.textNotificationNoneBg + signal clickedNotificationBar() + + function toggleSilence(silence, timeoutSec) { + isSilenced = silence; + muteTimeoutSec = !isSilenced ? 0 : timeoutSec; + _bell.source = isSilenced ? "qrc:/images/bell-off.svg" : "qrc:/images/bell.svg" + } + + // Placeholder animation + Timer { + id: _timer + interval: 1000; + running: false; + repeat: true; + onTriggered: { + _root.visible = !_root.visible; + + } + } + + function setFlashing(enable) { + _timer.running = enable; + } + visible : _text.text height : Variables.notificationHeight color : Colors.textNotificationNoneBg - radius : Variables.dialogRadius + //radius : Variables.dialogRadius anchors { bottom : parent.bottom left : parent.left right : parent.right } + Image { + id: _icon + source: "qrc:/images/alarm.svg" + anchors.right: _text.left + anchors.rightMargin: Variables.notificationBarIconMargin; + anchors.verticalCenter: parent.verticalCenter; + sourceSize.height: Variables.notificationBarIconHeight; + sourceSize.width: Variables.notificationBarIconWidth; + } + Text { id: _text color : Colors.textNotificationNoneFg - anchors.fill : parent + anchors.centerIn : parent font.pixelSize : Fonts.fontPixelNotification horizontalAlignment : Text.AlignHCenter verticalAlignment : Text.AlignVCenter + } + Image { + id: _bell + source: isSilenced ? "qrc:/images/bell-off.svg" : "qrc:/images/bell.svg" + anchors.left: _root.left + anchors.leftMargin: Variables.silenceIconMargin; + anchors.verticalCenter: parent.verticalCenter; + sourceSize.height: Variables.notificationBarIconHeight; + sourceSize.width: Variables.notificationBarIconWidth; + } + + Text { id: _timeout_text + color : Colors.textMain; + anchors.left : _bell.right + anchors.leftMargin : Variables.notificationBarIconMargin; + anchors.verticalCenter: parent.verticalCenter; + font.pixelSize : Fonts.fontPixelNotification + horizontalAlignment : Text.AlignHCenter + verticalAlignment : Text.AlignVCenter + text: muteTimeoutSec; // will be 60 second or less (see PRS) + visible: isSilenced; + } + + MouseArea { + id: _TouchArea + anchors.fill: parent; + onClicked: _root.clickedNotificationBar() + } + + onLevelChanged: { - 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; - break; - } + [_root.color, _text.color] = getRootTextFromAlarmLevel(level); } + }