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,34 +92,86 @@ Item
{ {
height: parent.height height: parent.height
width: parent.width width: parent.width - (isContactIcon.width *3.5)
anchors.left: colorHash.right anchors.left: colorHash.right
anchors.leftMargin: 5 anchors.leftMargin: 5
Text Item
{ {
id: nickText width: parent.width
color: model.own ? "blue" : "black" height: parent.height /2
text: model.name
font.bold: true
Text
{
id: nickText
color: model.own ? "blue" : "black"
text: model.name
font.bold: true
}
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
}
} }
Row Item
{ {
id: lastMessageText id: lastMessageText
width: parent.width width: parent.width
height: parent.height /2
Text Text
{ {
id: lastMessageSender id: lastMessageSender
font.italic: true font.italic: true
color: "dodgerblue" color: "dodgerblue"
text: (!lastMessageData.incoming && lastMessageData.msg)? "You: " : "" text: (!lastMessageData.incoming && lastMessageData.msg)? "You: " : ""
maximumLineCount: 1
elide:Text.ElideRight
wrapMode: Text.WordWrap
} }
Text Text
{ {
id: lastMessageMsg id: lastMessageMsg
text: (lastMessageData.msg) ? lastMessageData.msg : "" text: (lastMessageData.msg) ? lastMessageData.msg : ""
font.italic: true 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 Row
{ {
anchors.right: parent.right anchors.right: parent.right
@ -136,27 +189,7 @@ Item
height: parent.height - 10 height: parent.height - 10
spacing: 4 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 Image
{ {
@ -166,6 +199,8 @@ Item
height: parent.height - 4 height: parent.height - 4
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
id: isContactIcon
} }
} }
} }
@ -177,7 +212,8 @@ Item
chatId = getChatIdFromGXS() chatId = getChatIdFromGXS()
} }
if (chatId) { if (chatId) {
lastMessageData = getChatLastMessage(chatId) var last = getChatLastMessage(chatId)
if (last) lastMessageData = getChatLastMessage(chatId)
} }
} }