mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 06:12:43 -04:00
Refactor qml structure for aesthetic contacts
This commit is contained in:
parent
59b77da6a2
commit
fa9578fca6
1 changed files with 97 additions and 77 deletions
|
@ -22,95 +22,114 @@ import QtQuick.Controls 2.0
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: delegateRoot
|
id: delegateRoot
|
||||||
height: 40
|
height: 50
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
MouseArea
|
Rectangle {
|
||||||
{
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked:
|
color: contactItem.containsMouse ? "lightgrey" : "transparent"
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
|
||||||
|
MouseArea
|
||||||
{
|
{
|
||||||
console.log("GxsIntentityDelegate onclicked:", model.name,
|
id: contactItem
|
||||||
model.gxs_id)
|
anchors.fill: parent
|
||||||
contactsView.searching = false
|
onClicked:
|
||||||
if(model.own) contactsView.own_gxs_id = model.gxs_id
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
var jsonData = { "own_gxs_hex": contactsView.own_gxs_id,
|
console.log("GxsIntentityDelegate onclicked:", model.name,
|
||||||
"remote_gxs_hex": model.gxs_id }
|
model.gxs_id)
|
||||||
rsApi.request("/chat/initiate_distant_chat",
|
contactsView.searching = false
|
||||||
JSON.stringify(jsonData),
|
if(model.own) contactsView.own_gxs_id = model.gxs_id
|
||||||
contactsView.startChatCallback)
|
else
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressAndHold: showDetails()
|
|
||||||
|
|
||||||
ColorHash
|
|
||||||
{
|
|
||||||
id: colorHash
|
|
||||||
|
|
||||||
hash: model.gxs_id
|
|
||||||
height: parent.height - 4
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 2
|
|
||||||
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: delegateRoot.showDetails()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
|
||||||
id: nickText
|
|
||||||
color: model.own ? "blue" : "black"
|
|
||||||
text: model.name
|
|
||||||
anchors.left: colorHash.right
|
|
||||||
anchors.leftMargin: 5
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: 10
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
height: parent.height - 10
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
visible: model.unread_count > 0
|
|
||||||
|
|
||||||
color: "cornflowerblue"
|
|
||||||
antialiasing: true
|
|
||||||
border.color: "blue"
|
|
||||||
border.width: 1
|
|
||||||
height: parent.height - 4
|
|
||||||
radius: height/2
|
|
||||||
width: height
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
{
|
||||||
color: "white"
|
var jsonData = { "own_gxs_hex": contactsView.own_gxs_id,
|
||||||
font.bold: true
|
"remote_gxs_hex": model.gxs_id }
|
||||||
text: model.unread_count
|
rsApi.request("/chat/initiate_distant_chat",
|
||||||
anchors.centerIn: parent
|
JSON.stringify(jsonData),
|
||||||
|
contactsView.startChatCallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image
|
onPressAndHold: showDetails()
|
||||||
|
hoverEnabled: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
anchors.margins: 5
|
||||||
|
// anchors.leftMargin: 5
|
||||||
|
|
||||||
|
|
||||||
|
ColorHash
|
||||||
{
|
{
|
||||||
source: model.is_contact ?
|
id: colorHash
|
||||||
"qrc:/icons/rating.png" :
|
|
||||||
"qrc:/icons/rating-unrated.png"
|
hash: model.gxs_id
|
||||||
height: parent.height - 4
|
height: parent.height - 4
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 2
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: delegateRoot.showDetails()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: nickText
|
||||||
|
color: model.own ? "blue" : "black"
|
||||||
|
text: model.name
|
||||||
|
anchors.left: colorHash.right
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 10
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height - 10
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
visible: model.unread_count > 0
|
||||||
|
|
||||||
|
color: "cornflowerblue"
|
||||||
|
antialiasing: true
|
||||||
|
border.color: "blue"
|
||||||
|
border.width: 1
|
||||||
|
height: parent.height - 4
|
||||||
|
radius: height/2
|
||||||
|
width: height
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
color: "white"
|
||||||
|
font.bold: true
|
||||||
|
text: model.unread_count
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
source: model.is_contact ?
|
||||||
|
"qrc:/icons/rating.png" :
|
||||||
|
"qrc:/icons/rating-unrated.png"
|
||||||
|
height: parent.height - 4
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,3 +143,4 @@ Item
|
||||||
{md: contactsListView.model.get(index)})
|
{md: contactsListView.model.get(index)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue