Revert "ui: introduce identicons in channel/contacts list"
This reverts commit 9e69e24379
.
This commit is contained in:
parent
9e69e24379
commit
567445ea30
|
@ -29,8 +29,6 @@ type
|
||||||
LastMessage = UserRole + 2
|
LastMessage = UserRole + 2
|
||||||
Timestamp = UserRole + 3
|
Timestamp = UserRole + 3
|
||||||
UnreadMessages = UserRole + 4
|
UnreadMessages = UserRole + 4
|
||||||
Identicon = UserRole + 5
|
|
||||||
ChatType = UserRole + 6
|
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -62,18 +60,13 @@ QtObject:
|
||||||
of ChannelsRoles.Timestamp: result = newQVariant($chatItem.timestamp)
|
of ChannelsRoles.Timestamp: result = newQVariant($chatItem.timestamp)
|
||||||
of ChannelsRoles.LastMessage: result = newQVariant(chatItem.lastMessage)
|
of ChannelsRoles.LastMessage: result = newQVariant(chatItem.lastMessage)
|
||||||
of ChannelsRoles.UnreadMessages: result = newQVariant(chatItem.unviewedMessagesCount)
|
of ChannelsRoles.UnreadMessages: result = newQVariant(chatItem.unviewedMessagesCount)
|
||||||
of ChannelsRoles.Identicon: result = newQVariant(chatItem.identicon)
|
|
||||||
of ChannelsRoles.ChatType: result = newQVariant(chatItem.chatType.int)
|
|
||||||
|
|
||||||
method roleNames(self: ChannelsList): Table[int, string] =
|
method roleNames(self: ChannelsList): Table[int, string] =
|
||||||
{
|
{
|
||||||
ChannelsRoles.Name.int:"name",
|
ChannelsRoles.Name.int:"name",
|
||||||
ChannelsRoles.Timestamp.int:"timestamp",
|
ChannelsRoles.Timestamp.int:"timestamp",
|
||||||
ChannelsRoles.LastMessage.int: "lastMessage",
|
ChannelsRoles.LastMessage.int: "lastMessage",
|
||||||
ChannelsRoles.UnreadMessages.int: "unviewedMessagesCount",
|
ChannelsRoles.UnreadMessages.int: "unviewedMessagesCount"
|
||||||
ChannelsRoles.Identicon.int: "identicon",
|
|
||||||
ChannelsRoles.ChatType.int: "chatType"
|
|
||||||
|
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
proc addChatItemToList*(self: ChannelsList, channel: ChatItem): int =
|
proc addChatItemToList*(self: ChannelsList, channel: ChatItem): int =
|
||||||
|
|
|
@ -8,14 +8,12 @@ type ChatItem* = ref object
|
||||||
timestamp*: int64
|
timestamp*: int64
|
||||||
unviewedMessagesCount*: int
|
unviewedMessagesCount*: int
|
||||||
color*: string
|
color*: string
|
||||||
identicon*: string
|
|
||||||
|
|
||||||
proc newChatItem*(): ChatItem =
|
proc newChatItem*(): ChatItem =
|
||||||
new(result)
|
new(result)
|
||||||
result.name = ""
|
result.name = ""
|
||||||
result.lastMessage = ""
|
result.lastMessage = ""
|
||||||
result.timestamp = 0
|
result.timestamp = 0
|
||||||
result.identicon = ""
|
|
||||||
result.unviewedMessagesCount = 0
|
result.unviewedMessagesCount = 0
|
||||||
result.color = ""
|
result.color = ""
|
||||||
|
|
||||||
|
@ -41,6 +39,5 @@ proc toChatItem*(chat: Chat): ChatItem =
|
||||||
chatType: chat.chatType,
|
chatType: chat.chatType,
|
||||||
lastMessage: chat.lastMessage.text,
|
lastMessage: chat.lastMessage.text,
|
||||||
timestamp: chat.timestamp,
|
timestamp: chat.timestamp,
|
||||||
identicon: chat.lastMessage.identicon,
|
|
||||||
unviewedMessagesCount: chat.unviewedMessagesCount
|
unviewedMessagesCount: chat.unviewedMessagesCount
|
||||||
)
|
)
|
||||||
|
|
|
@ -40,6 +40,9 @@ StackLayout {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Theme.smallPadding
|
anchors.topMargin: Theme.smallPadding
|
||||||
color: {
|
color: {
|
||||||
|
if (!chatsModel.activeChannel) {
|
||||||
|
return Theme.transparent
|
||||||
|
}
|
||||||
const color = chatsModel.getChannelColor(chatsModel.activeChannel)
|
const color = chatsModel.getChannelColor(chatsModel.activeChannel)
|
||||||
if (!color) {
|
if (!color) {
|
||||||
return Theme.transparent
|
return Theme.transparent
|
||||||
|
|
|
@ -418,114 +418,6 @@ Item {
|
||||||
anchors.rightMargin: Theme.padding
|
anchors.rightMargin: Theme.padding
|
||||||
color: Theme.blue
|
color: Theme.blue
|
||||||
visible: unviewedMessagesCount > 0
|
visible: unviewedMessagesCount > 0
|
||||||
anchors.top: applicationWindow.top
|
|
||||||
anchors.topMargin: 0
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.padding
|
|
||||||
radius: 8
|
|
||||||
// Hide the box if it is filtered out
|
|
||||||
property bool isVisible: searchStr == "" || name.includes(searchStr)
|
|
||||||
visible: isVisible ? true : false
|
|
||||||
height: isVisible ? 64 : 0
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
cursorShape: Qt.PointingHandCursor;
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
chatsModel.setActiveChannelByIndex(index)
|
|
||||||
chatGroupsListView.currentIndex = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: contactImage
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.padding
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 12
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: 12
|
|
||||||
radius: 50
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
sourceComponent: chatType == 1 ? imageIdenticon : letterIdenticon
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: letterIdenticon
|
|
||||||
Rectangle {
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
radius: 50
|
|
||||||
color: {
|
|
||||||
const color = chatsModel.getChannelColor(name)
|
|
||||||
if (!color) {
|
|
||||||
return Theme.transparent
|
|
||||||
}
|
|
||||||
return color
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: (name.charAt(0) == "#" ? name.charAt(1) : name.charAt(0)).toUpperCase()
|
|
||||||
opacity: 0.7
|
|
||||||
font.weight: Font.Bold
|
|
||||||
font.pixelSize: 21
|
|
||||||
color: "white"
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: imageIdenticon
|
|
||||||
Rectangle {
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
radius: 50
|
|
||||||
border.color: "#10000000"
|
|
||||||
border.width: 1
|
|
||||||
color: Theme.transparent
|
|
||||||
Image {
|
|
||||||
width: 40
|
|
||||||
height: 40
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
source: identicon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: contactInfo
|
|
||||||
text: chatType == 1 ? name : "#" + name
|
|
||||||
anchors.right: contactTime.left
|
|
||||||
anchors.rightMargin: Theme.smallPadding
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.weight: Font.Medium
|
|
||||||
font.pixelSize: 15
|
|
||||||
anchors.left: contactImage.right
|
|
||||||
anchors.leftMargin: Theme.padding
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: Theme.smallPadding
|
|
||||||
color: "black"
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
id: lastChatMessage
|
|
||||||
text: lastMessage || qsTr("No messages")
|
|
||||||
anchors.right: contactNumberChatsCircle.left
|
|
||||||
anchors.rightMargin: Theme.smallPadding
|
|
||||||
elide: Text.ElideRight
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: Theme.smallPadding
|
|
||||||
font.pixelSize: 15
|
|
||||||
anchors.left: contactImage.right
|
|
||||||
anchors.leftMargin: Theme.padding
|
|
||||||
color: Theme.darkGrey
|
|
||||||
}
|
|
||||||
Text {
|
Text {
|
||||||
id: contactNumberChats
|
id: contactNumberChats
|
||||||
text: unviewedMessagesCount
|
text: unviewedMessagesCount
|
||||||
|
|
Loading…
Reference in New Issue