2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-02-10 20:37:17 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import "../../../imports"
|
|
|
|
import "../../../shared"
|
|
|
|
import "../../../shared/status"
|
|
|
|
import "./ContactsColumn"
|
2020-12-11 20:38:10 +00:00
|
|
|
import "./CommunityComponents"
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-03-26 17:57:30 +00:00
|
|
|
Rectangle {
|
2020-12-11 20:29:46 +00:00
|
|
|
// TODO unhardcode
|
|
|
|
property int chatGroupsListViewCount: channelList.channelListCount
|
2021-06-02 19:43:33 +00:00
|
|
|
property Component pinnedMessagesPopupComponent
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
|
|
id: root
|
2021-03-26 17:57:30 +00:00
|
|
|
color: Style.current.secondaryMenuBackground
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: createChannelPopup
|
|
|
|
CreateChannelPopup {
|
2021-06-02 19:43:33 +00:00
|
|
|
pinnedMessagesPopupComponent: root.pinnedMessagesPopupComponent
|
2020-12-11 20:29:46 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-16 15:16:42 +00:00
|
|
|
Component {
|
|
|
|
id: createCategoryPopup
|
|
|
|
CreateCategoryPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-28 19:03:41 +00:00
|
|
|
Component {
|
|
|
|
id: transferOwnershipPopup
|
|
|
|
TransferOwnershipPopup {}
|
|
|
|
}
|
|
|
|
|
2021-06-25 09:13:54 +00:00
|
|
|
CommunityProfilePopup {
|
|
|
|
id: communityProfilePopup
|
|
|
|
communityId: chatsModel.communities.activeCommunity.id
|
|
|
|
name: chatsModel.communities.activeCommunity.name
|
|
|
|
description: chatsModel.communities.activeCommunity.description
|
|
|
|
access: chatsModel.communities.activeCommunity.access
|
|
|
|
nbMembers: chatsModel.communities.activeCommunity.nbMembers
|
|
|
|
isAdmin: chatsModel.communities.activeCommunity.admin
|
|
|
|
source: chatsModel.communities.activeCommunity.thumbnailImage
|
|
|
|
communityColor: chatsModel.communities.activeCommunity.communityColor
|
|
|
|
}
|
|
|
|
|
|
|
|
PopupMenu {
|
|
|
|
id: optionsMenu
|
|
|
|
|
|
|
|
Action {
|
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
|
|
|
//% "Create channel"
|
|
|
|
text: qsTrId("create-channel")
|
|
|
|
icon.source: "../../img/hash.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
enabled: chatsModel.communities.activeCommunity.admin
|
|
|
|
text: qsTr("Create category")
|
|
|
|
icon.source: "../../img/create-category.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
text: qsTr("Invite People")
|
|
|
|
enabled: chatsModel.communities.activeCommunity.canManageUsers
|
|
|
|
icon.source: "../../img/export.svg"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
|
|
|
}
|
|
|
|
|
|
|
|
onAboutToHide: {
|
|
|
|
optionsBtn.state = "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Item {
|
|
|
|
id: communityHeader
|
|
|
|
width: parent.width
|
2020-12-15 16:04:19 +00:00
|
|
|
height: communityHeaderButton.height
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 12
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
|
2020-12-15 16:04:19 +00:00
|
|
|
CommunityHeaderButton {
|
|
|
|
id: communityHeaderButton
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.left: parent.left
|
2020-12-15 16:04:19 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: -4
|
2021-06-24 10:40:51 +00:00
|
|
|
width: parent.width - optionsBtn.width - optionsBtn.anchors.rightMargin
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-03-04 16:16:22 +00:00
|
|
|
StatusRoundButton {
|
2020-12-11 20:29:46 +00:00
|
|
|
id: optionsBtn
|
2021-03-04 16:16:22 +00:00
|
|
|
pressedIconRotation: 45
|
|
|
|
icon.name: "plusSign"
|
|
|
|
size: "medium"
|
2021-03-16 19:19:48 +00:00
|
|
|
type: "secondary"
|
2021-03-04 16:16:22 +00:00
|
|
|
width: 36
|
|
|
|
height: 36
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.bigPadding
|
2021-03-04 16:16:22 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 8
|
2021-04-20 09:13:36 +00:00
|
|
|
visible: chatsModel.communities.activeCommunity.admin
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-03-04 16:16:22 +00:00
|
|
|
onClicked: {
|
|
|
|
optionsBtn.state = "pressed"
|
2021-05-16 15:16:42 +00:00
|
|
|
|
2021-06-25 09:13:54 +00:00
|
|
|
let x = optionsBtn.iconX + optionsBtn.icon.width / 2 - optionsMenu.width / 2
|
|
|
|
let y = optionsBtn.height + 4
|
2021-05-16 15:16:42 +00:00
|
|
|
|
2021-06-25 09:13:54 +00:00
|
|
|
let point = optionsBtn.mapToItem(root, x, y)
|
2021-04-01 18:34:45 +00:00
|
|
|
|
2021-06-25 09:13:54 +00:00
|
|
|
optionsMenu.popup(point.x, point.y)
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-04 18:39:36 +00:00
|
|
|
Item {
|
|
|
|
id: descriptionItem
|
|
|
|
height: childrenRect.height
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 18
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.top: communityHeader.bottom
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: listImg
|
|
|
|
source: "../../img/community-list.svg"
|
|
|
|
width: 15
|
|
|
|
height: 15
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: chatsModel.communities.activeCommunity.description
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: 13
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: listImg.right
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-11 19:06:39 +00:00
|
|
|
Loader {
|
|
|
|
id: membershipRequestsLoader
|
2021-02-10 20:37:17 +00:00
|
|
|
width: parent.width
|
2021-02-11 20:37:31 +00:00
|
|
|
active: chatsModel.communities.activeCommunity.admin
|
2021-05-04 18:39:36 +00:00
|
|
|
anchors.top: descriptionItem.bottom
|
|
|
|
anchors.topMargin: active ? Style.current.halfPadding : 0
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-02-11 19:06:39 +00:00
|
|
|
sourceComponent: Component {
|
|
|
|
MembershipRequestsButton {}
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MembershipRequestsPopup {
|
|
|
|
id: membershipRequestPopup
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
id: chatGroupsContainer
|
2021-02-11 19:06:39 +00:00
|
|
|
anchors.top: membershipRequestsLoader.bottom
|
2020-12-11 20:29:46 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
rightPadding: Style.current.halfPadding
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
2021-06-25 09:13:54 +00:00
|
|
|
contentHeight: categoryList.height
|
|
|
|
+ channelList.height
|
|
|
|
+ emptyViewAndSuggestionsLoader.height
|
|
|
|
+ backUpBannerLoader.height
|
|
|
|
+ 2 * Style.current.padding
|
2020-12-11 20:29:46 +00:00
|
|
|
clip: true
|
|
|
|
|
2021-06-25 09:13:54 +00:00
|
|
|
background: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
let x = mouse.x + 4
|
|
|
|
let y = mouse.y + 4
|
|
|
|
|
|
|
|
let point = chatGroupsContainer.mapToItem(root, x, y)
|
|
|
|
|
|
|
|
optionsMenu.popup(point.x, point.y)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
ChannelList {
|
|
|
|
id: channelList
|
|
|
|
searchStr: ""
|
2021-05-16 15:16:42 +00:00
|
|
|
categoryId: ""
|
2021-02-11 20:37:31 +00:00
|
|
|
channelModel: chatsModel.communities.activeCommunity.chats
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-05-16 15:16:42 +00:00
|
|
|
CategoryList {
|
|
|
|
id: categoryList
|
|
|
|
anchors.top: channelList.bottom
|
|
|
|
categoryModel: chatsModel.communities.activeCommunity.categories
|
|
|
|
}
|
|
|
|
|
2021-04-28 19:03:41 +00:00
|
|
|
Loader {
|
|
|
|
id: emptyViewAndSuggestionsLoader
|
2021-04-29 14:48:16 +00:00
|
|
|
active: chatsModel.communities.activeCommunity.admin && !appSettings.hiddenCommunityWelcomeBanners.includes(chatsModel.communities.activeCommunity.id)
|
2020-12-11 20:29:46 +00:00
|
|
|
width: parent.width
|
2021-04-28 19:03:41 +00:00
|
|
|
height: active ? item.height : 0
|
2021-05-16 15:16:42 +00:00
|
|
|
anchors.top: categoryList.bottom
|
2021-04-28 19:03:41 +00:00
|
|
|
anchors.topMargin: active ? Style.current.padding : 0
|
|
|
|
sourceComponent: Component {
|
|
|
|
CommunityWelcomeBanner {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Loader {
|
|
|
|
id: backUpBannerLoader
|
2021-04-29 14:48:16 +00:00
|
|
|
active: chatsModel.communities.activeCommunity.admin && !appSettings.hiddenCommunityBackUpBanners.includes(chatsModel.communities.activeCommunity.id)
|
2021-04-28 19:03:41 +00:00
|
|
|
width: parent.width
|
|
|
|
height: active ? item.height : 0
|
|
|
|
anchors.top: emptyViewAndSuggestionsLoader.bottom
|
|
|
|
anchors.topMargin: active ? Style.current.padding : 0
|
|
|
|
sourceComponent: Component {
|
|
|
|
BackUpCommuntyBanner {}
|
|
|
|
}
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|