2020-07-10 21:47:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Window 2.12
|
|
|
|
import QtQml 2.13
|
|
|
|
|
|
|
|
import "../imports"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
property var chatId: ""
|
|
|
|
property var message: "hello"
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: winInit
|
|
|
|
Window {
|
|
|
|
flags: Qt.WindowStaysOnTopHint | Qt.WindowStaysOnTopHint | Qt.Popup | Qt.WA_ShowWithoutActivating | Qt.WindowStaysOnTopHint | Qt.BypassWindowManagerHint | Qt.WindowStaysOnTopHint
|
|
|
|
width: 1
|
|
|
|
height: 1
|
|
|
|
Component.onCompleted: {
|
|
|
|
requestActivate()
|
|
|
|
mainWin.createObject(root)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: mainWin
|
|
|
|
|
|
|
|
Window {
|
|
|
|
id: notificationWindowSub
|
|
|
|
flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_ShowWithoutActivating | Qt.BypassWindowManagerHint | Qt.WindowStaysOnTopHint | Qt.BypassWindowManagerHint
|
|
|
|
x: Screen.width - 250
|
|
|
|
y: 50
|
|
|
|
width: 200
|
|
|
|
height: 100
|
|
|
|
visible: true
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: "white"
|
|
|
|
Text {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: message
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
timer.stop()
|
|
|
|
notificationWindowSub.close()
|
2020-07-15 22:00:18 +00:00
|
|
|
notificationWindowSub.destroy()
|
|
|
|
mainWin.destroy()
|
2020-07-10 21:47:31 +00:00
|
|
|
applicationWindow.raise()
|
|
|
|
chatsModel.setActiveChannel(chatId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
interval: 4000;
|
|
|
|
running: false;
|
|
|
|
repeat: false
|
2020-07-15 22:00:18 +00:00
|
|
|
onTriggered: {
|
|
|
|
notificationWindowSub.close()
|
|
|
|
notificationWindowSub.destroy()
|
|
|
|
}
|
2020-07-10 21:47:31 +00:00
|
|
|
}
|
|
|
|
onVisibleChanged: {
|
|
|
|
if(visible) {
|
|
|
|
timer.running = true;
|
|
|
|
if (applicationWindow.active) {
|
|
|
|
this.flags |= Qt.Popup
|
|
|
|
} else {
|
|
|
|
this.flags = Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.WA_ShowWithoutActivating | Qt.BypassWindowManagerHint | Qt.WindowStaysOnTopHint | Qt.BypassWindowManagerHint
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function notifyUser(chatId, msg) {
|
|
|
|
this.chatId = chatId
|
|
|
|
this.message = msg
|
|
|
|
notificationSound.play()
|
|
|
|
var w1 = winInit.createObject(null)
|
|
|
|
w1.destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|