mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add check if wallpaper creations paths are empty with fancy feedback
This commit is contained in:
parent
5c0b73bfb1
commit
99d035de7f
@ -21,6 +21,17 @@ CustomPage {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: leftArea
|
||||
onHasEmptyField:{
|
||||
if(fieldNumber === 0){
|
||||
fileDropperVideo.state = "error"
|
||||
} else if (fieldNumber === 1) {
|
||||
fileDropperPreview.state = "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FontLoader {
|
||||
id: font_Roboto_Regular
|
||||
source: "qrc:/assets/fonts/Roboto-Regular.ttf"
|
||||
@ -38,6 +49,7 @@ CustomPage {
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
@ -61,11 +73,13 @@ CustomPage {
|
||||
width: parent.width * .46
|
||||
height: parent.height
|
||||
FileDropperSingleFile {
|
||||
id:fileDropperVideo
|
||||
anchors.fill: parent
|
||||
z: 99
|
||||
descriptionTitle: "Drop your video here"
|
||||
isVideo: true
|
||||
imagePath: "qrc:/assets/icons/icon_tv.svg"
|
||||
onExternalFilePathChanged: leftArea.videoPath = fileDropperVideo.externalFilePath
|
||||
}
|
||||
}
|
||||
Item {
|
||||
@ -74,10 +88,12 @@ CustomPage {
|
||||
height: parent.height
|
||||
|
||||
FileDropperSingleFile {
|
||||
id:fileDropperPreview
|
||||
anchors.fill: parent
|
||||
z: 99
|
||||
descriptionTitle: "Set Preview Image"
|
||||
imagePath: "qrc:/assets/icons/icon_single_image.svg"
|
||||
onExternalFilePathChanged: leftArea.previewPath = fileDropperPreview.externalFilePath
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +111,7 @@ CustomPage {
|
||||
z: 99
|
||||
descriptionTitle: "Add additional images"
|
||||
imagePath: "qrc:/assets/icons/icon_multiple_images.svg"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@ Rectangle {
|
||||
height: column.childrenRect.height + (6 * 30)
|
||||
state: "workshop"
|
||||
property int steamWorkshopHeight
|
||||
property url videoPath
|
||||
property url previewPath
|
||||
//Todo 5.10 ENUM
|
||||
signal hasEmptyField(int fieldNumber)
|
||||
|
||||
Row {
|
||||
id: rowUseSteamWorkshop
|
||||
@ -121,22 +125,33 @@ Rectangle {
|
||||
id: btnSubmit
|
||||
text: qsTr("Create New Workshop Wallpaper")
|
||||
onClicked: {
|
||||
if (switchUseSteamWorkshop) {
|
||||
//TODO wait for callback
|
||||
steamWorkshop.createWorkshopItem()
|
||||
|
||||
steamWorkshop.submitWorkshopItem(
|
||||
txtTitle.text.toString(),
|
||||
txtDescription.text.toString(), "english",
|
||||
cbVisibility.currentIndex,
|
||||
fileDialogOpenVideo.currentFile,
|
||||
fileDialogOpenPreview.currentFile)
|
||||
tiItemUpdate.start()
|
||||
//Check for empty fields
|
||||
if (videoPath.toString() === "") {
|
||||
hasEmptyField(0)
|
||||
} else if (previewPath.toString() === "") {
|
||||
hasEmptyField(1)
|
||||
} else {
|
||||
steamWorkshop.createLocalWorkshopItem(
|
||||
txtTitle.text.toString(),
|
||||
fileDialogOpenVideo.currentFile,
|
||||
fileDialogOpenPreview.currentFile)
|
||||
|
||||
//Check if whether to use steamWorkshop or not
|
||||
if (switchUseSteamWorkshop.checked) {
|
||||
//TODO wait for callback
|
||||
steamWorkshop.createWorkshopItem()
|
||||
|
||||
steamWorkshop.submitWorkshopItem(
|
||||
txtTitle.text.toString(),
|
||||
txtDescription.text.toString(), "english",
|
||||
cbVisibility.currentIndex,
|
||||
fileDialogOpenVideo.currentFile,
|
||||
fileDialogOpenPreview.currentFile)
|
||||
tiItemUpdate.start()
|
||||
} else {
|
||||
|
||||
steamWorkshop.createLocalWorkshopItem(
|
||||
txtTitle.text.toString(),
|
||||
fileDialogOpenVideo.currentFile,
|
||||
fileDialogOpenPreview.currentFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtAV 1.07
|
||||
|
||||
Rectangle {
|
||||
|
@ -3,7 +3,6 @@ import QtQuick.Dialogs 1.2
|
||||
|
||||
|
||||
Rectangle {
|
||||
|
||||
property color background: "white"
|
||||
property string descriptionTitle: "value"
|
||||
property url imagePath: "qrc:/assets/icons/icon_plus.svg"
|
||||
@ -18,6 +17,18 @@ Rectangle {
|
||||
radius: 4
|
||||
state: ""
|
||||
|
||||
onStateChanged: {
|
||||
if(fileDropperSingleFile.state === "error"){
|
||||
stateChangedTimer.start()
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id:stateChangedTimer
|
||||
onTriggered: {
|
||||
fileDropperSingleFile.state = "empty"
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (isVideo) {
|
||||
|
||||
@ -92,11 +103,13 @@ Rectangle {
|
||||
if (drop.hasUrls) {
|
||||
if (isVideo) {
|
||||
if (validateVideoFileExtension(drop.urls[0])) {
|
||||
videoPreviewLoader.setSource("CreateVideoPreviewSmall.qml",{"source":drop.urls[0]})
|
||||
externalFilePath = drop.urls[0]
|
||||
videoPreviewLoader.setSource("CreateVideoPreviewSmall.qml",{"source":externalFilePath})
|
||||
|
||||
}
|
||||
} else {
|
||||
if (validateImageFileExtension(drop.urls[0])) {
|
||||
externalFilePath = drop.urls[0]
|
||||
previewImage.source = drop.urls[0]
|
||||
previewImage.visible = true
|
||||
}
|
||||
@ -175,6 +188,14 @@ Rectangle {
|
||||
target: fileDropperSingleFile
|
||||
color: "white"
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "error"
|
||||
|
||||
PropertyChanges {
|
||||
target: fileDropperSingleFile
|
||||
color: "#ff4d4d"
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
|
Loading…
Reference in New Issue
Block a user