Skip to content

Commit

Permalink
World links.
Browse files Browse the repository at this point in the history
  • Loading branch information
Armored-Dragon committed Nov 30, 2024
1 parent 54b4aa7 commit 9174ffa
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 14 deletions.
4 changes: 2 additions & 2 deletions scripts/system/domainChat/domainChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
let formattedMessagePacket = { ...message };
formattedMessagePacket.message = formattedMessage

_emitEvent({ type: "show_message", ...formattedMessagePacket }); // Update qml view of to new message.
_emitEvent({ type: "show_message", ...formattedMessagePacket }); // Update qml view of to new message.
_notificationCoreMessage(message.displayName, message.message) // Show a new message on screen.

// Create a new variable based on the message that will be saved.
Expand Down Expand Up @@ -290,7 +290,7 @@
function _parseMessage(message){
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
const mentionRegex = /@(\w+)/; // FIXME: Remove - devcode
const overteLocationRegex = null;
const overteLocationRegex = /hifi:\/\/[a-zA-Z0-9_-]+\/[-+]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+\/[-+]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+/;

let runningMessage = message;
let messageArray = [];
Expand Down
71 changes: 59 additions & 12 deletions scripts/system/domainChat/domainChat.qml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ Rectangle {
anchors.top: parent.children[0].bottom;
width: parent.width * 0.8
x: 5
id: messageBoxFlow

Repeater {
model: texttest;
Expand All @@ -432,7 +433,7 @@ Rectangle {
text: model.value || ""
font.pointSize: 12
wrapMode: Text.Wrap
width: Math.min(parent.parent.parent.width, contentWidth);
width: Math.min(messageBoxFlow.width, contentWidth);

visible: model.type === 'text' || model.type === 'mention';

Expand All @@ -447,41 +448,87 @@ Rectangle {
}

RowLayout {
width: Math.min(parent.parent.parent.width, children[0].contentWidth);
width: Math.min(messageBoxFlow.width, children[0].contentWidth);
visible: model.type === 'url';

Text {
text: model.value || ""
font.pointSize: 12
wrapMode: Text.Wrap
text: model.value || "";
font.pointSize: 12;
wrapMode: Text.Wrap;
color: "#4EBAFD";
font.underline: true
font.underline: true;
width: parent.width;

MouseArea {
anchors.fill: parent;

onClicked: {
Window.openWebBrowser(model.value)
Window.openWebBrowser(model.value);
}
}
}

Text {
text: "🗗"
font.pointSize: 10
wrapMode: Text.Wrap
color: "white"
text: "🗗";
font.pointSize: 10;
wrapMode: Text.Wrap;
color: "white";

MouseArea {
anchors.fill: parent;

onClicked: {
Qt.openUrlExternally(model.value)
Qt.openUrlExternally(model.value);
}
}
}
}

RowLayout {
visible: model.type === 'overteLocation';
width: Math.min(messageBoxFlow.width, children[0].children[1].contentWidth + 35);
height: 20;
Layout.leftMargin: 5
Layout.rightMargin: 5

Rectangle {
width: parent.width;
height: 20;
color: "lightgray"
radius: 2;

Image {
source: "./img/ui/world_black.png"
width: 18;
height: 18;
sourceSize.width: 18
sourceSize.height: 18
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 2
anchors.rightMargin: 10
}

Text {
text: model.value.split('hifi://')[1].split('/')[0];
color: "black"
font.pointSize: 12
x: parent.children[0].width + 5;
anchors.verticalCenter: parent.verticalCenter
}

MouseArea {
anchors.fill: parent;

onClicked: {
Window.openUrl(model.value);
}
}

}
}


Item {
Layout.fillWidth: true
visible: model.type === 'messageEnd'
Expand Down

0 comments on commit 9174ffa

Please sign in to comment.