diff --git a/go/characters/incominglistener.go b/go/characters/incominglistener.go index 776bd3d..19ba293 100644 --- a/go/characters/incominglistener.go +++ b/go/characters/incominglistener.go @@ -37,6 +37,7 @@ func IncomingListener(callback func(*gobjects.Message)) { From: e.Data[event.RemotePeer], Message: e.Data[event.Data], Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]), + FromMe: e.Data[event.RemotePeer] == the.Peer.GetProfile().Onion, Timestamp: ts, }) } diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index 98b2e7c..52e6f6d 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -87,9 +87,6 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) { this.messages[m.Handle] = append(this.messages[m.Handle], m) if this.parentGcd.CurrentOpenConversation() == m.Handle { - if m.FromMe { - m.From = "me" - } this.parentGcd.AppendMessage(m.Handle, m.From, m.DisplayName, m.Message, m.Image, uint(m.MessageID), m.FromMe, m.Timestamp.Format(constants.TIME_FORMAT)) } else { c := this.GetContact(m.Handle) diff --git a/qml/widgets/Message.qml b/qml/widgets/Message.qml index 1e336a9..7d35e12 100644 --- a/qml/widgets/Message.qml +++ b/qml/widgets/Message.qml @@ -8,9 +8,9 @@ import "controls" as Awesome RowLayout { id: root - //Layout.alignment: from == "me" ? Qt.AlignRight : Qt.AlignLeft - anchors.left: from == "me" ? undefined : parent.left - anchors.right: from == "me" ? parent.right : undefined + + anchors.left: fromMe ? undefined : parent.left + anchors.right: fromMe ? parent.right : undefined height: Math.max(imgProfile.height, rectMessageBubble.height) property alias message: lbl.text @@ -23,7 +23,6 @@ RowLayout { property alias image: imgProfile.source property alias status: imgProfile.status - Connections { target: gcd @@ -38,7 +37,7 @@ RowLayout { ContactPicture { id: imgProfile anchors.left: parent.left - visible: from != "me" + visible: !fromMe } Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE @@ -49,13 +48,13 @@ RowLayout { width: colMessageBubble.width + 6 Layout.minimumWidth: width Layout.maximumWidth: width - color: from == "me" ? "#B09CBC" : "#4B3557" + color: fromMe ? "#B09CBC" : "#4B3557" radius: 5 // the console will complain constantly about me setting these anchors, but qt only allows margins if they've been set to something // a kludge to fix this would be to have spacers before/after and set the widths according to the side they're on ^ea - anchors.left: from == "me" ? undefined : imgProfile.right //parent.left - anchors.right: from == "me" ? parent.right : undefined + anchors.left: fromMe ? undefined : imgProfile.right //parent.left + anchors.right: fromMe ? parent.right : undefined anchors.leftMargin: 5 anchors.rightMargin: 9 anchors.topMargin: 5 @@ -110,16 +109,16 @@ RowLayout { font.pixelSize: 10 anchors.right: parent.right text: displayName - visible: from != "me" + visible: !fromMe } Image { // ACKNOWLEDGEMENT ICON id: ack anchors.right: parent.right - source: displayName == "" ? "qrc:/qml/images/fontawesome/regular/hourglass.svg" : "qrc:/qml/images/fontawesome/regular/check-circle.svg" + source: from == "me" ? "qrc:/qml/images/fontawesome/regular/hourglass.svg" : "qrc:/qml/images/fontawesome/regular/check-circle.svg" height: 10 sourceSize.height: 10 - visible: from == "me" + visible: fromMe } } }