mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 16:32:33 +02:00
Add new upload functionallity
This commit is contained in:
parent
38eb60a2f4
commit
48ac3a60d2
@ -1,6 +1,7 @@
|
||||
import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
// Qt Creator does not support Namespaced enums yet
|
||||
// https://bugreports.qt.io/browse/QTCREATORBUG-17850
|
||||
import LocalWorkshopCreationStatus 1.0
|
||||
|
@ -3,6 +3,9 @@ import QtAV 1.7
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.2
|
||||
import Qt.labs.platform 1.0
|
||||
import QtQuick.Controls.Material 2.2
|
||||
|
||||
import RemoteWorkshopCreationStatus 1.0
|
||||
|
||||
Item {
|
||||
id: createUpload
|
||||
@ -12,58 +15,67 @@ Item {
|
||||
property bool isVideoPlaying: true
|
||||
property url videoFile: ""
|
||||
property url projectFile: ""
|
||||
property var jsonProjectFile
|
||||
|
||||
// First we parse the content of the project file
|
||||
// TODO: Implement parse error
|
||||
onProjectFileChanged: {
|
||||
jsonProjectFile = JSON.parse(screenPlaySettings.loadProject(
|
||||
projectFile))
|
||||
}
|
||||
|
||||
// Now we add the content
|
||||
onJsonProjectFileChanged: {
|
||||
txtTitle.text = jsonProjectFile.title
|
||||
txtDescription.text = jsonProjectFile.description
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: steamWorkshop
|
||||
ignoreUnknownSignals: true
|
||||
onWorkshopCreationCopyVideo: {
|
||||
print("Copy video", sucessful)
|
||||
onWorkshopItemCreated: {
|
||||
steamWorkshop.submitWorkshopItem(txtTitle.text.toString(),
|
||||
txtDescription.text.toString(),
|
||||
"english", "true", projectFile,
|
||||
videoFile)
|
||||
}
|
||||
onWorkshopCreationCopyImage: {
|
||||
print("Copy image", sucessful)
|
||||
}
|
||||
onWorkshopCreationCompleted: {
|
||||
print("Workshop Creation Complete", sucessful)
|
||||
}
|
||||
onLocalFileCopyCompleted: {
|
||||
print("Copy complete", sucessful)
|
||||
}
|
||||
onWorkshopCreationFolderDuplicate: {
|
||||
print("duplicate")
|
||||
onRemoteWorkshopCreationStatusChanged: {
|
||||
switch (status){
|
||||
case RemoteWorkshopCreationStatus.Started:
|
||||
timerUpload.start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Timer {
|
||||
id: timerUpload
|
||||
running: false
|
||||
triggeredOnStart: true
|
||||
repeat: true
|
||||
interval: 500
|
||||
onRunningChanged: print(timerUpload.running)
|
||||
interval: 200
|
||||
onTriggered: {
|
||||
var status = steamWorkshop.getItemUpdateProcess()
|
||||
print(status)
|
||||
print(status + steamWorkshop.steamWorkshop + " / " + steamWorkshop.bytesTotal)
|
||||
switch (status) {
|
||||
case 0:
|
||||
text2.text = "The item update handle was invalid, the job might be finished. Who knows..."
|
||||
txtUploadStatus.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."
|
||||
txtUploadStatus.text = "The item update is processing configuration data."
|
||||
break
|
||||
case 2:
|
||||
text2.text = "The item update is reading and processing content files."
|
||||
txtUploadStatus.text = "The item update is reading and processing content files."
|
||||
break
|
||||
case 3:
|
||||
text2.text = "The item update is uploading content changes to Steam."
|
||||
txtUploadStatus.text = "The item update is uploading content changes to Steam."
|
||||
break
|
||||
case 4:
|
||||
text2.text = "The item update is uploading new preview file image."
|
||||
txtUploadStatus.text = "The item update is uploading new preview file image."
|
||||
break
|
||||
case 5:
|
||||
text2.text = "The item update is committing all changes."
|
||||
txtUploadStatus.text = "The item update is committing all changes."
|
||||
timerUpload.running = false
|
||||
uploadCompleted()
|
||||
break
|
||||
default:
|
||||
break
|
||||
@ -174,7 +186,7 @@ Item {
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 20
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 55
|
||||
@ -192,6 +204,14 @@ Item {
|
||||
width: parent.width
|
||||
selectByMouse: true
|
||||
text: qsTr("")
|
||||
placeholderText: "Title"
|
||||
}
|
||||
TextField {
|
||||
id: txtDescription
|
||||
height: 60
|
||||
width: parent.width
|
||||
selectByMouse: true
|
||||
text: qsTr("")
|
||||
placeholderText: "Description"
|
||||
}
|
||||
|
||||
@ -220,10 +240,49 @@ Item {
|
||||
bottomMargin: 10
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
Material.background: Material.Orange
|
||||
Material.foreground: "white"
|
||||
onClicked: {
|
||||
steamWorkshop.submitWorkshopItem(txtTitle.text.toString(),
|
||||
txtDescription.text.toString(
|
||||
), "english", "true", projectFile, videoFile)
|
||||
createUpload.state = "upload"
|
||||
// We need to first create a workshop item
|
||||
// after we received the new item handle
|
||||
// from steam we can upload the content
|
||||
steamWorkshop.createWorkshopItem()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: uploadWrapper
|
||||
opacity: 0
|
||||
width: 600
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: videoOutWrapper.bottom
|
||||
topMargin: 20
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtUploadStatus
|
||||
text: qsTr("Creating Workshop Item")
|
||||
color: "white"
|
||||
font.pixelSize: 16
|
||||
height: 30
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: parent.top
|
||||
}
|
||||
font.family: font_Roboto_Regular.name
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
id: pbUpload
|
||||
value: .1
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: txtUploadStatus.bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,6 +337,41 @@ Item {
|
||||
opacity: 1
|
||||
anchors.topMargin: 20
|
||||
}
|
||||
PropertyChanges {
|
||||
target: uploadWrapper
|
||||
opacity: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "upload"
|
||||
PropertyChanges {
|
||||
target: createUpload
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: videoOut
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: effect
|
||||
opacity: 0
|
||||
color: "transparent"
|
||||
}
|
||||
PropertyChanges {
|
||||
target: contentWrapper
|
||||
opacity: 1
|
||||
anchors.topMargin: -500
|
||||
}
|
||||
PropertyChanges {
|
||||
target: videoOutWrapper
|
||||
z: 12
|
||||
opacity: 1
|
||||
anchors.topMargin: 150
|
||||
}
|
||||
PropertyChanges {
|
||||
target: uploadWrapper
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -317,6 +411,44 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "in"
|
||||
to: "upload"
|
||||
reversible: true
|
||||
|
||||
SequentialAnimation {
|
||||
ParallelAnimation {
|
||||
PropertyAnimation {
|
||||
duration: 300
|
||||
target: contentWrapper
|
||||
property: "opacity"
|
||||
}
|
||||
PropertyAnimation {
|
||||
duration: 300
|
||||
target: contentWrapper
|
||||
property: "anchors.topMargin"
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
ParallelAnimation {
|
||||
PropertyAnimation {
|
||||
duration: 250
|
||||
target: videoOutWrapper
|
||||
property: "topMargin"
|
||||
}
|
||||
PropertyAnimation {
|
||||
duration: 250
|
||||
target: effect
|
||||
properties: "color, opacity"
|
||||
}
|
||||
PropertyAnimation {
|
||||
duration: 250
|
||||
target: uploadWrapper
|
||||
property: "opacity"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.9
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.2
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
import QtQuick.Controls.Material 2.2
|
||||
Item {
|
||||
id: createWallpaper
|
||||
state: "in"
|
||||
@ -87,6 +87,8 @@ Item {
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 20
|
||||
}
|
||||
Material.background: Material.Orange
|
||||
Material.foreground: "white"
|
||||
onClicked: fileDialogOpenFile.open()
|
||||
}
|
||||
|
||||
@ -158,8 +160,9 @@ Item {
|
||||
z: 10
|
||||
Button {
|
||||
text: qsTr("Upload Exsisting Project to Steam")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.centerIn: parent
|
||||
Material.background: Material.Orange
|
||||
Material.foreground: "white"
|
||||
onClicked: {
|
||||
fileDialogOpenProject.open()
|
||||
}
|
||||
@ -168,6 +171,7 @@ Item {
|
||||
id: fileDialogOpenProject
|
||||
nameFilters: ["Project files (project.json)", ]
|
||||
onAccepted: {
|
||||
print(fileDialogOpenProject.currentFile)
|
||||
projectFileSelected(fileDialogOpenProject.currentFile)
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,20 @@ Item {
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
text: ">"
|
||||
font.family: font_Roboto_Regular.name
|
||||
renderType: Text.NativeRendering
|
||||
font.pixelSize: 24
|
||||
color: "#b9b9b9"
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: 20
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
@ -114,6 +114,15 @@ void Settings::setWallpaper(int monitorIndex, QUrl absoluteStoragePath)
|
||||
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(project, monitor)));
|
||||
}
|
||||
|
||||
QString Settings::loadProject(QString file)
|
||||
{
|
||||
QFile configTmp;
|
||||
file = file.replace("file:///", "");
|
||||
configTmp.setFileName(file);
|
||||
configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
return configTmp.readAll();
|
||||
}
|
||||
|
||||
void Settings::loadActiveProfiles()
|
||||
{
|
||||
QJsonDocument configJsonDocument;
|
||||
@ -190,6 +199,11 @@ QUrl Settings::getPreviewImageByMonitorID(QString id)
|
||||
return QUrl();
|
||||
}
|
||||
|
||||
QString Settings::fixWindowsPath(QString url)
|
||||
{
|
||||
return url.replace("/", "\\\\");
|
||||
}
|
||||
|
||||
void Settings::createNewWallpaper(int monitorListPosition, Profile profile, ProjectFile projectFile)
|
||||
{
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
Q_INVOKABLE void setMuteAll(bool isMuted);
|
||||
Q_INVOKABLE void setPlayAll(bool isPlaying);
|
||||
Q_INVOKABLE QUrl getPreviewImageByMonitorID(QString id);
|
||||
Q_INVOKABLE QString fixWindowsPath(QString url);
|
||||
|
||||
|
||||
enum LocalCopyResult {
|
||||
@ -166,6 +167,8 @@ public slots:
|
||||
|
||||
Q_INVOKABLE void setWallpaper(int monitorIndex, QUrl absoluteStoragePath);
|
||||
|
||||
Q_INVOKABLE QString loadProject(QString file);
|
||||
|
||||
void setLocalStoragePath(QUrl localStoragePath)
|
||||
{
|
||||
if (m_localStoragePath == localStoragePath)
|
||||
@ -198,7 +201,6 @@ public slots:
|
||||
emit localStoragePathChanged(m_localStoragePath);
|
||||
}
|
||||
|
||||
|
||||
void setHasWorkshopBannerSeen(bool hasWorkshopBannerSeen)
|
||||
{
|
||||
if (m_hasWorkshopBannerSeen == hasWorkshopBannerSeen)
|
||||
@ -208,6 +210,7 @@ public slots:
|
||||
emit hasWorkshopBannerSeenChanged(m_hasWorkshopBannerSeen);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void createDefaultConfig();
|
||||
void createProfileConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user