Style the trusted node details view

This commit is contained in:
Angela Mazzurco 2017-06-23 18:39:18 +02:00
parent fd38129b09
commit 666ae5ecf3
2 changed files with 73 additions and 7 deletions

View File

@ -18,6 +18,7 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import "components/."
Item Item
{ {
@ -25,19 +26,48 @@ Item
property string pgpName property string pgpName
property alias pgpId: pgpIdTxt.text property alias pgpId: pgpIdTxt.text
property bool isOnline
property string nodeCert property string nodeCert
property var locations property var locations
Image
{
id: nodeStatusImage
source: isOnline?
"icons/state-ok.png" :
"icons/state-offline.png"
fillMode: Image.PreserveAspectFit
anchors.top: parent.top
anchors.topMargin: 6
anchors.horizontalCenter: parent.horizontalCenter
}
Column Column
{ {
id: pgpColumn id: pgpColumn
anchors.top: parent.top anchors.top: nodeStatusImage.bottom
width: parent.width
Text { text: nodeDetailsRoot.pgpName.replace(" (Generated by RetroShare) <>", "") } Text
Text { id: pgpIdTxt } {
text: nodeDetailsRoot.pgpName.replace(" (Generated by RetroShare) <>", "")
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 20
}
Text
{
id: pgpIdTxt
anchors.horizontalCenter: parent.horizontalCenter
color: "darkslategrey"
}
} }
JSONListModel JSONListModel
@ -48,10 +78,36 @@ Item
ListView ListView
{ {
width: parent.width width: parent.width * .75
anchors.top: pgpColumn.bottom anchors.top: pgpColumn.bottom
anchors.topMargin: 5
anchors.bottom: buttonsRow.top anchors.bottom: buttonsRow.top
model: jsonModel.model model: jsonModel.model
anchors.horizontalCenter: parent.horizontalCenter
headerPositioning: ListView.OverlayHeader
clip: true
snapMode: ListView.SnapToItem
header:Rectangle
{
color: "aliceblue"
width: parent.width
z: 2
height: headetText.contentHeight + 10
radius: 10
Text
{
id: headetText
text: "Node locations ("+jsonModel.model.count+")"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.italic: true
}
}
delegate: Column delegate: Column
{ {
height: 60 height: 60
@ -61,8 +117,9 @@ Item
Row Row
{ {
id: idRow
height: 30 height: 30
spacing: 10 spacing: 4
Image Image
{ {
@ -83,7 +140,14 @@ Item
} }
} }
Text { text: model.peer_id } TextAndIcon
{
width: parent.width
innerText: model.peer_id
anchors.horizontalCenter: parent.horizontalCenter
iconUrl: "/icons/keyring.svg"
}
} }
} }

View File

@ -67,13 +67,14 @@ Item
model: jsonModel.model model: jsonModel.model
delegate: Item delegate: Item
{ {
property bool isOnline: jsonModel.isOnline(model.pgp_id)
height: 30 height: 30
width: parent.width width: parent.width
Image Image
{ {
id: statusImage id: statusImage
source: jsonModel.isOnline(model.pgp_id) ? source: isOnline?
"icons/state-ok.png" : "icons/state-ok.png" :
"icons/state-offline.png" "icons/state-offline.png"
@ -100,6 +101,7 @@ Item
{ {
pgpName: model.name, pgpName: model.name,
pgpId: model.pgp_id, pgpId: model.pgp_id,
isOnline: isOnline,
locations: jsonModel.getLocations( locations: jsonModel.getLocations(
model.pgp_id) model.pgp_id)
} }