Fixing Positioning Issues

This commit is contained in:
Sarah Jamie Lewis 2019-02-04 15:05:38 -08:00
parent cd5bfec43c
commit 98b96189f9
3 changed files with 11 additions and 14 deletions

View File

@ -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,
})
}

View File

@ -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)

View File

@ -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
}
}
}