1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add Workshop upload by folder and add only workshop upload in the create section

This commit is contained in:
kelteseth 2017-12-04 20:49:31 +01:00
parent 15a14079f2
commit a3f4d5bbc9
5 changed files with 240 additions and 98 deletions

View File

@ -11,6 +11,7 @@ Rectangle {
state: "out"
Component.onCompleted: create.state = "create"
property url activeVideoFile
property url activeFolder
FontLoader {
id: font_Roboto_Regular
@ -27,6 +28,14 @@ Rectangle {
file: file
})
}
onUploadExsisting:{
create.state = "import"
loader.active = true
activeFolder = file
loader.setSource("CreateUpload.qml", {
file: activeFolder
})
}
}
Connections {
@ -127,7 +136,7 @@ Rectangle {
CreateWallpaper {
id: createWallpaper
width: 500
height: 355
height: 400
anchors {
top: parent.top
topMargin: 84

View File

@ -15,14 +15,60 @@ Item {
timerSource.start()
}
Timer {
id: timerSource
interval: 1000
Connections {
target: steamWorkshop
onWorkshopCreationCopyVideo: {
print("Copy video", sucessful)
}
onWorkshopCreationCopyImage: {
print("Copy image", sucessful)
}
onWorkshopCreationCompleted: {
print("Workshop Creation Complete", sucessful)
}
onLocalFileCopyCompleted: {
print("Copy complete", sucessful)
}
onWorkshopCreationFolderDuplicate: {
print("duplicate")
}
}
Timer {
id: timerUpload
running: false
triggeredOnStart: true
repeat: true
interval: 500
onRunningChanged: print(timerUpload.running)
onTriggered: {
var tmp = Qt.resolvedUrl(file).toString()
player.source = tmp
player.play()
var status = steamWorkshop.getItemUpdateProcess()
print(status)
switch (status) {
case 0:
text2.text = "The item update handle was invalid, the job might be finished. Who knows..."
break
case 1:
text2.text = "The item update is processing configuration data."
break
case 2:
text2.text = "The item update is reading and processing content files."
break
case 3:
text2.text = "The item update is uploading content changes to Steam."
break
case 4:
text2.text = "The item update is uploading new preview file image."
break
case 5:
text2.text = "The item update is committing all changes."
timerUpload.running = false
uploadCompleted()
break
default:
break
}
}
}
@ -54,7 +100,7 @@ Item {
color: "black"
anchors {
top: parent.top
topMargin: 80
topMargin: 30
horizontalCenter: parent.horizontalCenter
}
@ -72,11 +118,18 @@ Item {
opacity: 0
}
BusyIndicator {
id: busyIndicator
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
visible: false
Rectangle {
id: rectProgressBar
height: 5
color: "orange"
anchors {
right: parent.right
rightMargin: videoOutWrapper.width
left: parent.left
leftMargin: 0
bottom: parent.bottom
bottomMargin: 0
}
}
}
}
@ -84,13 +137,9 @@ Item {
MediaPlayer {
id: player
videoCodecPriority: ["CUDA", "D3D11", "DXVA", "VAAPI", "FFmpeg"]
autoPlay: true
autoPlay: false
loops: MediaPlayer.Infinite
volume: 0
onSeekFinished: {
busyIndicator.visible = false
pause()
}
}
RectangularGlow {
@ -129,11 +178,11 @@ Item {
spacing: 20
anchors {
top: parent.top
topMargin: 50
topMargin: 55
right: parent.right
rightMargin: 78
bottom: parent.bottom
bottomMargin: 50
bottomMargin: 71
left: parent.left
leftMargin: 78
}
@ -153,7 +202,7 @@ Item {
width: parent.width
selectByMouse: true
text: qsTr("")
placeholderText: "Youtube Preview"
placeholderText: "Youtube Preview URL"
}
TextField {
id: txtTags
@ -161,9 +210,8 @@ Item {
width: parent.width
selectByMouse: true
text: qsTr("")
placeholderText: "Tags"
placeholderText: "Tags - Seperation between tags via , "
}
}
Button {
@ -174,7 +222,9 @@ Item {
horizontalCenter: parent.horizontalCenter
}
onClicked: {
steamWorkshop.submitWorkshopItem(txtTitle.text.toString(),
txtDescription.text.toString(
), "english", "true", path)
}
}
}

View File

@ -9,6 +9,7 @@ Item {
//Component.onCompleted: state = "in"
signal fileSelected(var file)
signal uploadExsisting(var file)
Text {
id: txtHeadline
@ -30,79 +31,148 @@ Item {
}
}
RectangularGlow {
id: effect
anchors {
top: bg.top
topMargin: 3
left: bg.left
right: bg.right
}
height: bg.height
width: bg.width
glowRadius: 3
spread: 0.2
color: "black"
opacity: 0
visible: false
cornerRadius: 15
}
Rectangle {
id: bg
height: parent.height
Item {
id: item1
width: parent.width
radius: 3
z: 10
anchors {
top: parent.top
topMargin: 50
left: parent.left
leftMargin: 0
}
height: 250
anchors.top: parent.top
anchors.topMargin: 50
Image {
id: imgUpload
source: "qrc:/assets/icons/icon_upload.svg"
Rectangle {
id: bg
x: 0
y: 50
height: parent.height
width: parent.width
radius: 3
z: 10
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: 80
topMargin: 0
left: parent.left
leftMargin: 0
}
}
Text {
id: txtDragAndDrop
text: qsTr("Drag n' Drop")
anchors {
horizontalCenter: parent.horizontalCenter
top: imgUpload.bottom
topMargin: 10
Image {
id: imgUpload
source: "qrc:/assets/icons/icon_upload.svg"
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: 30
}
}
font.family: font_LibreBaskerville_Italic.name
font.pixelSize: 18
font.italic: true
color: "#818181"
FontLoader {
id: font_LibreBaskerville_Italic
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
Text {
id: txtDragAndDrop
text: qsTr("Drag n' Drop")
visible: true
anchors {
horizontalCenter: parent.horizontalCenter
top: imgUpload.bottom
topMargin: 10
}
font.family: font_LibreBaskerville_Italic.name
font.pixelSize: 18
font.italic: true
color: "#818181"
FontLoader {
id: font_LibreBaskerville_Italic
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
}
}
}
Button {
text: qsTr("Select File")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 20
Button {
text: qsTr("Select File")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 20
}
onClicked: fileDialogOpenFile.open()
}
FileDialog {
id: fileDialogOpenFile
nameFilters: ["Video files (*.mp4)"]
onAccepted: {
fileSelected(fileDialogOpenFile.currentFile)
}
}
onClicked: fileDialogOpenFile.open()
}
FileDialog {
id: fileDialogOpenFile
nameFilters: ["Video files (*.mp4)"]
onAccepted: {
fileSelected(fileDialogOpenFile.currentFile)
RectangularGlow {
id: effect
anchors {
top: bg.top
topMargin: 3
left: bg.left
right: bg.right
}
height: bg.height
width: bg.width
glowRadius: 3
spread: 0.2
color: "black"
opacity: 0
visible: false
cornerRadius: 15
}
}
Item {
id: item2
width: parent.width
height: 80
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
RectangularGlow {
id: effect1
width: bg1.width
height: bg1.height
anchors {
top: bg1.top
topMargin: 3
left: bg1.left
right: bg1.right
}
color: "#000000"
glowRadius: 3
spread: 0.2
cornerRadius: 15
opacity: 0
z:9
visible: false
}
Rectangle {
id: bg1
width: parent.width
height: parent.height
radius: 3
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 0
anchors.topMargin: 0
z: 10
Button {
text: qsTr("Upload Exsisting Project to Steam")
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
fileDialogOpenFolder.open()
}
}
FolderDialog {
id: fileDialogOpenFolder
onAccepted: {
uploadExsisting(fileDialogOpenFolder.currentFile)
}
}
}
}
states: [
State {
@ -122,6 +192,11 @@ Item {
target: txtHeadline
opacity: 0
}
PropertyChanges {
target: bg1
anchors.leftMargin: 800
}
},
State {
name: "in"
@ -149,16 +224,10 @@ Item {
reversible: true
SequentialAnimation {
PropertyAnimation {
target: bg
targets: [bg,bg1]
duration: 300
properties: "opacity, anchors.leftMargin"
}
// PropertyAnimation {
// target: effect
// duration: 1000
// properties: "opacity, visible, color"
// }
}
}
]

View File

@ -24,12 +24,26 @@ void SteamWorkshop::createWorkshopItem()
m_createWorkshopItemCallResult.Set(hSteamAPICall, this, &SteamWorkshop::workshopItemCreated);
}
void SteamWorkshop::submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath, QUrl absolutePreviewPath)
void SteamWorkshop::submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath)
{
// We need to remove the file because steam wants a folder to upload
QString tmpVideoPath = QFileInfo(absoluteContentPath.toString()).path();
QString video = QString(tmpVideoPath).remove(0, 8);
QString thumb = QString(absolutePreviewPath.toString()).remove(0, 8);
QFile projectConfig;
QJsonObject jsonObject;
QJsonDocument jsonProject;
QJsonParseError parseError;
projectConfig.setFileName(absoluteContentPath.toString() + "project.json");
qDebug() << absoluteContentPath.toString() + "project.json";
projectConfig.open(QIODevice::ReadOnly | QIODevice::Text);
QString projectConfigData = projectConfig.readAll();
jsonProject = QJsonDocument::fromJson(projectConfigData.toUtf8(), &parseError);
if (!(parseError.error == QJsonParseError::NoError))
return;
jsonObject = jsonProject.object();
QString video = absoluteContentPath.toString() + jsonObject.contains("file");
QString thumb = absoluteContentPath.toString() + jsonObject.contains("preview");
SteamUGC()->SetItemTitle(m_UGCUpdateHandle, QByteArray(title.toLatin1()).data());
SteamUGC()->SetItemDescription(m_UGCUpdateHandle, QByteArray(description.toLatin1()).data());

View File

@ -74,7 +74,7 @@ public:
public slots:
void searchWorkshop();
void createWorkshopItem();
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath, QUrl absolutePreviewPath);
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath);
Q_INVOKABLE int getItemUpdateProcess();
Q_INVOKABLE bool contentFolderExist(QString folder);
void getAPICallInfo();