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

Refactor workshop plugin to show forum when not installed

Replace upload popup with regular page
This commit is contained in:
Elias Steurer 2021-09-23 15:55:40 +02:00
parent 72c0fce5de
commit 7e029bcdf8
33 changed files with 13668 additions and 13649 deletions

View File

@ -92,5 +92,7 @@
<file>qml/Create/StartInfoLinkImage.qml</file> <file>qml/Create/StartInfoLinkImage.qml</file>
<file>qml/Workshop/SteamProfile.qml</file> <file>qml/Workshop/SteamProfile.qml</file>
<file>qml/Workshop/SteamWorkshop.qml</file> <file>qml/Workshop/SteamWorkshop.qml</file>
<file>qml/Workshop/Forum.qml</file>
<file>qml/Workshop/SteamWorkshopStartPage.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -7,22 +7,31 @@ Rectangle {
property string backgroundImage: "" property string backgroundImage: ""
property int imageOffsetTop: 0 property int imageOffsetTop: 0
property int stackViewDepth: 0
onStackViewDepthChanged: {
if (stackViewDepth > 1) {
root.state = "backgroundBlur"
return true
}
root.state = "backgroundImage"
return false
}
color: "#161C1D" color: "#161C1D"
onImageOffsetTopChanged: { onImageOffsetTopChanged: {
if ((imageOffsetTop * -1) >= 200) { if ((imageOffsetTop * -1) >= 200) {
root.state = "backgroundColor"; root.state = "backgroundColor"
} else { } else {
if (root.state !== "backgroundImage") if (root.state !== "backgroundImage")
root.state = "backgroundImage"; root.state = "backgroundImage"
} }
} }
onBackgroundImageChanged: { onBackgroundImageChanged: {
if (backgroundImage === "") if (backgroundImage === "")
root.state = ""; root.state = ""
else else
root.state = "backgroundImage"; root.state = "backgroundImage"
} }
Image { Image {
@ -68,11 +77,8 @@ Rectangle {
position: 1 position: 1
color: "#161C1D" color: "#161C1D"
} }
} }
} }
} }
MaskedBlur { MaskedBlur {
@ -113,7 +119,6 @@ Rectangle {
target: blur target: blur
opacity: 0 opacity: 0
} }
}, },
State { State {
name: "backgroundImage" name: "backgroundImage"
@ -131,8 +136,8 @@ Rectangle {
PropertyChanges { PropertyChanges {
target: blur target: blur
opacity: 0 opacity: 0
radius: 16
} }
}, },
State { State {
name: "backgroundColor" name: "backgroundColor"
@ -150,8 +155,27 @@ Rectangle {
PropertyChanges { PropertyChanges {
target: blur target: blur
opacity: 1 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: [ transitions: [
@ -166,7 +190,6 @@ Rectangle {
easing.type: Easing.InOutQuart easing.type: Easing.InOutQuart
property: "opacity" property: "opacity"
} }
}, },
Transition { Transition {
from: "backgroundImage" from: "backgroundImage"
@ -179,7 +202,25 @@ Rectangle {
easing.type: Easing.InOutQuart easing.type: Easing.InOutQuart
property: "opacity" 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"
}
} }
] ]
} }

View 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"
}
}

View File

@ -11,12 +11,11 @@ import "../Common" as Common
Item { Item {
id: root id: root
property ScreenPlayWorkshop workshop property ScreenPlayWorkshop screenPlayWorkshop
property SteamWorkshop steam property SteamWorkshop steamWorkshop
signal requestWorkshopMainPage signal requestBack
Component.onCompleted: steamWorkshop.requestUserItems()
Component.onCompleted: steam.requestUserItems()
Flickable { Flickable {
id: scrollView id: scrollView
@ -48,7 +47,7 @@ Item {
width: 70 width: 70
height: 70 height: 70
Component.onCompleted: { Component.onCompleted: {
steam.steamAccount.loadAvatar() root.steamWorkshop.steamAccount.loadAvatar()
} }
Connections { Connections {
@ -57,7 +56,7 @@ Item {
avatarPlaceholder.opacity = 0 avatarPlaceholder.opacity = 0
} }
target: steam.steamAccount target: root.steamWorkshop.steamAccount
} }
Image { Image {
id: avatarPlaceholder id: avatarPlaceholder
@ -67,7 +66,7 @@ Item {
} }
Text { Text {
text: steam.steamAccount.username text: root.steamWorkshop.steamAccount.username
font.pointSize: 12 font.pointSize: 12
color: "white" color: "white"
font.family: ScreenPlay.settings.font font.family: ScreenPlay.settings.font
@ -76,7 +75,7 @@ Item {
Button { Button {
text: qsTr("Back") text: qsTr("Back")
onClicked: root.requestWorkshopMainPage() onClicked: root.requestBack()
} }
} }
} }
@ -90,7 +89,7 @@ Item {
cellHeight: 190 cellHeight: 190
height: contentHeight height: contentHeight
interactive: false interactive: false
model: root.steam.workshopProfileListModel model: root.steamWorkshop.workshopProfileListModel
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
anchors { anchors {
@ -108,7 +107,7 @@ Item {
additionalPreviewUrl: m_additionalPreviewUrl additionalPreviewUrl: m_additionalPreviewUrl
subscriptionCount: m_subscriptionCount subscriptionCount: m_subscriptionCount
itemIndex: index itemIndex: index
steamWorkshop: root.steam steamWorkshop: root.steamWorkshop
// onClicked: { // onClicked: {
// sidebar.setWorkshopItem(publishedFileID, imgUrl, // sidebar.setWorkshopItem(publishedFileID, imgUrl,
// additionalPreviewUrl, // additionalPreviewUrl,
@ -136,10 +135,10 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: qsTr("Back") text: qsTr("Back")
enabled: root.steam.workshopProfileListModel.currentPage > 1 enabled: root.steamWorkshop.workshopProfileListModel.currentPage > 1
onClicked: { onClicked: {
root.steam.workshopProfileListModel.setCurrentPage( root.steamWorkshop.workshopProfileListModel.setCurrentPage(
root.steam.workshopProfileListModel.currentPage - 1) root.steamWorkshop.workshopProfileListModel.currentPage - 1)
} }
} }
@ -147,8 +146,8 @@ Item {
id: txtPage id: txtPage
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: root.steam.workshopProfileListModel.currentPage + "/" text: root.steamWorkshop.workshopProfileListModel.currentPage
+ root.steam.workshopProfileListModel.pages + "/" + root.steamWorkshop.workshopProfileListModel.pages
font.family: ScreenPlay.settings.font font.family: ScreenPlay.settings.font
color: Material.primaryTextColor color: Material.primaryTextColor
} }
@ -158,11 +157,11 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: qsTr("Forward") text: qsTr("Forward")
enabled: root.steam.workshopProfileListModel.currentPage enabled: root.steamWorkshop.workshopProfileListModel.currentPage
<= root.steam.workshopProfileListModel.pages - 1 <= root.steamWorkshop.workshopProfileListModel.pages - 1
onClicked: { onClicked: {
root.steam.workshopProfileListModel.setCurrentPage( root.steamWorkshop.workshopProfileListModel.setCurrentPage(
root.steam.workshopProfileListModel.currentPage + 1) root.steamWorkshop.workshopProfileListModel.currentPage + 1)
} }
} }

View File

@ -6,520 +6,83 @@ import QtQuick.Layouts 1.12
import Workshop 1.0 import Workshop 1.0
import ScreenPlay 1.0 import ScreenPlay 1.0
import "upload/" import "upload/"
import "../Common" as Common
Item { Item {
id: root id: root
property ScreenPlayWorkshop workshop ScreenPlayWorkshop {
property SteamWorkshop steam id: screenPlayWorkshop
Component.onCompleted: {
signal openSteamProfile if (screenPlayWorkshop.init()) {
stackView.push("qrc:/qml/Workshop/SteamWorkshopStartPage.qml", {
onVisibleChanged: { "stackView": stackView,
if (!visible) "screenPlayWorkshop": screenPlayWorkshop,
sidebar.close() "steamWorkshop": screenPlayWorkshop.steamWorkshop,
} "background": background
Component.onCompleted: { })
if (root.steam.online) { } else {
root.steam.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend) popupOffline.open()
} 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 { Background {
id: background id: background
anchors.fill: parent anchors.fill: parent
stackViewDepth: stackView.depth
} }
UploadProject {
id: popupUploadProject PopupOffline {
screenPlayWorkshop: workshop id: popupOffline
workshop: screenPlayWorkshop
steam: screenPlayWorkshop.steamWorkshop
} }
PopupSteamWorkshopAgreement { StackView {
id: popupSteamWorkshopAgreement id: stackView
} property int duration: 300
Connections { Connections {
function onUserNeedsToAcceptWorkshopLegalAgreement() { target: stackView.currentItem
popupSteamWorkshopAgreement.open() ignoreUnknownSignals: true
function onRequestBack() {
stackView.pop()
}
} }
target: root.steam.uploadListModel
}
Flickable {
id: scrollView
anchors.fill: parent anchors.fill: parent
contentWidth: parent.width replaceEnter: Transition {
contentHeight: gridView.height + header.height + 150 OpacityAnimator {
onContentYChanged: { from: 0
// Calculate parallax scrolling to: 1
if (contentY >= 0) duration: stackView.duration
background.imageOffsetTop = (contentY * -0.4) easing.type: Easing.InOutQuart
else
background.imageOffsetTop = 0
}
Item {
id: header
height: 450
anchors {
top: parent.top
right: parent.right
left: parent.left
} }
Item { ScaleAnimator {
id: banner from: 0.8
to: 1
property var bannerPublishedFileID duration: stackView.duration
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"
easing.type: Easing.InOutQuart easing.type: Easing.InOutQuart
} }
} }
ScrollBar.vertical: ScrollBar { replaceExit: Transition {
snapMode: ScrollBar.SnapOnRelease OpacityAnimator {
} from: 1
} to: 0
duration: stackView.duration
easing.type: Easing.InOutQuart
}
Sidebar { ScaleAnimator {
id: sidebar from: 1
to: 0.8
topMargin: 60 duration: stackView.duration
steamWorkshop: root.steam easing.type: Easing.InOutQuart
onTagClicked: { }
gridView.headerItem.searchField.text = tag
sidebar.close()
} }
} }
} }

View 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()
}
}
}

View File

@ -3,84 +3,23 @@ import QtQuick.Controls 2.13
import QtQuick.Controls.Material 2.13 import QtQuick.Controls.Material 2.13
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import Workshop 1.0 import Settings 1.0
import ScreenPlay 1.0 import ScreenPlay 1.0
Item { Item {
id: root id: root
ScreenPlayWorkshop { Component.onCompleted: {
id: ws if (ScreenPlay.settings.steamVersion) {
workshopLoader.setSource("qrc:/qml/Workshop/SteamWorkshop.qml")
Component.onCompleted: { } else {
const success = ws.init(); workshopLoader.setSource("qrc:/qml/Workshop/Forum.qml")
if(success){
stackView.push("qrc:/qml/Workshop/SteamWorkshop.qml", {
"workshop": ws,
"steam": ws.steamWorkshop
})
} else {
popupOffline.open()
}
} }
} }
PopupOffline { Loader {
id: popupOffline id: workshopLoader
workshop: ws asynchronous: true
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()
}
}
anchors.fill: parent 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
}
}
} }
} }

View File

@ -5,250 +5,215 @@ import QtQuick.Layouts 1.12
import Workshop 1.0 import Workshop 1.0
import ScreenPlay 1.0 import ScreenPlay 1.0
Popup { Item {
id: root id: root
property ScreenPlayWorkshop screenPlayWorkshop property ScreenPlayWorkshop screenPlayWorkshop
property SteamWorkshop steam: screenPlayWorkshop.steamWorkshop property SteamWorkshop steamWorkshop
width: 1200 signal requestBack
height: 700
modal: true
dim: true
anchors.centerIn: Overlay.overlay
closePolicy: Popup.NoAutoClose
onAboutToShow: uploadLoader.sourceComponent = com
onAboutToHide: uploadLoader.sourceComponent = undefined
Loader { Item {
id: uploadLoader id: headerWrapper
anchors.fill: parent height: 50
}
Connections { anchors {
function onRequestClosePopup() { top: parent.top
root.close() 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 { SwipeView {
id: com id: view
clip: true
currentIndex: 0
interactive: false
anchors {
top: headerWrapper.bottom
right: parent.right
bottom: parent.bottom
left: parent.left
margins: 10
}
Item { Item {
id: wrapper id: firstPage
signal requestClosePopup GridView {
id: gridView
Item { boundsBehavior: Flickable.DragOverBounds
id: headerWrapper maximumFlickVelocity: 7000
flickDeceleration: 5000
height: 50 cellWidth: parent.width
cellHeight: 250
clip: true
model: screenPlayWorkshop.installedListModel
anchors { anchors {
top: parent.top top: parent.top
right: parent.right right: parent.right
bottom: btnAbort.top
left: parent.left left: parent.left
margins: 10 margins: 10
} }
Text { delegate: UploadProjectBigItem {
id: txtHeadline id: delegate
text: qsTr("Upload Wallpaper/Widgets to Steam") focus: true
color: Material.foreground width: gridView.cellWidth - 30
font.pointSize: 21 customTitle: m_title
font.family: ScreenPlay.settings.font type: m_type
font.weight: Font.Thin screenId: m_folderId
absoluteStoragePath: m_absoluteStoragePath
anchors { publishedFileID: m_publishedFileID
top: parent.top preview: m_preview
horizontalCenter: parent.horizontalCenter 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 { Button {
id: view id: btnAbort
clip: true text: qsTr("Abort")
currentIndex: 0 onClicked: {
interactive: false root.requestBack()
}
anchors { anchors {
top: headerWrapper.bottom right: btnUploadProjects.left
right: parent.right
bottom: parent.bottom bottom: parent.bottom
left: parent.left
margins: 10 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 { Button {
id: indicator id: btnUploadProjects
count: view.count text: qsTr("Upload Selected Projects")
currentIndex: view.currentIndex highlighted: true
anchors.bottom: view.bottom enabled: false
anchors.horizontalCenter: parent.horizontalCenter 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 { PageIndicator {
color: Material.theme === Material.Light ? "white" : Material.background id: indicator
count: view.count
currentIndex: view.currentIndex
anchors.bottom: view.bottom
anchors.horizontalCenter: parent.horizontalCenter
} }
} }

View File

@ -63,9 +63,9 @@ Item {
Image { Image {
id: screenPlayItemImage id: screenPlayItemImage
asynchronous: true
width: 400 width: 400
source: Qt.resolvedUrl(root.absoluteStoragePath + "/" + root.preview) source: root.preview !== "" ? Qt.resolvedUrl(root.absoluteStoragePath + "/" + root.preview) : ""
anchors { anchors {
top: parent.top top: parent.top

View File

@ -4,9 +4,9 @@ import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtQuick.Controls.Material.impl 2.12 import QtQuick.Controls.Material.impl 2.12
import Workshop 1.0
Page { Page {
// Everyting that is not OK is a fail. See steam_qt_enums_generated.h
id: root id: root
@ -20,6 +20,7 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
padding: 20 padding: 20
onPreviewImagePathChanged: img.source = Qt.resolvedUrl("file:///" + previewImagePath) onPreviewImagePathChanged: img.source = Qt.resolvedUrl("file:///" + previewImagePath)
// Everyting that is not OK is a fail. See steam_qt_enums_generated.h
onSteamStatusChanged: { onSteamStatusChanged: {
let errorText; let errorText;
switch (steamStatus) { switch (steamStatus) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
void ScreenPlayWorkshopPlugin::registerTypes(const char* uri) void ScreenPlayWorkshopPlugin::registerTypes(const char* uri)
{ {
qInfo() << "void ScreenPlayWorkshopPlugin::registerTypes(const char* uri)";
qRegisterMetaType<ScreenPlayWorkshop::SteamQMLImageProvider*>("SteamQMLImageProvider*"); qRegisterMetaType<ScreenPlayWorkshop::SteamQMLImageProvider*>("SteamQMLImageProvider*");
qmlRegisterType<ScreenPlayWorkshop::SteamQMLImageProvider>("Workshop", 1, 0, "SteamImage"); qmlRegisterType<ScreenPlayWorkshop::SteamQMLImageProvider>("Workshop", 1, 0, "SteamImage");

View File

@ -33,7 +33,6 @@ bool SteamWorkshop::init()
return false; return false;
} }
// https://partner.steamgames.com/doc/sdk/api#SteamAPI_RestartAppIfNecessary // 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. // 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. // 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; m_steamErrorRestart = true;
} }
QObject::connect(&m_pollTimer, &QTimer::timeout, this, []() { SteamAPI_RunCallbacks(); }); QObject::connect(&m_pollTimer, &QTimer::timeout, this, []() { SteamAPI_RunCallbacks(); });
m_pollTimer.start(100); m_pollTimer.start(100);
@ -230,8 +228,6 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listModel, SteamUGCQueryCompleted_t* pCallback) bool SteamWorkshop::queryWorkshopItemFromHandle(SteamWorkshopListModel* listModel, SteamUGCQueryCompleted_t* pCallback)
{ {
qDebug() << "queryWorkshopItemFromHandle " << pCallback->m_unNumResultsReturned << pCallback->m_unTotalMatchingResults;
SteamUGCDetails_t details; SteamUGCDetails_t details;
const int urlLength = 200; const int urlLength = 200;
char url[urlLength]; char url[urlLength];

View File

@ -49,10 +49,16 @@ void SteamWorkshopItem::uploadItemToWorkshop(CreateItemResult_t* pCallback, bool
return; return;
} }
QString absoluteContentPath = m_absolutePath.toString(); const QString absoluteContentPath = ScreenPlayUtil::toLocal(m_absolutePath.toString());
auto jsonObjectOpt = ScreenPlayUtil::openJsonFileToObject(absoluteContentPath + "/project.json"); 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(); auto jsonObject = jsonObjectOpt.value();
QString preview = absoluteContentPath + "/" + jsonObject.value("preview").toString(); QString preview = absoluteContentPath + "/" + jsonObject.value("preview").toString();
setAbsolutePreviewImagePath(preview); setAbsolutePreviewImagePath(preview);