mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Refactor steam plugin to unload
This commit is contained in:
parent
7e10ae47e2
commit
d439708c25
@ -264,4 +264,9 @@ bool App::loadSteamPlugin()
|
||||
settings()->setSteamVersion(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool App::unloadSteamPlugin()
|
||||
{
|
||||
return m_workshopPlugin.unload();
|
||||
}
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ public slots:
|
||||
|
||||
void exit();
|
||||
bool loadSteamPlugin();
|
||||
bool unloadSteamPlugin();
|
||||
void setTrackerSendEvent(const QString& category, const QString& page)
|
||||
{
|
||||
if (m_telemetry) {
|
||||
|
@ -85,6 +85,8 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
function switchPage(name) {
|
||||
const unloadSteamPlugin = nav.currentNavigationName === "Workshop"
|
||||
|
||||
if (nav.currentNavigationName === name) {
|
||||
if (name === "Installed")
|
||||
ScreenPlay.installedListModel.reset()
|
||||
@ -104,6 +106,10 @@ ApplicationWindow {
|
||||
|
||||
stackView.replace("qrc:/qml/" + name + "/" + name + ".qml")
|
||||
|
||||
if (unloadSteamPlugin) {
|
||||
ScreenPlay.unloadSteamPlugin()
|
||||
}
|
||||
|
||||
sidebar.state = "inactive"
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ Rectangle {
|
||||
implicitWidth: 800
|
||||
height: 50
|
||||
|
||||
property SteamWorkshop steamWorkshop
|
||||
|
||||
signal uploadPressed
|
||||
color: Material.theme === Material.Light ? "white" : Material.background
|
||||
|
||||
@ -30,9 +32,9 @@ Rectangle {
|
||||
Text {
|
||||
id: name
|
||||
text: {
|
||||
return Workshop.steamWorkshop.steamAccount.username + qsTr(
|
||||
return steamWorkshop.steamAccount.username + qsTr(
|
||||
" Subscribed items: ")
|
||||
+ Workshop.steamWorkshop.steamAccount.amountSubscribedItems
|
||||
+ steamWorkshop.steamAccount.amountSubscribedItems
|
||||
}
|
||||
|
||||
font.pointSize: 14
|
||||
@ -60,9 +62,11 @@ Rectangle {
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Component.onCompleted: Workshop.steamWorkshop.steamAccount.loadAvatar()
|
||||
Component.onCompleted: {
|
||||
steamWorkshop.steamAccount.loadAvatar()
|
||||
}
|
||||
Connections {
|
||||
target: Workshop.steamWorkshop.steamAccount
|
||||
target: steamWorkshop.steamAccount
|
||||
function onAvatarChanged(_avatar) {
|
||||
avatar.setImage(_avatar)
|
||||
}
|
||||
|
@ -4,7 +4,8 @@ import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.11
|
||||
import QtWebEngine 1.8
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import ScreenPlay.Workshop 1.0 as SP
|
||||
|
||||
import ScreenPlay.Workshop 1.0
|
||||
import ScreenPlay 1.0
|
||||
|
||||
Drawer {
|
||||
@ -15,6 +16,8 @@ Drawer {
|
||||
modal: false
|
||||
width: 400
|
||||
interactive: false
|
||||
property SteamWorkshop steamWorkshop
|
||||
|
||||
background: Rectangle {
|
||||
color: Material.theme === Material.Light ? "white" : Qt.darker(
|
||||
Material.background)
|
||||
@ -75,13 +78,13 @@ Drawer {
|
||||
root.open()
|
||||
}
|
||||
|
||||
SP.Workshop.steamWorkshop.requestWorkshopItemDetails(publishedFileID)
|
||||
steamWorkshop.requestWorkshopItemDetails(publishedFileID)
|
||||
|
||||
webView.setVideo()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SP.Workshop.steamWorkshop
|
||||
target: steamWorkshop
|
||||
function onRequestItemDetailReturned(title, tags, steamIDOwner, description, votesUp, votesDown, url, fileSize, publishedFileId) {
|
||||
|
||||
txtTitle.text = title
|
||||
@ -239,8 +242,7 @@ Drawer {
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Click here if you like the content")
|
||||
onClicked: {
|
||||
SP.Workshop.steamWorkshop.vote(
|
||||
root.publishedFileID, true)
|
||||
steamWorkshop.vote(root.publishedFileID, true)
|
||||
txtVotesUp.highlighted = true
|
||||
txtVotesDown.highlighted = false
|
||||
}
|
||||
@ -253,8 +255,7 @@ Drawer {
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Click here if you do not like the content")
|
||||
onClicked: {
|
||||
SP.Workshop.steamWorkshop.vote(
|
||||
root.publishedFileID, false)
|
||||
steamWorkshop.vote(root.publishedFileID, false)
|
||||
txtVotesUp.highlighted = false
|
||||
txtVotesDown.highlighted = true
|
||||
}
|
||||
@ -358,7 +359,7 @@ Drawer {
|
||||
text: root.subscribed ? qsTr("Subscribed!") : qsTr("Subscribe")
|
||||
onClicked: {
|
||||
root.subscribed = true
|
||||
SP.Workshop.steamWorkshop.subscribeItem(root.publishedFileID)
|
||||
root.steamWorkshop.subscribeItem(root.publishedFileID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,22 @@ import "upload/"
|
||||
import "../Common" as Common
|
||||
|
||||
Item {
|
||||
id: workshop
|
||||
id: root
|
||||
state: "base"
|
||||
onVisibleChanged: {
|
||||
if (!visible)
|
||||
sidebar.close()
|
||||
}
|
||||
|
||||
property alias steamWorkshop: screenPlayWorkshop.steamWorkshop
|
||||
|
||||
ScreenPlayWorkshop {
|
||||
id: screenPlayWorkshop
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (Workshop.steamWorkshop.online) {
|
||||
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
|
||||
if (steamWorkshop.online) {
|
||||
steamWorkshop.workshopListModel.searchWorkshop(
|
||||
SteamEnums.K_EUGCQuery_RankedByTrend)
|
||||
} else {
|
||||
popupOffline.open()
|
||||
@ -30,13 +36,13 @@ Item {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Workshop.steamWorkshop.workshopListModel
|
||||
target: steamWorkshop.workshopListModel
|
||||
function onWorkshopSearched() {
|
||||
bannerTxt.text = Workshop.steamWorkshop.workshopListModel.getBannerText()
|
||||
background.backgroundImage = Workshop.steamWorkshop.workshopListModel.getBannerUrl()
|
||||
banner.bannerPublishedFileID = Workshop.steamWorkshop.workshopListModel.getBannerID()
|
||||
bannerTxt.text = steamWorkshop.workshopListModel.getBannerText()
|
||||
background.backgroundImage = steamWorkshop.workshopListModel.getBannerUrl()
|
||||
banner.bannerPublishedFileID = steamWorkshop.workshopListModel.getBannerID()
|
||||
bannerTxtUnderline.numberSubscriber
|
||||
= Workshop.steamWorkshop.workshopListModel.getBannerAmountSubscriber()
|
||||
= steamWorkshop.workshopListModel.getBannerAmountSubscriber()
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +57,8 @@ Item {
|
||||
|
||||
UploadProject {
|
||||
id: popupUploadProject
|
||||
steamWorkshop: root.steamWorkshop
|
||||
workshop: screenPlayWorkshop
|
||||
}
|
||||
|
||||
PopupSteamWorkshopAgreement {
|
||||
@ -58,7 +66,7 @@ Item {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Workshop.steamWorkshop.uploadListModel
|
||||
target: steamWorkshop.uploadListModel
|
||||
function onUserNeedsToAcceptWorkshopLegalAgreement() {
|
||||
popupSteamWorkshopAgreement.open()
|
||||
}
|
||||
@ -66,6 +74,7 @@ Item {
|
||||
|
||||
Navigation {
|
||||
id: nav
|
||||
steamWorkshop: root.steamWorkshop
|
||||
z: 3
|
||||
anchors {
|
||||
top: parent.top
|
||||
@ -90,9 +99,9 @@ Item {
|
||||
background.imageOffsetTop = 0
|
||||
}
|
||||
if (contentY >= (header.height)) {
|
||||
workshop.state = "scrolling"
|
||||
root.state = "scrolling"
|
||||
} else {
|
||||
workshop.state = "base"
|
||||
root.state = "base"
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,8 +178,8 @@ Item {
|
||||
icon.source: "qrc:/assets/icons/icon_download.svg"
|
||||
onClicked: {
|
||||
text = qsTr("Downloading...")
|
||||
Workshop.steamWorkshop.subscribeItem(
|
||||
Workshop.steamWorkshop.workshopListModel.getBannerID(
|
||||
steamWorkshop.subscribeItem(
|
||||
steamWorkshop.workshopListModel.getBannerID(
|
||||
))
|
||||
}
|
||||
}
|
||||
@ -219,7 +228,7 @@ Item {
|
||||
cellHeight: 190
|
||||
height: contentHeight
|
||||
interactive: false
|
||||
model: Workshop.steamWorkshop.workshopListModel
|
||||
model: steamWorkshop.workshopListModel
|
||||
anchors {
|
||||
top: header.bottom
|
||||
topMargin: 100
|
||||
@ -265,7 +274,7 @@ Item {
|
||||
Timer {
|
||||
id: timerSearch
|
||||
interval: 300
|
||||
onTriggered: Workshop.steamWorkshop.workshopListModel.searchWorkshopByText(
|
||||
onTriggered: steamWorkshop.workshopListModel.searchWorkshopByText(
|
||||
tiSearch.text)
|
||||
}
|
||||
}
|
||||
@ -318,7 +327,7 @@ Item {
|
||||
Layout.preferredHeight: searchWrapper.height
|
||||
font.family: ScreenPlay.settings.font
|
||||
onActivated: {
|
||||
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
|
||||
steamWorkshop.workshopListModel.searchWorkshop(
|
||||
cbQuerySort.currentValue, 1)
|
||||
}
|
||||
model: [{
|
||||
@ -364,6 +373,7 @@ Item {
|
||||
additionalPreviewUrl: m_additionalPreviewUrl
|
||||
subscriptionCount: m_subscriptionCount
|
||||
itemIndex: index
|
||||
steamWorkshop: root.steamWorkshop
|
||||
onClicked: {
|
||||
sidebar.setWorkshopItem(publishedFileID, imgUrl,
|
||||
additionalPreviewUrl,
|
||||
@ -381,6 +391,7 @@ Item {
|
||||
Sidebar {
|
||||
id: sidebar
|
||||
topMargin: 60
|
||||
steamWorkshop: root.steamWorkshop
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.2
|
||||
import ScreenPlay.Workshop 1.0 as SP
|
||||
import ScreenPlay.Workshop 1.0
|
||||
|
||||
import ScreenPlay 1.0
|
||||
|
||||
@ -17,8 +17,8 @@ Item {
|
||||
property var publishedFileID: 0
|
||||
property int itemIndex
|
||||
property int subscriptionCount
|
||||
|
||||
property bool isDownloading: false
|
||||
property SteamWorkshop steamWorkshop
|
||||
|
||||
signal clicked(var publishedFileID, url imgUrl)
|
||||
|
||||
@ -231,16 +231,16 @@ Item {
|
||||
onClicked: {
|
||||
isDownloading = true
|
||||
root.state = "downloading"
|
||||
SP.Workshop.steamWorkshop.subscribeItem(
|
||||
root.steamWorkshop.subscribeItem(
|
||||
root.publishedFileID)
|
||||
ScreenPlay.setTrackerSendEvent("subscribeItem",
|
||||
root.publishedFileID)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SP.Workshop.steamWorkshop
|
||||
target: root.steamWorkshop
|
||||
function onWorkshopItemInstalled(appID, publishedFileID) {
|
||||
if (appID === SP.Workshop.steamWorkshop.appID
|
||||
if (appID === root.steamWorkshop.appID
|
||||
&& publishedFileID === root.publishedFileID) {
|
||||
root.state = "installed"
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import ScreenPlay.Workshop 1.0 as SP
|
||||
import ScreenPlay.Workshop 1.0
|
||||
import ScreenPlay 1.0
|
||||
|
||||
Popup {
|
||||
@ -16,6 +16,8 @@ Popup {
|
||||
closePolicy: Popup.NoAutoClose
|
||||
onAboutToShow: uploadLoader.sourceComponent = com
|
||||
onAboutToHide: uploadLoader.sourceComponent = undefined
|
||||
property SteamWorkshop steamWorkshop
|
||||
property ScreenPlayWorkshop workshop
|
||||
background: Rectangle {
|
||||
color: Material.theme === Material.Light ? "white" : Material.background
|
||||
}
|
||||
@ -32,7 +34,6 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: com
|
||||
Item {
|
||||
@ -88,7 +89,7 @@ Popup {
|
||||
cellWidth: parent.width
|
||||
cellHeight: 250
|
||||
clip: true
|
||||
model: SP.Workshop.installedListModel
|
||||
model: workshop.installedListModel
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
@ -127,7 +128,7 @@ Popup {
|
||||
id: btnAbort
|
||||
text: qsTr("Abort")
|
||||
onClicked: {
|
||||
SP.Workshop.steamWorkshop.uploadListModel.clear()
|
||||
steamWorkshop.uploadListModel.clear()
|
||||
wrapper.requestClosePopup()
|
||||
}
|
||||
|
||||
@ -160,8 +161,7 @@ Popup {
|
||||
}
|
||||
}
|
||||
view.currentIndex = 1
|
||||
SP.Workshop.steamWorkshop.bulkUploadToWorkshop(
|
||||
uploadListArray)
|
||||
steamWorkshop.bulkUploadToWorkshop(uploadListArray)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,7 @@ Popup {
|
||||
flickDeceleration: 5000
|
||||
cacheBuffer: 1000
|
||||
clip: true
|
||||
model: SP.Workshop.steamWorkshop.uploadListModel
|
||||
model: steamWorkshop.uploadListModel
|
||||
width: parent.width - 50
|
||||
spacing: 25
|
||||
anchors {
|
||||
@ -202,7 +202,7 @@ Popup {
|
||||
id: btnFinish
|
||||
text: qsTr("Finish")
|
||||
onClicked: {
|
||||
SP.Workshop.steamWorkshop.uploadListModel.clear()
|
||||
steamWorkshop.uploadListModel.clear()
|
||||
wrapper.requestClosePopup()
|
||||
}
|
||||
highlighted: true
|
||||
@ -213,7 +213,7 @@ Popup {
|
||||
margins: 10
|
||||
}
|
||||
Connections {
|
||||
target: SP.Workshop.steamWorkshop.uploadListModel
|
||||
target: steamWorkshop.uploadListModel
|
||||
function onUploadCompleted() {
|
||||
btnFinish.enabled = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user