mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-18 05:44:14 -05:00
Change to Almman indent style
This commit is contained in:
parent
4b05555a5c
commit
7c6638f4e9
@ -4,7 +4,8 @@ import QtQuick.Controls 2.0
|
||||
import "." // To load styles
|
||||
import "./components"
|
||||
|
||||
Item {
|
||||
Item
|
||||
{
|
||||
|
||||
id: chatBubbleDelegate
|
||||
height: bubble.height
|
||||
@ -13,7 +14,8 @@ Item {
|
||||
property var styles: StyleChat.bubble
|
||||
|
||||
|
||||
Rectangle {
|
||||
Rectangle
|
||||
{
|
||||
id: rootBubble
|
||||
anchors.fill: parent
|
||||
width: parent.width
|
||||
@ -37,7 +39,8 @@ Item {
|
||||
radius: styles.radius
|
||||
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
id: sendersName
|
||||
visible: model.incoming
|
||||
text: (model.incoming)? model.author_name + ":" : ""
|
||||
@ -57,7 +60,8 @@ Item {
|
||||
mesageText.implicitWidth >= (rootBubble.width * styles.bubbleMaxWidth) )? implicitHeight : 0
|
||||
}
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
id: timeText
|
||||
text: getMessageTime()
|
||||
color: styles.colorMessageTime
|
||||
@ -73,7 +77,8 @@ Item {
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
id: mesageText
|
||||
text: model.msg
|
||||
width: rootBubble.width * styles.bubbleMaxWidth + timeText.width
|
||||
@ -96,8 +101,8 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
function getMessageTime(){
|
||||
|
||||
function getMessageTime()
|
||||
{
|
||||
var timeFormat = "hh:mm";
|
||||
var recvDate = new Date(model.recv_time*1000)
|
||||
|
||||
|
@ -5,7 +5,8 @@ import QtQuick.Controls 2.0
|
||||
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
||||
import Qt.labs.settings 1.0
|
||||
|
||||
QtObject {
|
||||
QtObject
|
||||
{
|
||||
|
||||
id: chatCache
|
||||
|
||||
@ -17,7 +18,8 @@ QtObject {
|
||||
signal lastMessageChanged(var chatI, var newLastMessage)
|
||||
|
||||
|
||||
function updateLastMessageCache (chatId, chatModel){
|
||||
function updateLastMessageCache (chatId, chatModel)
|
||||
{
|
||||
console.log("updateLastMessageCache (chatId, chatModel)", chatId)
|
||||
// First creates the chat id object for don't wait to work with the object if is needed to call RS api
|
||||
if (!lastMessageList[chatId]) {
|
||||
@ -33,24 +35,28 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
function updateLastMessage (chatId, chatModel){
|
||||
function updateLastMessage (chatId, chatModel)
|
||||
{
|
||||
console.log("updateLastMessage (chatId, chatModel)")
|
||||
var lastMessage = findChatLastMessage (chatModel)
|
||||
lastMessageList[chatId].lastMessage = lastMessage
|
||||
lastMessageChanged(chatId, lastMessage)
|
||||
}
|
||||
|
||||
function findChatLastMessage (chatModel){
|
||||
function findChatLastMessage (chatModel)
|
||||
{
|
||||
var messagesData = JSON.parse(chatModel).data
|
||||
return messagesData.slice(-1)[0]
|
||||
}
|
||||
|
||||
function findChatFirstMessage (chatModel){
|
||||
function findChatFirstMessage (chatModel)
|
||||
{
|
||||
var messagesData = JSON.parse(chatModel).data
|
||||
return messagesData.slice[0]
|
||||
}
|
||||
|
||||
function setRemoteGXS (chatId, remoteGXS){
|
||||
function setRemoteGXS (chatId, remoteGXS)
|
||||
{
|
||||
if (!lastMessageList[chatId]) {
|
||||
lastMessageList[chatId] = {}
|
||||
console.log("Last message cache created!")
|
||||
@ -64,7 +70,8 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
function getChatIdFromGxs (gxs){
|
||||
function getChatIdFromGxs (gxs)
|
||||
{
|
||||
for (var key in lastMessageList) {
|
||||
if ( lastMessageList[key].remoteGXS &&
|
||||
lastMessageList[key].remoteGXS.gxs === gxs ) {
|
||||
@ -74,12 +81,14 @@ QtObject {
|
||||
return ""
|
||||
}
|
||||
|
||||
function getGxsFromChatId (chatId){
|
||||
function getGxsFromChatId (chatId)
|
||||
{
|
||||
if (lastMessageList[chatId]) return lastMessageList[chatId].remoteGXS
|
||||
return undefined
|
||||
}
|
||||
|
||||
function getChatLastMessage (chatId){
|
||||
function getChatLastMessage (chatId)
|
||||
{
|
||||
if (lastMessageList[chatId]) {
|
||||
return lastMessageList[chatId].lastMessage
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ Item
|
||||
TokensManager.registerToken(json.statetoken, refreshUnread)
|
||||
contactsSortWorker.sendMessage(
|
||||
{'action': 'refreshUnread', 'response': par.response})
|
||||
json.data.forEach (function (chat){
|
||||
json.data.forEach (function (chat)
|
||||
{
|
||||
ChatCache.lastMessageCache.updateLastMessageCache(chat.chat_id)
|
||||
ChatCache.lastMessageCache.setRemoteGXS (chat.chat_id, { gxs: chat.remote_author_id, name: chat.remote_author_name})
|
||||
})
|
||||
@ -176,13 +177,14 @@ Item
|
||||
width: parent.width - searchIcon.width - 5
|
||||
anchors.leftMargin: 5
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
border.width: 2
|
||||
radius: 5
|
||||
border.color: searchText.focus ? "cornflowerblue" : "lightgrey"
|
||||
color: searchText.focus ? "white" : "ghostwhite"
|
||||
|
||||
}
|
||||
|
||||
onTextChanged:
|
||||
contactsSortWorker.sendMessage(
|
||||
{'action': 'searchContact', 'sexp': text})
|
||||
|
@ -33,14 +33,14 @@ Item
|
||||
property var locale: Qt.locale()
|
||||
|
||||
|
||||
Rectangle {
|
||||
Rectangle
|
||||
{
|
||||
|
||||
anchors.fill: parent
|
||||
color: contactItem.containsMouse ? "lightgrey" : "transparent"
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: contactItem
|
||||
@ -117,11 +117,7 @@ Item
|
||||
text: setTime()
|
||||
anchors.right: parent.right
|
||||
color: "darkslategrey"
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Item
|
||||
@ -130,8 +126,6 @@ Item
|
||||
width: parent.width
|
||||
height: parent.height /2
|
||||
|
||||
|
||||
|
||||
Text
|
||||
{
|
||||
id: lastMessageSender
|
||||
@ -204,7 +198,8 @@ Item
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
Component.onCompleted:
|
||||
{
|
||||
if (!chatId){
|
||||
chatId = getChatIdFromGXS()
|
||||
}
|
||||
@ -214,7 +209,8 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
Connections
|
||||
{
|
||||
target: ChatCache.lastMessageCache
|
||||
onLastMessageChanged: {
|
||||
if (!chatId) {
|
||||
@ -228,23 +224,26 @@ Item
|
||||
}
|
||||
|
||||
|
||||
function getChatLastMessage (chatId){
|
||||
function getChatLastMessage (chatId)
|
||||
{
|
||||
return ChatCache.lastMessageCache.getChatLastMessage(chatId)
|
||||
}
|
||||
|
||||
function getChatIdFromGXS (){
|
||||
function getChatIdFromGXS ()
|
||||
{
|
||||
var id= ChatCache.lastMessageCache.getChatIdFromGxs(model.gxs_id)
|
||||
return ChatCache.lastMessageCache.getChatIdFromGxs(model.gxs_id)
|
||||
}
|
||||
function setTime(){
|
||||
if (!lastMessageData || lastMessageData.recv_time === undefined){
|
||||
return ""
|
||||
}
|
||||
function setTime()
|
||||
{
|
||||
if (!lastMessageData || lastMessageData.recv_time === undefined) return ""
|
||||
|
||||
var timeFormat = "dd.MM.yyyy";
|
||||
var recvDate = new Date(lastMessageData.recv_time*1000)
|
||||
|
||||
// Check if is today
|
||||
if ( new Date (lastMessageData.recv_time*1000).setHours(0,0,0,0) == new Date ().setHours(0,0,0,0)) {
|
||||
if ( new Date (lastMessageData.recv_time*1000).setHours(0,0,0,0) == new Date ().setHours(0,0,0,0))
|
||||
{
|
||||
timeFormat = "hh:mm"
|
||||
}
|
||||
var timeString = Qt.formatDateTime(recvDate, timeFormat)
|
||||
@ -259,7 +258,8 @@ Item
|
||||
"qrc:/ContactDetails.qml",
|
||||
{md: contactsListView.model.get(index)})
|
||||
}
|
||||
function startDistantChatCB (par){
|
||||
function startDistantChatCB (par)
|
||||
{
|
||||
var chId = JSON.parse(par.response).data.chat_id
|
||||
ChatCache.lastMessageCache.setRemoteGXS(chId, { gxs: model.gxs_id, name: model.name})
|
||||
contactsView.startChatCallback (par)
|
||||
|
@ -63,12 +63,14 @@ ApplicationWindow
|
||||
|
||||
states:
|
||||
[
|
||||
State {
|
||||
State
|
||||
{
|
||||
name: "DEFAULT"
|
||||
PropertyChanges { target: toolBar; titleText: defaultLabel}
|
||||
PropertyChanges { target: toolBar; loaderSource: rsIcon}
|
||||
},
|
||||
State {
|
||||
State
|
||||
{
|
||||
name: "CHATVIEW"
|
||||
}
|
||||
]
|
||||
@ -166,9 +168,12 @@ ApplicationWindow
|
||||
id: stackView
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
onCurrentItemChanged: {
|
||||
if (currentItem) {
|
||||
if (currentItem.objectName != "chatView" && toolBar.state != "DEFAULT"){
|
||||
onCurrentItemChanged:
|
||||
{
|
||||
if (currentItem)
|
||||
{
|
||||
if (currentItem.objectName != "chatView" && toolBar.state != "DEFAULT")
|
||||
{
|
||||
toolBar.state = "DEFAULT"
|
||||
}
|
||||
currentItem.focus = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user