95 lines
2.3 KiB
QML
95 lines
2.3 KiB
QML
import QtQuick 2.5
|
|
import "."
|
|
|
|
// Ligne de la liste des serveurs.
|
|
Rectangle {
|
|
id: root
|
|
|
|
property string name: ""
|
|
property string address: ""
|
|
property bool discovered: false
|
|
property bool highlighted: false
|
|
signal clicked()
|
|
|
|
height: 72
|
|
radius: Theme.radius
|
|
color: highlighted ? Theme.focusBackground : Theme.surface
|
|
|
|
Behavior on color { ColorAnimation { duration: Theme.animFast } }
|
|
|
|
Rectangle {
|
|
id: icon
|
|
anchors {
|
|
left: parent.left
|
|
leftMargin: Theme.spacingM
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
width: 40
|
|
height: 40
|
|
radius: width / 2
|
|
color: Theme.avatarColor(root.name)
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.name.charAt(0).toUpperCase()
|
|
color: Theme.text
|
|
font.pixelSize: Theme.fontBody
|
|
font.bold: true
|
|
}
|
|
}
|
|
|
|
Column {
|
|
anchors {
|
|
left: icon.right
|
|
leftMargin: Theme.spacingM
|
|
right: root.discovered ? tag.left : parent.right
|
|
rightMargin: Theme.spacingM
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
|
|
Text {
|
|
width: parent.width
|
|
text: root.name
|
|
color: root.highlighted ? Theme.textOnFocus : Theme.text
|
|
font.pixelSize: Theme.fontBody
|
|
font.bold: true
|
|
elide: Text.ElideRight
|
|
}
|
|
|
|
Text {
|
|
width: parent.width
|
|
text: root.address
|
|
color: root.highlighted ? Theme.textOnFocusMuted : Theme.textMuted
|
|
font.pixelSize: Theme.fontSmall
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
id: tag
|
|
visible: root.discovered
|
|
anchors {
|
|
right: parent.right
|
|
rightMargin: Theme.spacingM
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
width: tagText.implicitWidth + Theme.spacingM
|
|
height: tagText.implicitHeight + Theme.spacingS
|
|
radius: height / 2
|
|
color: Theme.accentAlt
|
|
|
|
Text {
|
|
id: tagText
|
|
anchors.centerIn: parent
|
|
text: "Réseau local"
|
|
color: Theme.text
|
|
font.pixelSize: Theme.fontSmall
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: root.clicked()
|
|
}
|
|
}
|