mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:31:13 +02:00
Actually fix notifications.
This commit is contained in:
parent
48c690a2df
commit
7d789acaa6
4 changed files with 32 additions and 55 deletions
|
@ -32,12 +32,8 @@
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
Messages.subscribe("chat");
|
Messages.subscribe("chat");
|
||||||
Messages.messageReceived.connect(receivedMessage);
|
Messages.messageReceived.connect(receivedMessage);
|
||||||
AvatarManager.avatarAddedEvent.connect((sessionId) => {
|
AvatarManager.avatarAddedEvent.connect((sessionId) => { _avatarAction("connected", sessionId); });
|
||||||
_avatarAction("connected", sessionId);
|
AvatarManager.avatarRemovedEvent.connect((sessionId) => { _avatarAction("left", sessionId); });
|
||||||
});
|
|
||||||
AvatarManager.avatarRemovedEvent.connect((sessionId) => {
|
|
||||||
_avatarAction("left", sessionId);
|
|
||||||
});
|
|
||||||
|
|
||||||
startup();
|
startup();
|
||||||
|
|
||||||
|
@ -206,7 +202,7 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function _avatarAction(type, sessionId) {
|
function _avatarAction(type, sessionId) {
|
||||||
Script.setTimeout(() => {
|
Script.setTimeout(async () => {
|
||||||
if (type == "connected") {
|
if (type == "connected") {
|
||||||
palData = AvatarManager.getPalData().data;
|
palData = AvatarManager.getPalData().data;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +230,11 @@
|
||||||
_notificationCoreMessage(displayName, type)
|
_notificationCoreMessage(displayName, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
_emitEvent({ type: "notification", ...message });
|
// Format notification message
|
||||||
|
let formattedMessagePacket = {...message};
|
||||||
|
formattedMessagePacket.message = await _parseMessage(message.message);
|
||||||
|
|
||||||
|
_emitEvent({ type: "notification", ...formattedMessagePacket });
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
async function _loadSettings() {
|
async function _loadSettings() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ Rectangle {
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
property string pageVal: "local"
|
property string pageVal: "local"
|
||||||
property string last_message_user: ""
|
|
||||||
property date last_message_time: new Date()
|
property date last_message_time: new Date()
|
||||||
|
|
||||||
// When the window is created on the script side, the window starts open.
|
// When the window is created on the script side, the window starts open.
|
||||||
|
@ -163,7 +162,7 @@ Rectangle {
|
||||||
model: getChannel(pageVal)
|
model: getChannel(pageVal)
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
property int delegateIndex: model.index
|
property int delegateIndex: model.index
|
||||||
property var delegateText: model.text
|
property var delegateText: model.message
|
||||||
property string delegateUsername: model.username
|
property string delegateUsername: model.username
|
||||||
property string delegateDate: model.date
|
property string delegateDate: model.date
|
||||||
|
|
||||||
|
@ -171,7 +170,6 @@ Rectangle {
|
||||||
if (model.type === "chat") return template_chat_message;
|
if (model.type === "chat") return template_chat_message;
|
||||||
if (model.type === "notification") return template_notification;
|
if (model.type === "notification") return template_notification;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,15 +404,13 @@ Rectangle {
|
||||||
channel = getChannel(channel)
|
channel = getChannel(channel)
|
||||||
|
|
||||||
// Format content
|
// Format content
|
||||||
|
|
||||||
if (type === "notification"){
|
if (type === "notification"){
|
||||||
channel.append({ text: message, date: date, type: "notification" });
|
channel.append({ message: message, date: date, type: "notification" });
|
||||||
scrollToBottom(null, 30);
|
scrollToBottom(null, 30);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.append({ text: message, username: username, date: date, type: type });
|
channel.append({ message: message, username: username, date: date, type: type });
|
||||||
load_scroll_timer.running = true;
|
load_scroll_timer.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ Component {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property int index: delegateIndex
|
property int index: delegateIndex
|
||||||
property string username: delegateUsername
|
|
||||||
|
|
||||||
height: Math.max(65, children[1].height + 30)
|
height: Math.max(65, children[1].height + 30)
|
||||||
color: index % 2 === 0 ? "transparent" : Qt.rgba(0.15,0.15,0.15,1)
|
color: index % 2 === 0 ? "transparent" : Qt.rgba(0.15,0.15,0.15,1)
|
||||||
|
@ -19,12 +18,12 @@ Component {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
height: 22
|
height: 22
|
||||||
|
|
||||||
Text{
|
Text {
|
||||||
text: username
|
text: delegateUsername
|
||||||
color: "lightgray"
|
color: "lightgray"
|
||||||
}
|
}
|
||||||
|
|
||||||
Text{
|
Text {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
text: delegateDate
|
text: delegateDate
|
||||||
color: "lightgray"
|
color: "lightgray"
|
||||||
|
@ -109,7 +108,7 @@ Component {
|
||||||
radius: 2;
|
radius: 2;
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
source: "./img/ui/world_black.png"
|
source: "../img/ui/world_black.png"
|
||||||
width: 18;
|
width: 18;
|
||||||
height: 18;
|
height: 18;
|
||||||
sourceSize.width: 18
|
sourceSize.width: 18
|
||||||
|
|
|
@ -6,15 +6,12 @@ Component {
|
||||||
id: template_notification
|
id: template_notification
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property int index: delegateIndex
|
|
||||||
property string username: delegateUsername
|
|
||||||
|
|
||||||
color: "#171717"
|
color: "#171717"
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 40
|
height: 40
|
||||||
|
|
||||||
Item {
|
RowLayout {
|
||||||
width: 10
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -22,38 +19,23 @@ Component {
|
||||||
width: 5
|
width: 5
|
||||||
color: "#505186"
|
color: "#505186"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
Repeater {
|
||||||
width: parent.width - parent.children[0].width - 5
|
model: delegateText
|
||||||
height: parent.height
|
|
||||||
anchors.left: parent.children[0].right
|
|
||||||
|
|
||||||
TextEdit {
|
TextEdit {
|
||||||
text: delegateText
|
visible: model.value != undefined;
|
||||||
color: "white"
|
text: model.value || ""
|
||||||
font.pointSize: 12
|
color: "white"
|
||||||
readOnly: true
|
font.pointSize: 12
|
||||||
width: parent.width * 0.8
|
readOnly: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
selectByKeyboard: true
|
selectByKeyboard: true
|
||||||
height: parent.height
|
height: root.height
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
verticalAlignment: Text.AlignVCenter
|
font.italic: true
|
||||||
font.italic: true
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: delegateDate
|
|
||||||
color: "white"
|
|
||||||
font.pointSize: 12
|
|
||||||
anchors.right: parent.right
|
|
||||||
height: parent.height
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
font.italic: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue