Show user hash in chat view

This commit is contained in:
Angela Mazzurco 2017-06-12 16:14:47 +02:00
parent fbb458f4c3
commit 8b0b366f69
2 changed files with 41 additions and 9 deletions

View File

@ -22,10 +22,12 @@ import QtQuick.Layouts 1.2
import org.retroshare.qml_components.LibresapiLocalClient 1.0 import org.retroshare.qml_components.LibresapiLocalClient 1.0
import "." //Needed for TokensManager singleton import "." //Needed for TokensManager singleton
import "./components" import "./components"
Item Item
{ {
id: chatView id: chatView
property string chatId property string chatId
property var gxsInfo: ""
property int token: 0 property int token: 0
property string objectName:"chatView" property string objectName:"chatView"
@ -55,11 +57,32 @@ Item
Component.onCompleted: { Component.onCompleted: {
refreshData() refreshData()
toolBar.state = "CHATVIEW" toolBar.state = "CHATVIEW"
var gxs = ChatCache.lastMessageCache.getGxsFromChatId(chatView.chatId) gxsInfo= ChatCache.lastMessageCache.getGxsFromChatId(chatView.chatId)
toolBar.titleText = gxs.name toolBar.titleText = gxsInfo.name
toolBar.loaderSource = userHash
} }
onFocusChanged: focus && refreshData() onFocusChanged: focus && refreshData()
Component {
id: userHash
ColorHash
{
id: colorHash
hash: gxsInfo.gxs
height: toolBar.height - 4
anchors.leftMargin: 2
MouseArea
{
anchors.fill: parent
onClicked: delegateRoot.showDetails()
}
}
}
JSONListModel JSONListModel
{ {
id: chatModel id: chatModel

View File

@ -58,31 +58,40 @@ ApplicationWindow
{ {
id: toolBar id: toolBar
property alias titleText: toolBarText.text property alias titleText: toolBarText.text
property alias loaderSource: imageLoader.sourceComponent
property string defaultLabel: "RetroShare" property string defaultLabel: "RetroShare"
states: [ states: [
State { State {
name: "DEFAULT" name: "DEFAULT"
PropertyChanges { target: toolBar; titleText: defaultLabel} PropertyChanges { target: toolBar; titleText: defaultLabel}
PropertyChanges { target: toolBar; loaderSource: rsIcon}
}, },
State { State {
name: "CHATVIEW" name: "CHATVIEW"
} }
] ]
Image Loader {
{ id: imageLoader
id: rsIcon
fillMode: Image.PreserveAspectFit
height: Math.max(30, parent.height - 4)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
source: "icons/retroshare06.png" height: Math.max(30, toolBar.height - 4)
} }
Component {
id: rsIcon
Image
{
fillMode: Image.PreserveAspectFit
source: "icons/retroshare06.png"
}
}
Label Label
{ {
id: toolBarText id: toolBarText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: rsIcon.right anchors.left: imageLoader.right
anchors.leftMargin: 20 anchors.leftMargin: 20
} }
MouseArea MouseArea