mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-06 19:12:30 +01:00
Refactor workshop plugin to show forum when not installed
Replace upload popup with regular page
This commit is contained in:
parent
72c0fce5de
commit
7e029bcdf8
@ -92,5 +92,7 @@
|
||||
<file>qml/Create/StartInfoLinkImage.qml</file>
|
||||
<file>qml/Workshop/SteamProfile.qml</file>
|
||||
<file>qml/Workshop/SteamWorkshop.qml</file>
|
||||
<file>qml/Workshop/Forum.qml</file>
|
||||
<file>qml/Workshop/SteamWorkshopStartPage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -7,22 +7,31 @@ Rectangle {
|
||||
|
||||
property string backgroundImage: ""
|
||||
property int imageOffsetTop: 0
|
||||
property int stackViewDepth: 0
|
||||
onStackViewDepthChanged: {
|
||||
if (stackViewDepth > 1) {
|
||||
root.state = "backgroundBlur"
|
||||
return true
|
||||
}
|
||||
root.state = "backgroundImage"
|
||||
return false
|
||||
}
|
||||
|
||||
color: "#161C1D"
|
||||
onImageOffsetTopChanged: {
|
||||
if ((imageOffsetTop * -1) >= 200) {
|
||||
root.state = "backgroundColor";
|
||||
root.state = "backgroundColor"
|
||||
} else {
|
||||
if (root.state !== "backgroundImage")
|
||||
root.state = "backgroundImage";
|
||||
|
||||
root.state = "backgroundImage"
|
||||
}
|
||||
}
|
||||
|
||||
onBackgroundImageChanged: {
|
||||
if (backgroundImage === "")
|
||||
root.state = "";
|
||||
root.state = ""
|
||||
else
|
||||
root.state = "backgroundImage";
|
||||
root.state = "backgroundImage"
|
||||
}
|
||||
|
||||
Image {
|
||||
@ -68,11 +77,8 @@ Rectangle {
|
||||
position: 1
|
||||
color: "#161C1D"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MaskedBlur {
|
||||
@ -113,7 +119,6 @@ Rectangle {
|
||||
target: blur
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "backgroundImage"
|
||||
@ -131,8 +136,8 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
target: blur
|
||||
opacity: 0
|
||||
radius: 16
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "backgroundColor"
|
||||
@ -150,8 +155,27 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
target: blur
|
||||
opacity: 1
|
||||
radius: 16
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "backgroundBlur"
|
||||
|
||||
PropertyChanges {
|
||||
target: bgImage
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: bgColor
|
||||
opacity: 0.85
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: blur
|
||||
opacity: 1
|
||||
radius: 64
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
@ -166,7 +190,6 @@ Rectangle {
|
||||
easing.type: Easing.InOutQuart
|
||||
property: "opacity"
|
||||
}
|
||||
|
||||
},
|
||||
Transition {
|
||||
from: "backgroundImage"
|
||||
@ -179,7 +202,25 @@ Rectangle {
|
||||
easing.type: Easing.InOutQuart
|
||||
property: "opacity"
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "backgroundImage"
|
||||
to: "backgroundBlur"
|
||||
reversible: true
|
||||
|
||||
PropertyAnimation {
|
||||
targets: [bgImage, bgColor, blur]
|
||||
duration: 300
|
||||
easing.type: Easing.InOutQuart
|
||||
property: "opacity"
|
||||
}
|
||||
|
||||
PropertyAnimation {
|
||||
target: blur
|
||||
duration: 300
|
||||
easing.type: Easing.InOutQuart
|
||||
property: "radius"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
65
ScreenPlay/qml/Workshop/Forum.qml
Normal file
65
ScreenPlay/qml/Workshop/Forum.qml
Normal file
@ -0,0 +1,65 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtWebEngine 1.8
|
||||
import ScreenPlay 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
Rectangle {
|
||||
id: navWrapper
|
||||
|
||||
color: Material.theme === Material.Light ? "white" : Material.background
|
||||
height: 46
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors{
|
||||
fill: parent
|
||||
rightMargin: 20
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
spacing: 20
|
||||
Text {
|
||||
id: name
|
||||
text: qsTr("Download Wallpaper and Widgets from our forums manually. If you want to download Steam Workshop content you have to install ScreenPlay via Steam.")
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pointSize: 10
|
||||
font.family: ScreenPlay.settings.font
|
||||
color: Material.secondaryTextColor
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Install Steam Version")
|
||||
onClicked: Qt.openUrlExternally("https://store.steampowered.com/app/672870/ScreenPlay/")
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Open In Browser")
|
||||
onClicked: Qt.openUrlExternally("https://forum.screen-play.app/category/5/wallpaper")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: webView
|
||||
anchors {
|
||||
top: navWrapper.bottom
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
}
|
||||
url:"https://forum.screen-play.app/category/5/wallpaper"
|
||||
|
||||
}
|
||||
}
|
@ -11,12 +11,11 @@ import "../Common" as Common
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property ScreenPlayWorkshop workshop
|
||||
property SteamWorkshop steam
|
||||
property ScreenPlayWorkshop screenPlayWorkshop
|
||||
property SteamWorkshop steamWorkshop
|
||||
|
||||
signal requestWorkshopMainPage
|
||||
|
||||
Component.onCompleted: steam.requestUserItems()
|
||||
signal requestBack
|
||||
Component.onCompleted: steamWorkshop.requestUserItems()
|
||||
|
||||
Flickable {
|
||||
id: scrollView
|
||||
@ -48,7 +47,7 @@ Item {
|
||||
width: 70
|
||||
height: 70
|
||||
Component.onCompleted: {
|
||||
steam.steamAccount.loadAvatar()
|
||||
root.steamWorkshop.steamAccount.loadAvatar()
|
||||
}
|
||||
|
||||
Connections {
|
||||
@ -57,7 +56,7 @@ Item {
|
||||
avatarPlaceholder.opacity = 0
|
||||
}
|
||||
|
||||
target: steam.steamAccount
|
||||
target: root.steamWorkshop.steamAccount
|
||||
}
|
||||
Image {
|
||||
id: avatarPlaceholder
|
||||
@ -67,7 +66,7 @@ Item {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: steam.steamAccount.username
|
||||
text: root.steamWorkshop.steamAccount.username
|
||||
font.pointSize: 12
|
||||
color: "white"
|
||||
font.family: ScreenPlay.settings.font
|
||||
@ -76,7 +75,7 @@ Item {
|
||||
|
||||
Button {
|
||||
text: qsTr("Back")
|
||||
onClicked: root.requestWorkshopMainPage()
|
||||
onClicked: root.requestBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,7 +89,7 @@ Item {
|
||||
cellHeight: 190
|
||||
height: contentHeight
|
||||
interactive: false
|
||||
model: root.steam.workshopProfileListModel
|
||||
model: root.steamWorkshop.workshopProfileListModel
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
anchors {
|
||||
@ -108,7 +107,7 @@ Item {
|
||||
additionalPreviewUrl: m_additionalPreviewUrl
|
||||
subscriptionCount: m_subscriptionCount
|
||||
itemIndex: index
|
||||
steamWorkshop: root.steam
|
||||
steamWorkshop: root.steamWorkshop
|
||||
// onClicked: {
|
||||
// sidebar.setWorkshopItem(publishedFileID, imgUrl,
|
||||
// additionalPreviewUrl,
|
||||
@ -136,10 +135,10 @@ Item {
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Back")
|
||||
enabled: root.steam.workshopProfileListModel.currentPage > 1
|
||||
enabled: root.steamWorkshop.workshopProfileListModel.currentPage > 1
|
||||
onClicked: {
|
||||
root.steam.workshopProfileListModel.setCurrentPage(
|
||||
root.steam.workshopProfileListModel.currentPage - 1)
|
||||
root.steamWorkshop.workshopProfileListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopProfileListModel.currentPage - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,8 +146,8 @@ Item {
|
||||
id: txtPage
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: root.steam.workshopProfileListModel.currentPage + "/"
|
||||
+ root.steam.workshopProfileListModel.pages
|
||||
text: root.steamWorkshop.workshopProfileListModel.currentPage
|
||||
+ "/" + root.steamWorkshop.workshopProfileListModel.pages
|
||||
font.family: ScreenPlay.settings.font
|
||||
color: Material.primaryTextColor
|
||||
}
|
||||
@ -158,11 +157,11 @@ Item {
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Forward")
|
||||
enabled: root.steam.workshopProfileListModel.currentPage
|
||||
<= root.steam.workshopProfileListModel.pages - 1
|
||||
enabled: root.steamWorkshop.workshopProfileListModel.currentPage
|
||||
<= root.steamWorkshop.workshopProfileListModel.pages - 1
|
||||
onClicked: {
|
||||
root.steam.workshopProfileListModel.setCurrentPage(
|
||||
root.steam.workshopProfileListModel.currentPage + 1)
|
||||
root.steamWorkshop.workshopProfileListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopProfileListModel.currentPage + 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,520 +6,83 @@ import QtQuick.Layouts 1.12
|
||||
import Workshop 1.0
|
||||
import ScreenPlay 1.0
|
||||
import "upload/"
|
||||
import "../Common" as Common
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property ScreenPlayWorkshop workshop
|
||||
property SteamWorkshop steam
|
||||
|
||||
signal openSteamProfile
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible)
|
||||
sidebar.close()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (root.steam.online) {
|
||||
root.steam.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
} else {
|
||||
|
||||
popupOffline.open()
|
||||
ScreenPlayWorkshop {
|
||||
id: screenPlayWorkshop
|
||||
Component.onCompleted: {
|
||||
if (screenPlayWorkshop.init()) {
|
||||
stackView.push("qrc:/qml/Workshop/SteamWorkshopStartPage.qml", {
|
||||
"stackView": stackView,
|
||||
"screenPlayWorkshop": screenPlayWorkshop,
|
||||
"steamWorkshop": screenPlayWorkshop.steamWorkshop,
|
||||
"background": background
|
||||
})
|
||||
} else {
|
||||
popupOffline.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
enabled: gridView.count === 0
|
||||
z: enabled ? 10 : 0
|
||||
cursorShape: enabled ? Qt.WaitCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
propagateComposedEvents: true
|
||||
anchors.fill: parent
|
||||
preventStealing: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onWorkshopSearched() {
|
||||
bannerTxt.text = root.steam.workshopListModel.getBannerText()
|
||||
background.backgroundImage = root.steam.workshopListModel.getBannerUrl()
|
||||
banner.bannerPublishedFileID = root.steam.workshopListModel.getBannerID()
|
||||
bannerTxtUnderline.numberSubscriber
|
||||
= root.steam.workshopListModel.getBannerAmountSubscriber()
|
||||
}
|
||||
|
||||
target: root.steam
|
||||
}
|
||||
|
||||
Background {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
stackViewDepth: stackView.depth
|
||||
}
|
||||
|
||||
UploadProject {
|
||||
id: popupUploadProject
|
||||
screenPlayWorkshop: workshop
|
||||
|
||||
PopupOffline {
|
||||
id: popupOffline
|
||||
workshop: screenPlayWorkshop
|
||||
steam: screenPlayWorkshop.steamWorkshop
|
||||
}
|
||||
|
||||
PopupSteamWorkshopAgreement {
|
||||
id: popupSteamWorkshopAgreement
|
||||
}
|
||||
StackView {
|
||||
id: stackView
|
||||
property int duration: 300
|
||||
|
||||
Connections {
|
||||
function onUserNeedsToAcceptWorkshopLegalAgreement() {
|
||||
popupSteamWorkshopAgreement.open()
|
||||
Connections {
|
||||
target: stackView.currentItem
|
||||
ignoreUnknownSignals: true
|
||||
function onRequestBack() {
|
||||
stackView.pop()
|
||||
}
|
||||
}
|
||||
|
||||
target: root.steam.uploadListModel
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: scrollView
|
||||
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
contentHeight: gridView.height + header.height + 150
|
||||
onContentYChanged: {
|
||||
// Calculate parallax scrolling
|
||||
if (contentY >= 0)
|
||||
background.imageOffsetTop = (contentY * -0.4)
|
||||
else
|
||||
background.imageOffsetTop = 0
|
||||
}
|
||||
|
||||
Item {
|
||||
id: header
|
||||
|
||||
height: 450
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
replaceEnter: Transition {
|
||||
OpacityAnimator {
|
||||
from: 0
|
||||
to: 1
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
|
||||
Item {
|
||||
id: banner
|
||||
|
||||
property var bannerPublishedFileID
|
||||
|
||||
height: header.height
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Image {
|
||||
id: bannerImg2
|
||||
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 100
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
leftMargin: 100
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bannerTxtUnderline
|
||||
|
||||
property int numberSubscriber: 0
|
||||
|
||||
text: numberSubscriber + " SUBSCRIBED TO:"
|
||||
font.pointSize: 12
|
||||
color: "white"
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bannerTxt
|
||||
|
||||
text: qsTr("Loading")
|
||||
font.pointSize: 42
|
||||
color: "white"
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
width: 400
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
text: qsTr("Download now!")
|
||||
Material.background: Material.accent
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_download.svg"
|
||||
onClicked: {
|
||||
text = qsTr("Downloading...")
|
||||
root.steam.subscribeItem(
|
||||
root.steam.workshopListModel.getBannerID(
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Details")
|
||||
Material.background: Material.accent
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_info.svg"
|
||||
visible: false
|
||||
onClicked: {
|
||||
sidebar.setWorkshopItem(publishedFileID,
|
||||
imgUrl,
|
||||
additionalPreviewUrl,
|
||||
subscriptionCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
onClicked: Qt.openUrlExternally(
|
||||
"steam://url/CommunityFilePage/"
|
||||
+ banner.bannerPublishedFileID)
|
||||
height: 30
|
||||
width: bannerTxtOpenInSteam.paintedWidth
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
Text {
|
||||
id: bannerTxtOpenInSteam
|
||||
|
||||
opacity: 0.7
|
||||
text: qsTr("Open In Steam")
|
||||
font.pointSize: 10
|
||||
color: "white"
|
||||
font.underline: true
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cellWidth: 330
|
||||
cellHeight: 190
|
||||
height: contentHeight
|
||||
interactive: false
|
||||
model: root.steam.workshopListModel
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
anchors {
|
||||
top: header.bottom
|
||||
topMargin: 100
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 45
|
||||
}
|
||||
|
||||
header: Item {
|
||||
property alias searchField: tiSearch
|
||||
|
||||
height: 80
|
||||
width: gridView.width - gridView.anchors.leftMargin
|
||||
|
||||
Rectangle {
|
||||
color: Material.backgroundColor
|
||||
radius: 3
|
||||
width: parent.width - 20
|
||||
height: 70
|
||||
anchors.centerIn: parent
|
||||
|
||||
SteamImage {
|
||||
id: avatar
|
||||
|
||||
width: 70
|
||||
height: 70
|
||||
Component.onCompleted: {
|
||||
steam.steamAccount.loadAvatar()
|
||||
}
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onAvatarChanged(_avatar) {
|
||||
avatar.setImage(_avatar)
|
||||
avatarPlaceholder.opacity = 0
|
||||
}
|
||||
|
||||
target: steam.steamAccount
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: avatarPlaceholder
|
||||
anchors.fill: avatar
|
||||
source: "qrc:/assets/icons/steam_default_avatar.png"
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnSteamProfile
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: avatar.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
text: qsTr("Profile")
|
||||
onClicked: root.openSteamProfile()
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnSteamUpload
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: btnSteamProfile.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
text: qsTr("Upload")
|
||||
onClicked: popupUploadProject.open()
|
||||
}
|
||||
|
||||
Item {
|
||||
id: searchWrapper
|
||||
|
||||
width: 400
|
||||
height: 50
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: btnSteamUpload.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: tiSearch
|
||||
placeholderText: qsTr("Search for Wallpaper and Widgets...")
|
||||
onEditingFinished: root.steam.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: tb
|
||||
icon.source: "qrc:/assets/icons/icon_search.svg"
|
||||
onClicked: root.steam.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
icon.width: 20
|
||||
icon.height: 20
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
|
||||
anchors {
|
||||
left: searchWrapper.right
|
||||
leftMargin: 20
|
||||
right: cbQuerySort.left
|
||||
rightMargin: 20
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Open Workshop in Steam")
|
||||
font.capitalization: Font.Capitalize
|
||||
font.family: ScreenPlay.settings.font
|
||||
onClicked: Qt.openUrlExternally(
|
||||
"steam://url/SteamWorkshopPage/672870")
|
||||
icon.source: "qrc:/assets/icons/icon_steam.svg"
|
||||
icon.width: 18
|
||||
icon.height: 18
|
||||
height: cbQuerySort.height
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: cbQuerySort
|
||||
|
||||
width: 220
|
||||
height: searchWrapper.height
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
currentIndex: 2
|
||||
Layout.preferredHeight: searchWrapper.height
|
||||
font.family: ScreenPlay.settings.font
|
||||
model: [{
|
||||
"value": SteamEnums.k_EUGCQuery_RankedByVote,
|
||||
"text": qsTr("Ranked By Vote")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByPublicationDate,
|
||||
"text": qsTr("Publication Date")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTrend,
|
||||
"text": qsTr("Ranked By Trend")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate,
|
||||
"text": qsTr("Favorited By Friends")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate,
|
||||
"text": qsTr("Created By Friends")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate,
|
||||
"text": qsTr("Created By Followed Users")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_NotYetRated,
|
||||
"text": qsTr("Not Yet Rated")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc,
|
||||
"text": qsTr("Total VotesAsc")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByVotesUp,
|
||||
"text": qsTr("Votes Up")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions,
|
||||
"text": qsTr("Total Unique Subscriptions")
|
||||
}]
|
||||
onActivated: {
|
||||
root.steam.searchWorkshop(cbQuerySort.currentValue)
|
||||
}
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate: WorkshopItem {
|
||||
imgUrl: m_workshopPreview
|
||||
name: m_workshopTitle
|
||||
publishedFileID: m_publishedFileID
|
||||
additionalPreviewUrl: m_additionalPreviewUrl
|
||||
subscriptionCount: m_subscriptionCount
|
||||
itemIndex: index
|
||||
steamWorkshop: root.steam
|
||||
onClicked: {
|
||||
sidebar.setWorkshopItem(publishedFileID, imgUrl,
|
||||
additionalPreviewUrl,
|
||||
subscriptionCount)
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: workshopScrollBar
|
||||
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
|
||||
footer: RowLayout {
|
||||
height: 150
|
||||
width: parent.width
|
||||
spacing: 10
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnBack
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Back")
|
||||
enabled: root.steam.workshopListModel.currentPage > 1
|
||||
onClicked: {
|
||||
root.steam.workshopListModel.setCurrentPage(
|
||||
root.steam.workshopListModel.currentPage - 1)
|
||||
root.steam.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtPage
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: root.steam.workshopListModel.currentPage + "/"
|
||||
+ root.steam.workshopListModel.pages
|
||||
font.family: ScreenPlay.settings.font
|
||||
color: Material.primaryTextColor
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnForward
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Forward")
|
||||
enabled: root.steam.workshopListModel.currentPage
|
||||
<= root.steam.workshopListModel.pages - 1
|
||||
onClicked: {
|
||||
root.steam.workshopListModel.setCurrentPage(
|
||||
root.steam.workshopListModel.currentPage + 1)
|
||||
root.steam.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on contentHeight {
|
||||
PropertyAnimation {
|
||||
duration: 400
|
||||
property: "contentHeight"
|
||||
ScaleAnimator {
|
||||
from: 0.8
|
||||
to: 1
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
}
|
||||
replaceExit: Transition {
|
||||
OpacityAnimator {
|
||||
from: 1
|
||||
to: 0
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
|
||||
Sidebar {
|
||||
id: sidebar
|
||||
|
||||
topMargin: 60
|
||||
steamWorkshop: root.steam
|
||||
onTagClicked: {
|
||||
gridView.headerItem.searchField.text = tag
|
||||
sidebar.close()
|
||||
ScaleAnimator {
|
||||
from: 1
|
||||
to: 0.8
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
525
ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml
Normal file
525
ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml
Normal file
@ -0,0 +1,525 @@
|
||||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Controls.Material 2.13
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Layouts 1.12
|
||||
import Workshop 1.0
|
||||
import ScreenPlay 1.0
|
||||
import "upload/"
|
||||
import "../Common" as Common
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property SteamWorkshop steamWorkshop
|
||||
property ScreenPlayWorkshop screenPlayWorkshop
|
||||
property StackView stackView
|
||||
property Background background
|
||||
|
||||
Component.onCompleted: {
|
||||
root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible)
|
||||
sidebar.close()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
enabled: gridView.count === 0
|
||||
z: enabled ? 10 : 0
|
||||
cursorShape: enabled ? Qt.WaitCursor : Qt.ArrowCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
propagateComposedEvents: true
|
||||
anchors.fill: parent
|
||||
preventStealing: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onWorkshopSearched() {
|
||||
bannerTxt.text = root.steamWorkshop.workshopListModel.getBannerText(
|
||||
)
|
||||
background.backgroundImage = root.steamWorkshop.workshopListModel.getBannerUrl()
|
||||
banner.bannerPublishedFileID = root.steamWorkshop.workshopListModel.getBannerID()
|
||||
bannerTxtUnderline.numberSubscriber
|
||||
= root.steamWorkshop.workshopListModel.getBannerAmountSubscriber()
|
||||
}
|
||||
|
||||
target: root.steamWorkshop
|
||||
}
|
||||
|
||||
PopupSteamWorkshopAgreement {
|
||||
id: popupSteamWorkshopAgreement
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onUserNeedsToAcceptWorkshopLegalAgreement() {
|
||||
popupSteamWorkshopAgreement.open()
|
||||
}
|
||||
|
||||
target: root.steamWorkshop.uploadListModel
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: scrollView
|
||||
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
contentHeight: gridView.height + header.height + 150
|
||||
onContentYChanged: {
|
||||
// Calculate parallax scrolling
|
||||
if (contentY >= 0)
|
||||
background.imageOffsetTop = (contentY * -0.4)
|
||||
else
|
||||
background.imageOffsetTop = 0
|
||||
}
|
||||
|
||||
Item {
|
||||
id: header
|
||||
|
||||
height: 450
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Item {
|
||||
id: banner
|
||||
|
||||
property var bannerPublishedFileID
|
||||
|
||||
height: header.height
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Image {
|
||||
id: bannerImg2
|
||||
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 100
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
leftMargin: 100
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bannerTxtUnderline
|
||||
|
||||
property int numberSubscriber: 0
|
||||
|
||||
text: numberSubscriber + " SUBSCRIBED TO:"
|
||||
font.pointSize: 12
|
||||
color: "white"
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
}
|
||||
|
||||
Text {
|
||||
id: bannerTxt
|
||||
|
||||
text: qsTr("Loading")
|
||||
font.pointSize: 42
|
||||
color: "white"
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
width: 400
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
text: qsTr("Download now!")
|
||||
Material.background: Material.accent
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_download.svg"
|
||||
onClicked: {
|
||||
text = qsTr("Downloading...")
|
||||
root.steamWorkshop.subscribeItem(
|
||||
root.steamWorkshop.workshopListModel.getBannerID(
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Details")
|
||||
Material.background: Material.accent
|
||||
Material.foreground: "white"
|
||||
icon.source: "qrc:/assets/icons/icon_info.svg"
|
||||
visible: false
|
||||
onClicked: {
|
||||
sidebar.setWorkshopItem(publishedFileID,
|
||||
imgUrl,
|
||||
additionalPreviewUrl,
|
||||
subscriptionCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
onClicked: Qt.openUrlExternally(
|
||||
"steam://url/CommunityFilePage/"
|
||||
+ banner.bannerPublishedFileID)
|
||||
height: 30
|
||||
width: bannerTxtOpenInSteam.paintedWidth
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
Text {
|
||||
id: bannerTxtOpenInSteam
|
||||
|
||||
opacity: 0.7
|
||||
text: qsTr("Open In Steam")
|
||||
font.pointSize: 10
|
||||
color: "white"
|
||||
font.underline: true
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cellWidth: 330
|
||||
cellHeight: 190
|
||||
height: contentHeight
|
||||
interactive: false
|
||||
model: root.steamWorkshop.workshopListModel
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
anchors {
|
||||
top: header.bottom
|
||||
topMargin: 100
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 45
|
||||
}
|
||||
|
||||
header: Item {
|
||||
property alias searchField: tiSearch
|
||||
|
||||
height: 80
|
||||
width: gridView.width - gridView.anchors.leftMargin
|
||||
|
||||
Rectangle {
|
||||
color: Material.backgroundColor
|
||||
radius: 3
|
||||
width: parent.width - 20
|
||||
height: 70
|
||||
anchors.centerIn: parent
|
||||
|
||||
SteamImage {
|
||||
id: avatar
|
||||
|
||||
width: 70
|
||||
height: 70
|
||||
Component.onCompleted: {
|
||||
steamWorkshop.steamAccount.loadAvatar()
|
||||
}
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onAvatarChanged(_avatar) {
|
||||
avatar.setImage(_avatar)
|
||||
avatarPlaceholder.opacity = 0
|
||||
}
|
||||
|
||||
target: steamWorkshop.steamAccount
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: avatarPlaceholder
|
||||
anchors.fill: avatar
|
||||
source: "qrc:/assets/icons/steam_default_avatar.png"
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnSteamProfile
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: avatar.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
text: qsTr("Profile")
|
||||
onClicked: {
|
||||
stackView.push(
|
||||
"qrc:/qml/Workshop/SteamProfile.qml", {
|
||||
"screenPlayWorkshop": root.screenPlayWorkshop,
|
||||
"steamWorkshop": root.steamWorkshop
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnSteamUpload
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: btnSteamProfile.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
text: qsTr("Upload")
|
||||
onClicked: {
|
||||
stackView.push(
|
||||
"qrc:/qml/Workshop/upload/UploadProject.qml", {
|
||||
"screenPlayWorkshop": root.screenPlayWorkshop,
|
||||
"steamWorkshop": root.steamWorkshop
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: searchWrapper
|
||||
|
||||
width: 400
|
||||
height: 50
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: btnSteamUpload.right
|
||||
leftMargin: 20
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: tiSearch
|
||||
placeholderText: qsTr("Search for Wallpaper and Widgets...")
|
||||
onEditingFinished: root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: tb
|
||||
icon.source: "qrc:/assets/icons/icon_search.svg"
|
||||
onClicked: root.steamWorkshop.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
icon.width: 20
|
||||
icon.height: 20
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 20
|
||||
|
||||
anchors {
|
||||
left: searchWrapper.right
|
||||
leftMargin: 20
|
||||
right: cbQuerySort.left
|
||||
rightMargin: 20
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Open Workshop in Steam")
|
||||
font.capitalization: Font.Capitalize
|
||||
font.family: ScreenPlay.settings.font
|
||||
onClicked: Qt.openUrlExternally(
|
||||
"steam://url/SteamWorkshopPage/672870")
|
||||
icon.source: "qrc:/assets/icons/icon_steam.svg"
|
||||
icon.width: 18
|
||||
icon.height: 18
|
||||
height: cbQuerySort.height
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: cbQuerySort
|
||||
|
||||
width: 220
|
||||
height: searchWrapper.height
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
currentIndex: 2
|
||||
Layout.preferredHeight: searchWrapper.height
|
||||
font.family: ScreenPlay.settings.font
|
||||
model: [{
|
||||
"value": SteamEnums.k_EUGCQuery_RankedByVote,
|
||||
"text": qsTr("Ranked By Vote")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByPublicationDate,
|
||||
"text": qsTr("Publication Date")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTrend,
|
||||
"text": qsTr("Ranked By Trend")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate,
|
||||
"text": qsTr("Favorited By Friends")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate,
|
||||
"text": qsTr("Created By Friends")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate,
|
||||
"text": qsTr("Created By Followed Users")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_NotYetRated,
|
||||
"text": qsTr("Not Yet Rated")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc,
|
||||
"text": qsTr("Total VotesAsc")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByVotesUp,
|
||||
"text": qsTr("Votes Up")
|
||||
}, {
|
||||
"value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions,
|
||||
"text": qsTr("Total Unique Subscriptions")
|
||||
}]
|
||||
onActivated: {
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
cbQuerySort.currentValue)
|
||||
}
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate: WorkshopItem {
|
||||
imgUrl: m_workshopPreview
|
||||
name: m_workshopTitle
|
||||
publishedFileID: m_publishedFileID
|
||||
additionalPreviewUrl: m_additionalPreviewUrl
|
||||
subscriptionCount: m_subscriptionCount
|
||||
itemIndex: index
|
||||
steamWorkshop: root.steamWorkshop
|
||||
onClicked: {
|
||||
sidebar.setWorkshopItem(publishedFileID, imgUrl,
|
||||
additionalPreviewUrl,
|
||||
subscriptionCount)
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: workshopScrollBar
|
||||
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
|
||||
footer: RowLayout {
|
||||
height: 150
|
||||
width: parent.width
|
||||
spacing: 10
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnBack
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Back")
|
||||
enabled: root.steamWorkshop.workshopListModel.currentPage > 1
|
||||
onClicked: {
|
||||
root.steamWorkshop.workshopListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopListModel.currentPage - 1)
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtPage
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: root.steamWorkshop.workshopListModel.currentPage + "/"
|
||||
+ root.steamWorkshop.workshopListModel.pages
|
||||
font.family: ScreenPlay.settings.font
|
||||
color: Material.primaryTextColor
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnForward
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Forward")
|
||||
enabled: root.steamWorkshop.workshopListModel.currentPage
|
||||
<= root.steamWorkshop.workshopListModel.pages - 1
|
||||
onClicked: {
|
||||
root.steamWorkshop.workshopListModel.setCurrentPage(
|
||||
root.steamWorkshop.workshopListModel.currentPage + 1)
|
||||
root.steamWorkshop.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on contentHeight {
|
||||
PropertyAnimation {
|
||||
duration: 400
|
||||
property: "contentHeight"
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar {
|
||||
id: sidebar
|
||||
|
||||
topMargin: 60
|
||||
steamWorkshop: root.steamWorkshop
|
||||
onTagClicked: {
|
||||
gridView.headerItem.searchField.text = tag
|
||||
sidebar.close()
|
||||
}
|
||||
}
|
||||
}
|
@ -3,84 +3,23 @@ import QtQuick.Controls 2.13
|
||||
import QtQuick.Controls.Material 2.13
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Layouts 1.12
|
||||
import Workshop 1.0
|
||||
import Settings 1.0
|
||||
import ScreenPlay 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
ScreenPlayWorkshop {
|
||||
id: ws
|
||||
|
||||
Component.onCompleted: {
|
||||
const success = ws.init();
|
||||
if(success){
|
||||
stackView.push("qrc:/qml/Workshop/SteamWorkshop.qml", {
|
||||
"workshop": ws,
|
||||
"steam": ws.steamWorkshop
|
||||
})
|
||||
} else {
|
||||
popupOffline.open()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (ScreenPlay.settings.steamVersion) {
|
||||
workshopLoader.setSource("qrc:/qml/Workshop/SteamWorkshop.qml")
|
||||
} else {
|
||||
workshopLoader.setSource("qrc:/qml/Workshop/Forum.qml")
|
||||
}
|
||||
}
|
||||
|
||||
PopupOffline {
|
||||
id: popupOffline
|
||||
workshop: ws
|
||||
steam: ws.steamWorkshop
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: stackView
|
||||
|
||||
property int duration: 300
|
||||
|
||||
Connections {
|
||||
target: stackView.currentItem
|
||||
ignoreUnknownSignals: true
|
||||
function onOpenSteamProfile(){
|
||||
stackView.push("qrc:/qml/Workshop/SteamProfile.qml", {
|
||||
"workshop": ws,
|
||||
"steam": ws.steamWorkshop
|
||||
})
|
||||
}
|
||||
function onRequestWorkshopMainPage(){
|
||||
stackView.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: workshopLoader
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
replaceEnter: Transition {
|
||||
OpacityAnimator {
|
||||
from: 0
|
||||
to: 1
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
|
||||
ScaleAnimator {
|
||||
from: 0.8
|
||||
to: 1
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
}
|
||||
|
||||
replaceExit: Transition {
|
||||
OpacityAnimator {
|
||||
from: 1
|
||||
to: 0
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
|
||||
ScaleAnimator {
|
||||
from: 1
|
||||
to: 0.8
|
||||
duration: stackView.duration
|
||||
easing.type: Easing.InOutQuart
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,250 +5,215 @@ import QtQuick.Layouts 1.12
|
||||
import Workshop 1.0
|
||||
import ScreenPlay 1.0
|
||||
|
||||
Popup {
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property ScreenPlayWorkshop screenPlayWorkshop
|
||||
property SteamWorkshop steam: screenPlayWorkshop.steamWorkshop
|
||||
property SteamWorkshop steamWorkshop
|
||||
|
||||
width: 1200
|
||||
height: 700
|
||||
modal: true
|
||||
dim: true
|
||||
anchors.centerIn: Overlay.overlay
|
||||
closePolicy: Popup.NoAutoClose
|
||||
onAboutToShow: uploadLoader.sourceComponent = com
|
||||
onAboutToHide: uploadLoader.sourceComponent = undefined
|
||||
signal requestBack
|
||||
|
||||
Loader {
|
||||
id: uploadLoader
|
||||
Item {
|
||||
id: headerWrapper
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
height: 50
|
||||
|
||||
Connections {
|
||||
function onRequestClosePopup() {
|
||||
root.close()
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
target: uploadLoader.item
|
||||
Text {
|
||||
id: txtHeadline
|
||||
|
||||
text: qsTr("Upload Wallpaper/Widgets to Steam")
|
||||
color: Material.foreground
|
||||
font.pointSize: 21
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: com
|
||||
SwipeView {
|
||||
id: view
|
||||
|
||||
clip: true
|
||||
currentIndex: 0
|
||||
interactive: false
|
||||
|
||||
anchors {
|
||||
top: headerWrapper.bottom
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
Item {
|
||||
id: wrapper
|
||||
id: firstPage
|
||||
|
||||
signal requestClosePopup
|
||||
GridView {
|
||||
id: gridView
|
||||
|
||||
Item {
|
||||
id: headerWrapper
|
||||
|
||||
height: 50
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cellWidth: parent.width
|
||||
cellHeight: 250
|
||||
clip: true
|
||||
model: screenPlayWorkshop.installedListModel
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: btnAbort.top
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtHeadline
|
||||
delegate: UploadProjectBigItem {
|
||||
id: delegate
|
||||
|
||||
text: qsTr("Upload Wallpaper/Widgets to Steam")
|
||||
color: Material.foreground
|
||||
font.pointSize: 21
|
||||
font.family: ScreenPlay.settings.font
|
||||
font.weight: Font.Thin
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
focus: true
|
||||
width: gridView.cellWidth - 30
|
||||
customTitle: m_title
|
||||
type: m_type
|
||||
screenId: m_folderId
|
||||
absoluteStoragePath: m_absoluteStoragePath
|
||||
publishedFileID: m_publishedFileID
|
||||
preview: m_preview
|
||||
itemIndex: index
|
||||
onItemClicked: {
|
||||
for (let childItem in gridView.contentItem.children) {
|
||||
if (gridView.contentItem.children[childItem].isSelected) {
|
||||
btnUploadProjects.enabled = true
|
||||
return
|
||||
}
|
||||
}
|
||||
btnUploadProjects.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
policy: ScrollBar.AlwaysOn
|
||||
}
|
||||
}
|
||||
|
||||
SwipeView {
|
||||
id: view
|
||||
Button {
|
||||
id: btnAbort
|
||||
|
||||
clip: true
|
||||
currentIndex: 0
|
||||
interactive: false
|
||||
text: qsTr("Abort")
|
||||
onClicked: {
|
||||
root.requestBack()
|
||||
}
|
||||
|
||||
anchors {
|
||||
top: headerWrapper.bottom
|
||||
right: parent.right
|
||||
right: btnUploadProjects.left
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
Item {
|
||||
id: firstPage
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cellWidth: parent.width
|
||||
cellHeight: 250
|
||||
clip: true
|
||||
model: screenPlayWorkshop.installedListModel
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: btnAbort.top
|
||||
left: parent.left
|
||||
margins: 10
|
||||
}
|
||||
|
||||
delegate: UploadProjectBigItem {
|
||||
id: delegate
|
||||
|
||||
focus: true
|
||||
width: gridView.cellWidth - 30
|
||||
customTitle: m_title
|
||||
type: m_type
|
||||
screenId: m_folderId
|
||||
absoluteStoragePath: m_absoluteStoragePath
|
||||
publishedFileID: m_publishedFileID
|
||||
preview: m_preview
|
||||
itemIndex: index
|
||||
onItemClicked: {
|
||||
for (let childItem in gridView.contentItem.children) {
|
||||
if (gridView.contentItem.children[childItem].isSelected) {
|
||||
btnUploadProjects.enabled = true
|
||||
return
|
||||
}
|
||||
}
|
||||
btnUploadProjects.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
policy: ScrollBar.AlwaysOn
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnAbort
|
||||
|
||||
text: qsTr("Abort")
|
||||
onClicked: {
|
||||
wrapper.requestClosePopup()
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: btnUploadProjects.left
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnUploadProjects
|
||||
|
||||
text: qsTr("Upload Selected Projects")
|
||||
highlighted: true
|
||||
enabled: false
|
||||
onClicked: {
|
||||
var uploadListArray = []
|
||||
for (let childItem in gridView.contentItem.children) {
|
||||
if (gridView.contentItem.children[childItem].isSelected)
|
||||
uploadListArray.push(
|
||||
gridView.contentItem.children[childItem].absoluteStoragePath)
|
||||
}
|
||||
view.currentIndex = 1
|
||||
steam.bulkUploadToWorkshop(uploadListArray)
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: secondPage
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cacheBuffer: 1000
|
||||
clip: true
|
||||
model: steam.uploadListModel
|
||||
width: parent.width - 50
|
||||
spacing: 25
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
|
||||
delegate: UploadProjectItem {
|
||||
previewImagePath: m_absolutePreviewImagePath
|
||||
progress: m_uploadProgress
|
||||
name: m_name
|
||||
steamStatus: m_status
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnFinish
|
||||
|
||||
text: qsTr("Finish")
|
||||
highlighted: true
|
||||
enabled: false
|
||||
onClicked: {
|
||||
root.close()
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onUploadCompleted() {
|
||||
btnFinish.enabled = true
|
||||
}
|
||||
|
||||
target: steam.uploadListModel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
id: indicator
|
||||
Button {
|
||||
id: btnUploadProjects
|
||||
|
||||
count: view.count
|
||||
currentIndex: view.currentIndex
|
||||
anchors.bottom: view.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: qsTr("Upload Selected Projects")
|
||||
highlighted: true
|
||||
enabled: false
|
||||
onClicked: {
|
||||
var uploadListArray = []
|
||||
for (let childItem in gridView.contentItem.children) {
|
||||
if (gridView.contentItem.children[childItem].isSelected)
|
||||
uploadListArray.push(
|
||||
gridView.contentItem.children[childItem].absoluteStoragePath)
|
||||
}
|
||||
view.currentIndex = 1
|
||||
root.steamWorkshop.bulkUploadToWorkshop(uploadListArray)
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: secondPage
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
|
||||
boundsBehavior: Flickable.DragOverBounds
|
||||
maximumFlickVelocity: 7000
|
||||
flickDeceleration: 5000
|
||||
cacheBuffer: 1000
|
||||
clip: true
|
||||
model: root.steamWorkshop.uploadListModel
|
||||
width: parent.width - 50
|
||||
spacing: 25
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
|
||||
delegate: UploadProjectItem {
|
||||
previewImagePath: m_absolutePreviewImagePath
|
||||
progress: m_uploadProgress
|
||||
name: m_name
|
||||
steamStatus: m_status
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
snapMode: ScrollBar.SnapOnRelease
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: btnFinish
|
||||
|
||||
text: qsTr("Finish")
|
||||
highlighted: true
|
||||
enabled: false
|
||||
onClicked: {
|
||||
root.requestBack()
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: 10
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onUploadCompleted() {
|
||||
btnFinish.enabled = true
|
||||
}
|
||||
|
||||
target: root.steamWorkshop.uploadListModel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: Material.theme === Material.Light ? "white" : Material.background
|
||||
PageIndicator {
|
||||
id: indicator
|
||||
|
||||
count: view.count
|
||||
currentIndex: view.currentIndex
|
||||
anchors.bottom: view.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ Item {
|
||||
|
||||
Image {
|
||||
id: screenPlayItemImage
|
||||
|
||||
asynchronous: true
|
||||
width: 400
|
||||
source: Qt.resolvedUrl(root.absoluteStoragePath + "/" + root.preview)
|
||||
source: root.preview !== "" ? Qt.resolvedUrl(root.absoluteStoragePath + "/" + root.preview) : ""
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
|
@ -4,9 +4,9 @@ import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls.Material.impl 2.12
|
||||
import Workshop 1.0
|
||||
|
||||
Page {
|
||||
// Everyting that is not OK is a fail. See steam_qt_enums_generated.h
|
||||
|
||||
id: root
|
||||
|
||||
@ -20,6 +20,7 @@ Page {
|
||||
anchors.centerIn: parent
|
||||
padding: 20
|
||||
onPreviewImagePathChanged: img.source = Qt.resolvedUrl("file:///" + previewImagePath)
|
||||
// Everyting that is not OK is a fail. See steam_qt_enums_generated.h
|
||||
onSteamStatusChanged: {
|
||||
let errorText;
|
||||
switch (steamStatus) {
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@
|
||||
|
||||
void ScreenPlayWorkshopPlugin::registerTypes(const char* uri)
|
||||
{
|
||||
qInfo() << "void ScreenPlayWorkshopPlugin::registerTypes(const char* uri)";
|
||||
qRegisterMetaType<ScreenPlayWorkshop::SteamQMLImageProvider*>("SteamQMLImageProvider*");
|
||||
qmlRegisterType<ScreenPlayWorkshop::SteamQMLImageProvider>("Workshop", 1, 0, "SteamImage");
|
||||
|
||||
|
@ -33,7 +33,6 @@ bool SteamWorkshop::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// https://partner.steamgames.com/doc/sdk/api#SteamAPI_RestartAppIfNecessary
|
||||
// checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.
|
||||
// This is optional but highly recommended as the Steam context associated with your application (including your App ID) will not be set up if the user launches the executable directly. If this occurs then SteamAPI_Init will fail and you will be unable to use the Steamworks API.
|
||||
@ -45,7 +44,6 @@ bool SteamWorkshop::init()
|
||||
m_steamErrorRestart = true;
|
||||
}
|
||||
|
||||
|
||||
QObject::connect(&m_pollTimer, &QTimer::timeout, this, []() { SteamAPI_RunCallbacks(); });
|
||||
m_pollTimer.start(100);
|
||||
|
||||
@ -230,8 +228,6 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
||||
bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listModel, SteamUGCQueryCompleted_t* pCallback)
|
||||
{
|
||||
|
||||
qDebug() << "queryWorkshopItemFromHandle " << pCallback->m_unNumResultsReturned << pCallback->m_unTotalMatchingResults;
|
||||
|
||||
SteamUGCDetails_t details;
|
||||
const int urlLength = 200;
|
||||
char url[urlLength];
|
||||
|
@ -49,10 +49,16 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
|
||||
return;
|
||||
}
|
||||
|
||||
QString absoluteContentPath = m_absolutePath.toString();
|
||||
const QString absoluteContentPath = ScreenPlayUtil::toLocal(m_absolutePath.toString());
|
||||
|
||||
auto jsonObjectOpt = ScreenPlayUtil::openJsonFileToObject(absoluteContentPath + "/project.json");
|
||||
|
||||
if (!jsonObjectOpt.has_value()) {
|
||||
qWarning() << "Unable to load project file";
|
||||
emit removeThis(this);
|
||||
return;
|
||||
}
|
||||
|
||||
auto jsonObject = jsonObjectOpt.value();
|
||||
QString preview = absoluteContentPath + "/" + jsonObject.value("preview").toString();
|
||||
setAbsolutePreviewImagePath(preview);
|
||||
|
Loading…
Reference in New Issue
Block a user