2021-09-10 12:45:15 +02:00
|
|
|
import QtQuick
|
2021-07-15 12:07:39 +02:00
|
|
|
import Qt5Compat.GraphicalEffects
|
2021-09-10 12:45:15 +02:00
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Material
|
2022-05-05 13:02:54 +02:00
|
|
|
import ScreenPlayWorkshop
|
2020-08-20 17:21:09 +02:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property url imgUrl
|
|
|
|
property url additionalPreviewUrl
|
|
|
|
property string name
|
2021-01-21 18:37:25 +01:00
|
|
|
property var publishedFileID: 0
|
2020-08-20 17:21:09 +02:00
|
|
|
property int itemIndex
|
|
|
|
property int subscriptionCount
|
|
|
|
property bool isDownloading: false
|
2021-02-13 20:17:16 +01:00
|
|
|
property SteamWorkshop steamWorkshop
|
2020-08-20 17:21:09 +02:00
|
|
|
|
2021-01-21 18:37:25 +01:00
|
|
|
signal clicked(var publishedFileID, url imgUrl)
|
2020-08-20 17:21:09 +02:00
|
|
|
|
2021-05-16 19:37:55 +02:00
|
|
|
width: 320
|
|
|
|
height: 180
|
|
|
|
transform: [
|
|
|
|
Rotation {
|
|
|
|
id: rt
|
|
|
|
|
|
|
|
origin.x: width * 0.5
|
|
|
|
origin.y: height * 0.5
|
|
|
|
angle: 0
|
|
|
|
|
|
|
|
axis {
|
|
|
|
x: -0.5
|
|
|
|
y: 0
|
|
|
|
z: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
Translate {
|
|
|
|
id: tr
|
|
|
|
},
|
|
|
|
Scale {
|
|
|
|
id: sc
|
|
|
|
|
|
|
|
origin.x: width * 0.5
|
|
|
|
origin.y: height * 0.5
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
RectangularGlow {
|
|
|
|
id: effect
|
|
|
|
|
|
|
|
height: parent.height
|
|
|
|
width: parent.width
|
|
|
|
cached: true
|
|
|
|
glowRadius: 3
|
|
|
|
spread: 0.2
|
|
|
|
color: "black"
|
|
|
|
opacity: 0.4
|
|
|
|
cornerRadius: 15
|
2021-05-16 19:37:55 +02:00
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
topMargin: 3
|
|
|
|
}
|
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
Timer {
|
|
|
|
id: timerAnim
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
interval: 40 * itemIndex * Math.random()
|
|
|
|
running: true
|
|
|
|
repeat: false
|
|
|
|
onTriggered: showAnim.start()
|
|
|
|
}
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
id: showAnim
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
running: false
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
RotationAnimation {
|
|
|
|
target: rt
|
|
|
|
from: 90
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutQuint
|
|
|
|
property: "angle"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: root
|
|
|
|
from: 0
|
|
|
|
to: 1
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutQuint
|
|
|
|
property: "opacity"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: tr
|
|
|
|
from: 80
|
|
|
|
to: 0
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutQuint
|
|
|
|
property: "y"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: sc
|
2021-05-16 19:37:55 +02:00
|
|
|
from: 0.8
|
2020-08-20 17:21:09 +02:00
|
|
|
to: 1
|
|
|
|
duration: 500
|
|
|
|
easing.type: Easing.OutQuint
|
|
|
|
properties: "xScale,yScale"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: screenPlay
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors.centerIn: parent
|
|
|
|
height: 180
|
|
|
|
width: 320
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: mask
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2022-05-01 20:20:57 +02:00
|
|
|
//source: "qrc:/qml/ScreenPlayWorkshop/assets/images/Window.svg"
|
2020-08-20 17:21:09 +02:00
|
|
|
sourceSize: Qt.size(screenPlay.width, screenPlay.height)
|
|
|
|
visible: false
|
|
|
|
smooth: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: itemWrapper
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
visible: false
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
fill: parent
|
|
|
|
margins: 5
|
|
|
|
}
|
|
|
|
|
|
|
|
ScreenPlayItemImage {
|
|
|
|
id: screenPlayItemImage
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
sourceImage: root.imgUrl
|
|
|
|
sourceImageGIF: root.additionalPreviewUrl
|
|
|
|
}
|
|
|
|
|
|
|
|
LinearGradient {
|
|
|
|
id: shadow
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
height: 80
|
|
|
|
opacity: 0
|
|
|
|
cached: true
|
2021-05-16 19:37:55 +02:00
|
|
|
start: Qt.point(0, 80)
|
|
|
|
end: Qt.point(0, 0)
|
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
left: parent.left
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
2021-05-16 19:37:55 +02:00
|
|
|
position: 0
|
2020-08-20 17:21:09 +02:00
|
|
|
color: "#CC000000"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
GradientStop {
|
2021-05-16 19:37:55 +02:00
|
|
|
position: 1
|
2020-08-20 17:21:09 +02:00
|
|
|
color: "#00000000"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
Text {
|
|
|
|
id: txtTitle
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
text: root.name
|
|
|
|
opacity: 0
|
|
|
|
height: 30
|
|
|
|
width: 180
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
color: "white"
|
2021-02-05 11:48:13 +01:00
|
|
|
font.pointSize: 14
|
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: 20
|
2021-02-05 11:48:13 +01:00
|
|
|
left: parent.left
|
|
|
|
leftMargin: 20
|
2020-08-20 17:21:09 +02:00
|
|
|
bottomMargin: -50
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: openInWorkshop
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
height: 20
|
|
|
|
width: 20
|
|
|
|
z: 99
|
|
|
|
opacity: 0
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
margins: 10
|
|
|
|
top: parent.top
|
|
|
|
right: parent.right
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
Image {
|
2022-05-01 20:20:57 +02:00
|
|
|
source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_open_in_new.svg"
|
2020-08-20 17:21:09 +02:00
|
|
|
sourceSize: Qt.size(parent.width, parent.height)
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
OpacityMask {
|
|
|
|
anchors.fill: itemWrapper
|
|
|
|
source: itemWrapper
|
|
|
|
maskSource: mask
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onContainsMouseChanged: {
|
|
|
|
if (!isDownloading) {
|
2021-05-16 19:37:55 +02:00
|
|
|
if (containsMouse)
|
|
|
|
root.state = "hover";
|
|
|
|
else
|
|
|
|
root.state = "";
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
onClicked: {
|
2021-05-16 19:37:55 +02:00
|
|
|
root.clicked(root.publishedFileID, root.imgUrl);
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
MouseArea {
|
|
|
|
height: 20
|
|
|
|
width: 20
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-05-16 19:37:55 +02:00
|
|
|
onClicked: {
|
|
|
|
Qt.openUrlExternally("steam://url/CommunityFilePage/" + root.publishedFileID);
|
|
|
|
}
|
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
margins: 10
|
|
|
|
top: parent.top
|
|
|
|
right: parent.right
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
FastBlur {
|
|
|
|
id: effBlur
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors.fill: itemWrapper
|
|
|
|
source: itemWrapper
|
|
|
|
radius: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: itmDownloading
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
opacity: 0
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
topMargin: 50
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
left: parent.left
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: txtDownloading
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
text: qsTr("Successfully subscribed to Workshop Item!")
|
|
|
|
color: "white"
|
|
|
|
font.pointSize: 18
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: 20
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: 20
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "hover"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: openInWorkshop
|
2021-05-16 19:37:55 +02:00
|
|
|
opacity: 0.75
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtTitle
|
|
|
|
opacity: 1
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: shadow
|
|
|
|
opacity: 1
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: effBlur
|
|
|
|
radius: 0
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "downloading"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: openInWorkshop
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtTitle
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: shadow
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: effBlur
|
|
|
|
radius: 64
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: itmDownloading
|
|
|
|
opacity: 1
|
|
|
|
anchors.topMargin: 0
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "installed"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtTitle
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: shadow
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: effBlur
|
|
|
|
radius: 64
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: itmDownloading
|
|
|
|
opacity: 1
|
|
|
|
anchors.topMargin: 0
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: txtDownloading
|
|
|
|
text: qsTr("Download complete!")
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
transitions: [
|
|
|
|
Transition {
|
|
|
|
from: ""
|
|
|
|
to: "hover"
|
|
|
|
reversible: true
|
|
|
|
|
|
|
|
PropertyAnimation {
|
|
|
|
target: openInWorkshop
|
|
|
|
duration: 100
|
|
|
|
properties: "opacity"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: txtTitle
|
|
|
|
duration: 100
|
|
|
|
properties: "opacity, anchors.bottomMargin"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: shadow
|
|
|
|
duration: 100
|
|
|
|
properties: "opacity"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
},
|
|
|
|
Transition {
|
|
|
|
from: "*"
|
|
|
|
to: "downloading"
|
|
|
|
reversible: true
|
|
|
|
|
|
|
|
PropertyAnimation {
|
|
|
|
target: txtTitle
|
|
|
|
duration: 100
|
|
|
|
properties: "opacity"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: shadow
|
|
|
|
duration: 100
|
|
|
|
properties: "opacity"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
SequentialAnimation {
|
|
|
|
PropertyAnimation {
|
|
|
|
target: effBlur
|
|
|
|
duration: 500
|
|
|
|
properties: "radius"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
PropertyAnimation {
|
|
|
|
target: txtTitle
|
|
|
|
duration: 200
|
|
|
|
properties: "opacity, anchors.topMargin"
|
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|