1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-23 03:02:30 +01:00
ScreenPlay/ScreenPlayWorkshop/qml/upload/UploadProjectBigItem.qml

196 lines
4.6 KiB
QML
Raw Normal View History

import QtQuick
2021-07-15 12:07:39 +02:00
import Qt5Compat.GraphicalEffects
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts
import QtQuick.Controls.Material.impl
2020-08-20 17:21:09 +02:00
import "../"
Item {
id: root
property bool isProjectValid: false
property alias checkBox: checkBox
property bool isSelected: false
property string customTitle: "name here"
property string absoluteStoragePath: ""
property string screenId: ""
property string preview: ""
2021-02-03 17:52:29 +01:00
property var type
2020-08-20 17:21:09 +02:00
property bool hasMenuOpen: false
property var publishedFileID: 0
2020-08-20 17:21:09 +02:00
property int itemIndex
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
signal itemClicked(var screenId, var type, var isActive)
2021-05-16 19:37:55 +02:00
height: 250
2020-08-20 17:21:09 +02:00
onTypeChanged: {
2021-05-16 19:37:55 +02:00
if (type === "widget")
icnType.source = "icons/icon_widgets.svg";
else if (type === "qmlScene")
icnType.source = "icons/icon_code.svg";
2020-08-20 17:21:09 +02:00
}
2020-08-26 13:30:05 +02:00
// if (!isProjectValid) {
// root.state = "invalid"
// }
// }
2020-08-20 17:21:09 +02:00
Rectangle {
2020-08-26 13:30:05 +02:00
anchors.fill: screenPlayItemWrapper
radius: 4
layer.enabled: true
2021-05-16 19:37:55 +02:00
color: Material.theme === Material.Light ? "white" : Material.background
2020-08-26 13:30:05 +02:00
layer.effect: ElevationEffect {
elevation: 6
}
}
Item {
2020-08-20 17:21:09 +02:00
id: screenPlayItemWrapper
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
anchors.fill: parent
anchors.margins: 20
Item {
id: itemWrapper
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
width: parent.width
height: parent.height
clip: true
Image {
id: screenPlayItemImage
asynchronous: true
2020-08-20 17:21:09 +02:00
width: 400
source: root.preview !== "" ? Qt.resolvedUrl(root.absoluteStoragePath + "/" + root.preview) : ""
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
anchors {
top: parent.top
left: parent.left
bottom: parent.bottom
}
}
Image {
id: icnType
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
width: 20
height: 20
sourceSize: Qt.size(20, 20)
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
anchors {
top: parent.top
left: parent.left
margins: 10
}
}
ColumnLayout {
2021-05-16 19:37:55 +02:00
spacing: 10
2020-08-20 17:21:09 +02:00
anchors {
top: parent.top
right: parent.right
left: screenPlayItemImage.right
margins: 20
}
Text {
id: name
2021-05-16 19:37:55 +02:00
2021-02-03 17:52:29 +01:00
text: m_title
2020-08-20 17:21:09 +02:00
color: Material.foreground
font.pointSize: 18
}
Text {
2021-02-03 17:52:29 +01:00
text: qsTr("Type: ") + m_type
2020-08-20 17:21:09 +02:00
color: Material.foreground
}
}
Button {
text: qsTr("Open Folder")
onClicked: App.util.openFolderInExplorer(m_absoluteStoragePath)
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
anchors {
right: parent.right
bottom: parent.bottom
margins: 20
}
2021-05-16 19:37:55 +02:00
}
2020-08-20 17:21:09 +02:00
Text {
id: txtInvalidError
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
text: qsTr("Invalid Project!")
color: Material.color(Material.Red)
anchors.fill: screenPlayItemImage
font.pointSize: 18
opacity: 0
}
}
CheckBox {
id: checkBox
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
onCheckStateChanged: {
2021-05-16 19:37:55 +02:00
if (checkState == Qt.Checked)
isSelected = true;
else
isSelected = false;
itemClicked(screenId, type, isSelected);
2020-08-20 17:21:09 +02:00
}
anchors {
top: parent.top
right: parent.right
margins: 10
}
}
}
states: [
State {
name: "selected"
PropertyChanges {
target: screenPlayItemWrapper
y: 0
opacity: 1
}
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
PropertyChanges {
target: icnType
2021-05-16 19:37:55 +02:00
opacity: 0.5
2020-08-20 17:21:09 +02:00
}
},
State {
name: "invalid"
PropertyChanges {
target: checkBox
enabled: false
}
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
PropertyChanges {
target: txtInvalidError
opacity: 1
}
}
]
transitions: [
Transition {
from: "*"
to: "invalid"
2021-05-16 19:37:55 +02:00
2020-08-20 17:21:09 +02:00
PropertyAnimation {
property: opacity
target: txtInvalidError
duration: 250
}
}
]
}