2022-10-10 14:12:23 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
2022-10-11 09:26:24 +00:00
|
|
|
import Storybook 1.0
|
|
|
|
|
2022-10-10 14:12:23 +00:00
|
|
|
ListView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
spacing: 25
|
2022-10-14 08:29:36 +00:00
|
|
|
ScrollBar.vertical: ScrollBar { x: root.width }
|
2022-10-10 14:12:23 +00:00
|
|
|
|
|
|
|
ImageSelectPopup {
|
|
|
|
id: iconSelector
|
|
|
|
|
|
|
|
parent: root
|
|
|
|
anchors.centerIn: parent
|
|
|
|
width: parent.width * 0.8
|
|
|
|
height: parent.height * 0.8
|
|
|
|
|
|
|
|
model: ListModel {
|
|
|
|
id: iconsModel
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2022-10-11 09:26:24 +00:00
|
|
|
const uniqueIcons = StorybookUtils.getUniqueValuesFromModel(root.model, "icon")
|
2022-10-10 14:12:23 +00:00
|
|
|
uniqueIcons.map(image => iconsModel.append( { image }))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageSelectPopup {
|
|
|
|
id: bannerSelector
|
|
|
|
|
|
|
|
parent: root
|
|
|
|
anchors.centerIn: parent
|
|
|
|
width: parent.width * 0.8
|
|
|
|
height: parent.height * 0.8
|
|
|
|
|
|
|
|
model: ListModel {
|
|
|
|
id: bannersModel
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2022-10-11 09:26:24 +00:00
|
|
|
const uniqueBanners = StorybookUtils.getUniqueValuesFromModel(root.model, "banner")
|
2022-10-10 14:12:23 +00:00
|
|
|
uniqueBanners.map(image => bannersModel.append( { image }))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
delegate: ColumnLayout {
|
|
|
|
width: ListView.view.width
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Label {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: "community id: " + model.communityId
|
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: model.name
|
|
|
|
onTextChanged: model.name = text
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: model.description
|
|
|
|
onTextChanged: model.description = text
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Flow {
|
|
|
|
Layout.fillWidth: true
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
CheckBox {
|
|
|
|
text: "featured"
|
|
|
|
checked: model.featured
|
|
|
|
onToggled: model.featured = checked
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
text: "available"
|
|
|
|
checked: model.available
|
|
|
|
onToggled: model.available = checked
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
text: "loaded"
|
|
|
|
checked: model.loaded
|
|
|
|
onToggled: model.loaded = checked
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
2022-10-14 08:29:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 50
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Rectangle {
|
|
|
|
border.color: 'gray'
|
2022-10-10 14:12:23 +00:00
|
|
|
Layout.fillWidth: true
|
2022-10-14 08:29:36 +00:00
|
|
|
Layout.fillHeight: true
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Image {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: model.icon
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
2022-10-14 08:29:36 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
iconSelector.open()
|
|
|
|
StorybookUtils.singleShotConnection(iconSelector.selected, icon => {
|
|
|
|
model.icon = icon
|
|
|
|
iconSelector.close()
|
|
|
|
})
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Rectangle {
|
|
|
|
border.color: 'gray'
|
2022-10-10 14:12:23 +00:00
|
|
|
Layout.fillWidth: true
|
2022-10-14 08:29:36 +00:00
|
|
|
Layout.fillHeight: true
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Image {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: model.banner
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
bannerSelector.open()
|
|
|
|
StorybookUtils.singleShotConnection(bannerSelector.selected, banner => {
|
|
|
|
model.banner = banner
|
|
|
|
bannerSelector.close()
|
|
|
|
})
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-14 08:29:36 +00:00
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
maximumLength: 1024 * 1024 * 1024
|
|
|
|
text: model.icon
|
|
|
|
onTextChanged: model.icon = text
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
TextField {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
maximumLength: 1024 * 1024 * 1024
|
|
|
|
text: model.banner
|
|
|
|
onTextChanged: model.banner = text
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Row {
|
|
|
|
Label {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: "members:\t"
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
SpinBox {
|
|
|
|
editable: true
|
|
|
|
height: 30
|
|
|
|
from: 0; to: 10 * 1000 * 1000
|
|
|
|
value: model.members
|
|
|
|
onValueChanged: model.members = value
|
|
|
|
}
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
Row {
|
|
|
|
Label {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
text: "popularity:\t"
|
|
|
|
}
|
2022-10-10 14:12:23 +00:00
|
|
|
|
2022-10-14 08:29:36 +00:00
|
|
|
SpinBox {
|
|
|
|
editable: true
|
|
|
|
height: 30
|
|
|
|
from: 0; to: 10 * 1000 * 1000
|
|
|
|
value: model.popularity
|
|
|
|
onValueChanged: model.popularity = value
|
2022-10-10 14:12:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|