1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-20 01:11:47 +02:00
ScreenPlay/qml/Components/Create.qml

189 lines
5.0 KiB
QML
Raw Normal View History

import QtQuick 2.9
import QtQuick.Controls 2.2
2017-07-13 15:34:35 +02:00
import QtQuick.Dialogs 1.2
2017-07-14 13:34:55 +02:00
import Qt.labs.platform 1.0
CustomPage {
id: create
pageName: ""
2017-11-09 12:23:07 +01:00
state: "init"
2017-07-13 15:34:35 +02:00
Connections {
target: steamWorkshop
onWorkshopItemCreated: {
//TODO!!
//if (userNeedsToAcceptWorkshopLegalAgreement)
}
2017-11-09 12:23:07 +01:00
onLocalFileCopyCompleted: {
create.state = "init"
}
onWorkshopCreationCompleted: {
fileDropperPreview.reset()
fileDropperVideo.reset()
}
2017-11-09 12:23:07 +01:00
}
Connections {
target: createUpload
onUploadCompleted: {
2017-11-09 12:23:07 +01:00
create.state = "init"
}
}
Connections {
target: leftArea
onHasEmptyField: {
if (fieldNumber === 0) {
fileDropperVideo.state = "error"
} else if (fieldNumber === 1) {
fileDropperPreview.state = "error"
}
}
onCreateLocalWallpaperStarted: {
create.state = "createLocalWallpaper"
}
2017-11-09 12:23:07 +01:00
onCreateSteamWallpaperStarted: {
create.state = "upload"
createUpload.startUpload()
}
}
2017-10-05 10:32:17 +02:00
FontLoader {
id: font_Roboto_Regular
source: "qrc:/assets/fonts/Roboto-Regular.ttf"
}
FontLoader {
id: font_LibreBaskerville
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
}
CreateLeftArea {
2017-10-05 10:32:17 +02:00
id: leftArea
2017-10-16 18:03:06 +02:00
width: parent.width * .35
radius: 4
border.width: 2
border.color: "#c2c2c2"
anchors.leftMargin: 30
anchors.topMargin: 30
anchors {
top: parent.top
left: parent.left
margins: 10
}
}
2017-10-05 10:32:17 +02:00
Item {
2017-10-05 10:32:17 +02:00
id: rightArea
2017-10-16 18:03:06 +02:00
width: parent.width * .58
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
margins: 30
2017-07-13 15:34:35 +02:00
}
2017-10-05 10:32:17 +02:00
Item {
id: rightTop
2017-10-16 18:03:06 +02:00
height: 200
anchors {
top: parent.top
right: parent.right
left: parent.left
}
2017-10-05 10:32:17 +02:00
Item {
2017-10-16 18:03:06 +02:00
width: parent.width * .48
height: parent.height
2017-11-09 12:23:07 +01:00
2017-10-05 10:32:17 +02:00
FileDropperSingleFile {
id: fileDropperVideo
2017-10-05 10:32:17 +02:00
anchors.fill: parent
z: 99
descriptionTitle: "Drop your video here"
2017-10-16 19:08:18 +02:00
helpText: "Supportet Video formats: mp4 for older devices and VP9 for newer like NVidia 1000 or AMD VEGA"
isVideo: true
2017-10-05 10:32:17 +02:00
imagePath: "qrc:/assets/icons/icon_tv.svg"
onExternalFilePathChanged: leftArea.videoPath
= fileDropperVideo.externalFilePath
2017-10-05 10:32:17 +02:00
}
}
2017-10-05 10:32:17 +02:00
Item {
2017-10-16 18:03:06 +02:00
width: parent.width * .48
2017-10-05 10:32:17 +02:00
anchors.right: parent.right
2017-07-13 15:34:35 +02:00
height: parent.height
2017-10-05 10:32:17 +02:00
FileDropperSingleFile {
id: fileDropperPreview
2017-10-05 10:32:17 +02:00
anchors.fill: parent
z: 99
2017-10-05 10:32:17 +02:00
descriptionTitle: "Set Preview Image"
2017-10-16 19:08:18 +02:00
helpText: "Use PNG for best results. The image ratio should be 21:9. Preffered resulution 123x123."
2017-10-05 10:32:17 +02:00
imagePath: "qrc:/assets/icons/icon_single_image.svg"
onExternalFilePathChanged: leftArea.previewPath
= fileDropperPreview.externalFilePath
2017-07-13 15:34:35 +02:00
}
}
Item {
2017-10-05 10:32:17 +02:00
id: rightBottom
height: 300
anchors {
top: rightTop.bottom
topMargin: 30
right: parent.right
left: parent.left
2017-07-14 13:34:55 +02:00
}
FileDropperSingleFile {
anchors.fill: parent
z: 99
descriptionTitle: "Add additional images"
imagePath: "qrc:/assets/icons/icon_multiple_images.svg"
2017-07-14 13:34:55 +02:00
}
}
2017-10-05 10:32:17 +02:00
}
}
2017-10-16 18:03:06 +02:00
2017-11-09 12:23:07 +01:00
CreateUpload {
id: createUpload
2017-10-16 18:03:06 +02:00
anchors.fill: parent
z: 99
2017-10-16 18:03:06 +02:00
}
2017-11-09 12:23:07 +01:00
2017-10-16 18:03:06 +02:00
states: [
State {
2017-11-09 12:23:07 +01:00
name: "init"
PropertyChanges {
target: createUpload
z: -1
opacity: 0
visible: false
}
},
State {
name: "upload"
2017-10-16 18:03:06 +02:00
PropertyChanges {
2017-11-09 12:23:07 +01:00
target: createUpload
z: 99
2017-10-16 18:03:06 +02:00
opacity: 1
2017-11-09 12:23:07 +01:00
visible: true
2017-10-16 18:03:06 +02:00
}
},
State {
name: "createLocalWallpaper"
PropertyChanges {
target: createUpload
state: "import"
}
2017-10-16 18:03:06 +02:00
}
]
transitions: [
Transition {
2017-11-09 12:23:07 +01:00
from: "init"
to: "upload"
PropertyAnimation {
properties: "opacity"
2017-11-09 12:23:07 +01:00
duration: 300
easing.type: Easing.InOutQuad
2017-10-16 18:03:06 +02:00
}
}
]
2017-07-06 14:00:43 +02:00
}