status-desktop/ui/app/AppLayouts/Chat/components/PublicChatPopup.qml

103 lines
2.9 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../imports"
import "../../../../shared"
import "../data/channelList.js" as ChannelJSON
import "./"
2020-05-29 16:27:50 +00:00
ModalPopup {
function doJoin() {
if(channelName.text === "") return;
chatsModel.joinChat(channelName.text, Constants.chatTypePublic);
popup.close();
}
id: popup
//% "Join public chat"
title: qsTrId("new-public-group-chat")
2020-05-29 18:38:11 +00:00
onOpened: {
channelName.text = "";
channelName.forceActiveFocus(Qt.MouseFocusReason)
}
2020-05-29 16:27:50 +00:00
Row {
id: description
Layout.fillHeight: false
Layout.fillWidth: true
width: parent.width
StyledText {
2020-06-04 14:53:10 +00:00
width: parent.width
2020-05-29 16:27:50 +00:00
font.pixelSize: 15
//% "A public chat is where you get to hang out with others, make friends and talk about subjects of your interest."
text: qsTrId("a-public-chat-is-where-you-get-to-hang-out-with-others,-make-friends-and-talk-about-subjects-of-your-interest.")
2020-05-29 16:27:50 +00:00
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignTop
}
2020-05-29 16:27:50 +00:00
}
Input {
id: channelName
2020-05-29 16:27:50 +00:00
anchors.top: description.bottom
anchors.topMargin: Style.current.padding
//% "chat-name"
placeholderText: qsTrId("chat-name")
Keys.onEnterPressed: doJoin()
Keys.onReturnPressed: doJoin()
icon: "../../../img/hash.svg"
2020-05-29 16:27:50 +00:00
}
ScrollView {
id: sview
2020-09-23 16:49:08 +00:00
clip: true
anchors.top: channelName.bottom
anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
Layout.fillHeight: true
Layout.fillWidth: true
2020-09-23 16:49:08 +00:00
contentHeight: {
var totalHeight = 0
for (let i = 0; i < sectionRepeater.count; i++) {
totalHeight += sectionRepeater.itemAt(i).height + Style.current.padding
}
return totalHeight + Style.current.padding
}
Item {
width: parent.width
SuggestedChannels {
id: sectionRepeater
}
}
2020-05-29 16:27:50 +00:00
}
2020-05-29 16:27:50 +00:00
footer: Button {
width: 44
height: 44
anchors.bottom: parent.bottom
anchors.right: parent.right
background: Rectangle {
color: "transparent"
}
SVGImage {
2020-05-29 16:27:50 +00:00
source: channelName.text == "" ? "../../../img/arrow-button-inactive.svg" : "../../../img/arrow-btn-active.svg"
width: 50
height: 50
2020-05-29 16:27:50 +00:00
}
MouseArea {
id: btnMAJoinChat
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked : doJoin()
}
}
}