2022-05-26 15:46:02 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.1
|
2022-07-08 14:21:20 +00:00
|
|
|
import QtQml.Models 2.14
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2022-10-21 11:27:08 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-05-26 15:46:02 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2022-07-08 14:21:20 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2022-07-08 14:21:20 +00:00
|
|
|
StatusDialog {
|
2022-05-26 15:46:02 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property string name
|
|
|
|
property string introMessage
|
2022-10-21 11:27:08 +00:00
|
|
|
property int accessType
|
2022-05-26 15:46:02 +00:00
|
|
|
property url imageSrc
|
2022-10-21 10:09:17 +00:00
|
|
|
property bool isInvitationPending: false
|
2022-05-26 15:46:02 +00:00
|
|
|
|
|
|
|
signal joined
|
2022-10-21 10:09:17 +00:00
|
|
|
signal cancelMembershipRequest
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-05-31 20:58:23 +00:00
|
|
|
padding: 0
|
2022-07-08 14:21:20 +00:00
|
|
|
title: qsTr("Welcome to %1").arg(name)
|
|
|
|
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
rightButtons: ObjectModel {
|
|
|
|
StatusButton {
|
2022-10-21 10:09:17 +00:00
|
|
|
text: root.isInvitationPending ? qsTr("Cancel Membership Request")
|
|
|
|
: (root.accessType === Constants.communityChatOnRequestAccess
|
|
|
|
? qsTr("Request to join %1").arg(root.name)
|
|
|
|
: qsTr("Join %1").arg(root.name) )
|
|
|
|
type: root.isInvitationPending ? StatusBaseButton.Type.Danger
|
|
|
|
: StatusBaseButton.Type.Normal
|
|
|
|
enabled: checkBox.checked || root.isInvitationPending
|
2023-02-17 10:25:48 +00:00
|
|
|
textFillWidth: true
|
2022-07-08 14:21:20 +00:00
|
|
|
onClicked: {
|
2022-10-21 10:09:17 +00:00
|
|
|
if (root.isInvitationPending) {
|
|
|
|
root.cancelMembershipRequest()
|
|
|
|
} else {
|
2023-02-03 12:27:42 +00:00
|
|
|
root.joined()
|
2022-10-21 10:09:17 +00:00
|
|
|
}
|
|
|
|
|
2022-07-08 14:21:20 +00:00
|
|
|
root.close()
|
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-08 14:21:20 +00:00
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-05-31 20:58:23 +00:00
|
|
|
StatusScrollView {
|
|
|
|
id: scrollView
|
|
|
|
anchors.fill: parent
|
2023-02-17 10:25:48 +00:00
|
|
|
implicitWidth: 640 // by design
|
2023-05-31 20:58:23 +00:00
|
|
|
contentWidth: availableWidth
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: columnContent
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
spacing: 24
|
2023-05-31 20:58:23 +00:00
|
|
|
width: scrollView.availableWidth
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
StatusRoundedImage {
|
|
|
|
id: roundImage
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: 64
|
|
|
|
Layout.preferredWidth: Layout.preferredHeight
|
|
|
|
visible: image.status == Image.Loading || image.status == Image.Ready
|
|
|
|
image.source: root.imageSrc
|
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
2023-02-03 12:27:42 +00:00
|
|
|
id: introText
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
Layout.fillWidth: true
|
2022-05-26 15:46:02 +00:00
|
|
|
text: root.introMessage !== "" ? root.introMessage : qsTr("Community <b>%1</b> has no intro message...").arg(root.name)
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
2023-02-03 12:27:42 +00:00
|
|
|
StatusCheckBox {
|
|
|
|
id: checkBox
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
visible: !root.isInvitationPending
|
|
|
|
text: qsTr("I agree with the above")
|
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|