2022-05-26 15:46:02 +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
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property alias source: editor.source
|
|
|
|
property alias cropRect: editor.cropRect
|
2023-04-25 09:40:00 +00:00
|
|
|
property alias imageData: editor.dataImage
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-06-26 11:44:56 +00:00
|
|
|
readonly property bool hasSelectedImage: localAppSettings.testEnvironment ? true : editor.userSelectedImage
|
|
|
|
|
2023-01-26 08:41:07 +00:00
|
|
|
implicitHeight: layout.childrenRect.height
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2024-10-08 20:22:22 +00:00
|
|
|
function validate() {
|
|
|
|
editor.isError = !hasSelectedImage
|
|
|
|
}
|
|
|
|
|
2022-05-26 15:46:02 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2024-10-08 20:22:22 +00:00
|
|
|
spacing: 16
|
2022-05-26 15:46:02 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Community banner")
|
|
|
|
|
2023-06-29 21:52:16 +00:00
|
|
|
font.pixelSize: Theme.primaryTextFontSize
|
2022-05-26 15:46:02 +00:00
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
EditCroppedImagePanel {
|
|
|
|
id: editor
|
|
|
|
|
|
|
|
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
|
2023-06-29 21:52:16 +00:00
|
|
|
aspectRatio: 475/184
|
2022-05-26 15:46:02 +00:00
|
|
|
|
|
|
|
NoImageUploadedPanel {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
visible: !editor.userSelectedImage && !root.imageData
|
2023-05-04 10:01:59 +00:00
|
|
|
showAdditionalInfo: true
|
2023-06-29 21:52:16 +00:00
|
|
|
contentSpacing: 2
|
|
|
|
iconWidth: 24
|
|
|
|
iconHeight: 24
|
|
|
|
additionalText: qsTr("Optimal aspect ratio 16:9")
|
|
|
|
additionalTextPixelSize: Theme.tertiaryTextFontSize
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
2024-10-08 20:22:22 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -layout.spacing/2
|
|
|
|
visible: editor.isError
|
|
|
|
text: qsTr("Upload a community banner")
|
|
|
|
font.pixelSize: Theme.tertiaryTextFontSize
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|