Improved contact list id displaying

Now a color based representation is showed like an avatar for easier
verification, showing the full id is still possible longpressing the
colored representation
This commit is contained in:
Gioacchino Mazzurco 2017-03-21 14:47:34 +01:00
parent 17a41dc96a
commit 34dc1fac37

View File

@ -76,7 +76,7 @@ Item
model: locationsModel.model model: locationsModel.model
delegate: Item delegate: Item
{ {
height: 20 height: 40
width: parent.width width: parent.width
MouseArea MouseArea
@ -96,10 +96,69 @@ Item
contactsView.startChatCallback) contactsView.startChatCallback)
} }
} }
Rectangle
{
id: colorHash
height: parent.height - 4
width: height
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 2
color: "white"
property int childHeight : height/2
Rectangle
{
color: '#' + model.gxs_id.substring(1, 9)
height: parent.childHeight
width: height
anchors.top: parent.top
anchors.left: parent.left
}
Rectangle
{
color: '#' + model.gxs_id.substring(9, 17)
height: parent.childHeight
width: height
anchors.top: parent.top
anchors.right: parent.right
}
Rectangle
{
color: '#' + model.gxs_id.substring(17, 25)
height: parent.childHeight
width: height
anchors.bottom: parent.bottom
anchors.left: parent.left
}
Rectangle
{
color: '#' + model.gxs_id.slice(-8)
height: parent.childHeight
width: height
anchors.bottom: parent.bottom
anchors.right: parent.right
}
MouseArea
{
anchors.fill: parent
onPressAndHold:
{
fingerPrintDialog.nick = model.name
fingerPrintDialog.gxs_id = model.gxs_id
fingerPrintDialog.visible = true
}
}
}
Text Text
{ {
id: nickText
color: model.own ? "blue" : "black" color: model.own ? "blue" : "black"
text: model.name + " " + model.gxs_id text: model.name
anchors.left: colorHash.right
anchors.leftMargin: 5
anchors.verticalCenter: parent.verticalCenter
} }
} }
} }
@ -147,4 +206,25 @@ Item
CheckBox { id: psdnmCheckBox; checked: true; enabled: false } CheckBox { id: psdnmCheckBox; checked: true; enabled: false }
} }
} }
Dialog
{
id: fingerPrintDialog
visible: false
property string nick
property string gxs_id
title: nick + " fingerprint:"
standardButtons: StandardButton.NoButton
Text
{
id: fingerPrintText
anchors.centerIn: parent
text: "<pre>" +
fingerPrintDialog.gxs_id.substring(1, 9) + "<br/>" +
fingerPrintDialog.gxs_id.substring(9, 17) + "<br/>" +
fingerPrintDialog.gxs_id.substring(17, 25) + "<br/>" +
fingerPrintDialog.gxs_id.slice(-8) + "<br/>" +
"</pre>"
}
}
} }