Refactor to show recv time and last messages bit little

This commit is contained in:
Angela Mazzurco 2017-06-06 16:07:55 +02:00
parent 287e34c65f
commit 85724a39eb

View File

@ -92,10 +92,16 @@ Item
{
height: parent.height
width: parent.width
width: parent.width - (isContactIcon.width *3.5)
anchors.left: colorHash.right
anchors.leftMargin: 5
Item
{
width: parent.width
height: parent.height /2
Text
{
id: nickText
@ -104,22 +110,68 @@ Item
font.bold: true
}
Row
Text
{
// text: (lastMessageData.recv_time)? Date.fromLocaleDateString(locale, lastMessageData.recv_time, "ddd yyyy-MM-dd hh:mm:ss"): "sad"
text: setTime()
font.italic: true
anchors.right: parent.right
}
}
Item
{
id: lastMessageText
width: parent.width
height: parent.height /2
Text
{
id: lastMessageSender
font.italic: true
color: "dodgerblue"
text: (!lastMessageData.incoming && lastMessageData.msg)? "You: " : ""
maximumLineCount: 1
elide:Text.ElideRight
wrapMode: Text.WordWrap
}
Text
{
id: lastMessageMsg
text: (lastMessageData.msg) ? lastMessageData.msg : ""
font.italic: true
rightPadding: 5
// maximumLineCount: 1
// elide:Text.ElideRight
// wrapMode: Text.WordWrap
}
Rectangle
{
visible: model.unread_count > 0
color: "cornflowerblue"
antialiasing: true
// border.color: "blue"
// border.width: 1
height: parent.height - 2
radius: height/2
width: height
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
Text
{
color: "white"
font.bold: true
text: model.unread_count
anchors.centerIn: parent
}
}
}
@ -128,6 +180,7 @@ Item
Row
{
anchors.right: parent.right
@ -136,27 +189,7 @@ Item
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
{
@ -166,6 +199,8 @@ Item
height: parent.height - 4
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
id: isContactIcon
}
}
}
@ -177,7 +212,8 @@ Item
chatId = getChatIdFromGXS()
}
if (chatId) {
lastMessageData = getChatLastMessage(chatId)
var last = getChatLastMessage(chatId)
if (last) lastMessageData = getChatLastMessage(chatId)
}
}