2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2022-05-18 12:21:03 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
id: root
|
|
|
|
|
2022-05-18 12:21:03 +00:00
|
|
|
property color color: Theme.palette.primaryColor1
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
property alias name: nameInput.text
|
|
|
|
property alias description: descriptionTextInput.text
|
2022-05-23 18:53:51 +00:00
|
|
|
property string logoImageData: ""
|
2022-05-23 17:36:48 +00:00
|
|
|
property alias logoImagePath: logoEditor.source
|
|
|
|
property alias logoCropRect: logoEditor.cropRect
|
2022-05-23 18:53:51 +00:00
|
|
|
property string bannerImageData: ""
|
|
|
|
property alias bannerPath: bannerEditor.source
|
|
|
|
property alias bannerCropRect: bannerEditor.cropRect
|
2022-04-13 20:54:17 +00:00
|
|
|
property bool isCommunityHistoryArchiveSupportEnabled: false
|
|
|
|
property alias historyArchiveSupportToggle: historyArchiveSupportToggle.checked
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
contentWidth: layout.width
|
|
|
|
contentHeight: layout.height
|
|
|
|
clip: true
|
|
|
|
interactive: contentHeight > height
|
|
|
|
flickableDirection: Flickable.VerticalFlick
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
|
|
|
|
width: root.width
|
|
|
|
spacing: 12
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: nameInput
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
leftPadding: 0
|
|
|
|
rightPadding: 0
|
|
|
|
label: qsTr("Community name")
|
|
|
|
charLimit: 30
|
|
|
|
input.placeholderText: qsTr("A catchy name")
|
|
|
|
validators: [
|
|
|
|
StatusMinLengthValidator {
|
|
|
|
minLength: 1
|
|
|
|
errorMessage: Utils.getErrorMessage(nameInput.errors,
|
|
|
|
qsTr("community name"))
|
|
|
|
}
|
|
|
|
]
|
|
|
|
validationMode: StatusInput.ValidationMode.Always
|
|
|
|
|
|
|
|
Component.onCompleted: nameInput.input.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: descriptionTextInput
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
leftPadding: 0
|
|
|
|
rightPadding: 0
|
|
|
|
label: qsTr("Description")
|
|
|
|
charLimit: 140
|
|
|
|
|
|
|
|
input.placeholderText: qsTr("What your community is about")
|
|
|
|
input.multiline: true
|
|
|
|
input.implicitHeight: 88
|
|
|
|
|
|
|
|
validators: [
|
|
|
|
StatusMinLengthValidator {
|
|
|
|
minLength: 1
|
|
|
|
errorMessage: Utils.getErrorMessage(
|
|
|
|
descriptionTextInput.errors,
|
|
|
|
qsTr("community description"))
|
|
|
|
}
|
|
|
|
]
|
|
|
|
validationMode: StatusInput.ValidationMode.Always
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 8
|
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
// Logo
|
|
|
|
//
|
2022-03-23 15:38:23 +00:00
|
|
|
StatusBaseText {
|
2022-05-23 18:53:51 +00:00
|
|
|
text: qsTr("Community logo")
|
2022-03-23 15:38:23 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
EditCroppedImagePanel {
|
|
|
|
id: logoEditor
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
Layout.preferredWidth: 128
|
|
|
|
Layout.preferredHeight: Layout.preferredWidth / aspectRatio
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
imageFileDialogTitle: qsTr("Choose an image as logo")
|
|
|
|
title: qsTr("Community logo")
|
|
|
|
acceptButtonText: qsTr("Make this my Community logo")
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
dataImage: root.logoImageData
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-05-23 17:36:48 +00:00
|
|
|
NoImageUploadedPanel {
|
2022-03-23 15:38:23 +00:00
|
|
|
anchors.centerIn: parent
|
2022-05-23 17:36:48 +00:00
|
|
|
|
|
|
|
visible: !logoEditor.userSelectedImage && !root.logoImageData
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-23 18:53:51 +00:00
|
|
|
|
|
|
|
// Banner
|
|
|
|
//
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Community banner")
|
|
|
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
EditCroppedImagePanel {
|
|
|
|
id: bannerEditor
|
|
|
|
|
|
|
|
Layout.preferredWidth: 475
|
|
|
|
Layout.preferredHeight: Layout.preferredWidth / aspectRatio
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
|
|
|
imageFileDialogTitle: qsTr("Choose an image for banner")
|
|
|
|
title: qsTr("Community banner")
|
|
|
|
acceptButtonText: qsTr("Make this my Community banner")
|
|
|
|
|
|
|
|
roundedImage: false
|
|
|
|
aspectRatio: 375/184
|
|
|
|
|
|
|
|
dataImage: root.bannerImageData
|
|
|
|
|
|
|
|
NoImageUploadedPanel {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
visible: !bannerEditor.userSelectedImage && !root.bannerImageData
|
|
|
|
showARHint: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
StatusBaseText {
|
2022-05-04 13:08:04 +00:00
|
|
|
text: qsTr("Community colour")
|
2022-03-23 15:38:23 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusPickerButton {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
property string validationError: ""
|
|
|
|
|
2022-05-18 12:21:03 +00:00
|
|
|
bgColor: root.color
|
|
|
|
contentColor: Theme.palette.indirectColor1
|
|
|
|
text: root.color.toString()
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-05-18 12:21:03 +00:00
|
|
|
onClicked: {
|
|
|
|
colorDialog.color = root.color;
|
|
|
|
colorDialog.open();
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
onTextChanged: {
|
2022-05-18 12:21:03 +00:00
|
|
|
validationError = Utils.validateAndReturnError(text,
|
|
|
|
Utils.Validate.NoEmpty |
|
|
|
|
Utils.Validate.TextHexColor);
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-05-18 12:21:03 +00:00
|
|
|
StatusColorDialog {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: colorDialog
|
2022-05-18 12:21:03 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
header.title: qsTr("Community Colour")
|
|
|
|
previewText: qsTr("White text should be legable on top of this colour")
|
|
|
|
acceptText: qsTr("Select Community Colour")
|
|
|
|
onAccepted: {
|
|
|
|
root.color = color;
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-04 13:08:04 +00:00
|
|
|
StatusListItem {
|
2022-04-13 20:54:17 +00:00
|
|
|
title: qsTr("Community history service")
|
2022-05-04 13:08:04 +00:00
|
|
|
|
2022-04-13 20:54:17 +00:00
|
|
|
Layout.fillWidth: true
|
2022-05-04 13:08:04 +00:00
|
|
|
visible: root.isCommunityHistoryArchiveSupportEnabled
|
|
|
|
|
|
|
|
components: [
|
|
|
|
StatusSwitch {
|
|
|
|
id: historyArchiveSupportToggle
|
|
|
|
enabled: root.isCommunityHistoryArchiveSupportEnabled
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|