2021-07-06 18:41:26 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-01 18:58:36 +03:00
|
|
|
|
|
|
|
import "../../controls"
|
2021-07-06 18:41:26 -04:00
|
|
|
|
2021-11-30 13:27:08 +01:00
|
|
|
import StatusQ.Core 0.1
|
2021-09-21 17:29:32 +02:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
2021-07-22 17:53:19 +03:00
|
|
|
Item {
|
2021-07-06 18:41:26 -04:00
|
|
|
id: root
|
2021-07-22 17:53:19 +03:00
|
|
|
anchors.fill: parent
|
2021-11-30 15:49:45 +01:00
|
|
|
|
|
|
|
// Important:
|
2021-12-09 13:53:40 +01:00
|
|
|
// Each chat/channel has its own ChatContentModule and each ChatContentModule has a single usersModule
|
2021-11-30 15:49:45 +01:00
|
|
|
// usersModule on the backend contains everything needed for this component
|
|
|
|
property var usersModule
|
2021-09-01 19:38:39 +02:00
|
|
|
property var messageContextMenu
|
2021-07-22 17:53:19 +03:00
|
|
|
|
2021-11-30 13:27:08 +01:00
|
|
|
StatusBaseText {
|
2021-07-22 17:53:19 +03:00
|
|
|
id: titleText
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2021-08-26 15:04:47 +03:00
|
|
|
opacity: (root.width > 58) ? 1.0 : 0.0
|
2021-07-22 17:53:19 +03:00
|
|
|
visible: (opacity > 0.1)
|
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
2021-11-30 13:27:08 +01:00
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Theme.palette.directColor1
|
2021-07-30 12:02:22 -04:00
|
|
|
//% "Members"
|
|
|
|
text: qsTrId("members-label")
|
2021-07-22 17:53:19 +03:00
|
|
|
}
|
2021-07-06 18:41:26 -04:00
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: userListView
|
2021-07-27 11:51:32 +03:00
|
|
|
clip: true
|
2021-09-21 16:13:17 +03:00
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
|
|
policy: ScrollBar.AsNeeded
|
|
|
|
}
|
2021-07-22 17:53:19 +03:00
|
|
|
anchors {
|
|
|
|
top: titleText.bottom
|
|
|
|
topMargin: Style.current.padding
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: Style.current.bigPadding
|
|
|
|
}
|
2021-07-06 18:41:26 -04:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2021-11-30 15:49:45 +01:00
|
|
|
model: usersModule.model
|
|
|
|
delegate: UserDelegate {
|
|
|
|
publicKey: model.id
|
|
|
|
name: model.name
|
2021-12-14 15:19:55 +01:00
|
|
|
icon: model.icon
|
2021-11-30 15:49:45 +01:00
|
|
|
isIdenticon: model.isIdenticon
|
|
|
|
userStatus: model.onlineStatus
|
|
|
|
messageContextMenu: root.messageContextMenu
|
2021-08-18 12:33:49 +03:00
|
|
|
}
|
2021-11-30 15:49:45 +01:00
|
|
|
section.property: "onlineStatus"
|
|
|
|
section.delegate: (root.width > 58) ? sectionDelegateComponent : null
|
2021-07-06 18:41:26 -04:00
|
|
|
}
|
2021-11-30 15:49:45 +01:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: sectionDelegateComponent
|
|
|
|
Item {
|
|
|
|
width: parent.width
|
|
|
|
height: 24
|
|
|
|
StyledText {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: Style.current.additionalTextSize
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
text: model.onlineStatus === Constants.userStatus.online? qsTr("Online") : qsTr("Offline")
|
2021-07-06 18:41:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-22 17:53:19 +03:00
|
|
|
}
|