forked from cwtch.im/ui
Fixing Positioning Issues
This commit is contained in:
parent
cd5bfec43c
commit
98b96189f9
|
@ -37,6 +37,7 @@ func IncomingListener(callback func(*gobjects.Message)) {
|
||||||
From: e.Data[event.RemotePeer],
|
From: e.Data[event.RemotePeer],
|
||||||
Message: e.Data[event.Data],
|
Message: e.Data[event.Data],
|
||||||
Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]),
|
Image: cwutil.RandomProfileImage(e.Data[event.RemotePeer]),
|
||||||
|
FromMe: e.Data[event.RemotePeer] == the.Peer.GetProfile().Onion,
|
||||||
Timestamp: ts,
|
Timestamp: ts,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,6 @@ func (this *InterfaceState) AddMessage(m *gobjects.Message) {
|
||||||
this.messages[m.Handle] = append(this.messages[m.Handle], m)
|
this.messages[m.Handle] = append(this.messages[m.Handle], m)
|
||||||
|
|
||||||
if this.parentGcd.CurrentOpenConversation() == m.Handle {
|
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))
|
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 {
|
} else {
|
||||||
c := this.GetContact(m.Handle)
|
c := this.GetContact(m.Handle)
|
||||||
|
|
|
@ -8,9 +8,9 @@ import "controls" as Awesome
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
//Layout.alignment: from == "me" ? Qt.AlignRight : Qt.AlignLeft
|
|
||||||
anchors.left: from == "me" ? undefined : parent.left
|
anchors.left: fromMe ? undefined : parent.left
|
||||||
anchors.right: from == "me" ? parent.right : undefined
|
anchors.right: fromMe ? parent.right : undefined
|
||||||
height: Math.max(imgProfile.height, rectMessageBubble.height)
|
height: Math.max(imgProfile.height, rectMessageBubble.height)
|
||||||
|
|
||||||
property alias message: lbl.text
|
property alias message: lbl.text
|
||||||
|
@ -23,7 +23,6 @@ RowLayout {
|
||||||
property alias image: imgProfile.source
|
property alias image: imgProfile.source
|
||||||
property alias status: imgProfile.status
|
property alias status: imgProfile.status
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: gcd
|
target: gcd
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ RowLayout {
|
||||||
ContactPicture {
|
ContactPicture {
|
||||||
id: imgProfile
|
id: imgProfile
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
visible: from != "me"
|
visible: !fromMe
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
|
Rectangle { // THIS IS JUST A PRETTY MESSAGE-HOLDING RECTANGLE
|
||||||
|
@ -49,13 +48,13 @@ RowLayout {
|
||||||
width: colMessageBubble.width + 6
|
width: colMessageBubble.width + 6
|
||||||
Layout.minimumWidth: width
|
Layout.minimumWidth: width
|
||||||
Layout.maximumWidth: width
|
Layout.maximumWidth: width
|
||||||
color: from == "me" ? "#B09CBC" : "#4B3557"
|
color: fromMe ? "#B09CBC" : "#4B3557"
|
||||||
radius: 5
|
radius: 5
|
||||||
|
|
||||||
// the console will complain constantly about me setting these anchors, but qt only allows margins if they've been set to something
|
// 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
|
// 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.left: fromMe ? undefined : imgProfile.right //parent.left
|
||||||
anchors.right: from == "me" ? parent.right : undefined
|
anchors.right: fromMe ? parent.right : undefined
|
||||||
anchors.leftMargin: 5
|
anchors.leftMargin: 5
|
||||||
anchors.rightMargin: 9
|
anchors.rightMargin: 9
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
|
@ -110,16 +109,16 @@ RowLayout {
|
||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
text: displayName
|
text: displayName
|
||||||
visible: from != "me"
|
visible: !fromMe
|
||||||
}
|
}
|
||||||
|
|
||||||
Image { // ACKNOWLEDGEMENT ICON
|
Image { // ACKNOWLEDGEMENT ICON
|
||||||
id: ack
|
id: ack
|
||||||
anchors.right: parent.right
|
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
|
height: 10
|
||||||
sourceSize.height: 10
|
sourceSize.height: 10
|
||||||
visible: from == "me"
|
visible: fromMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue