1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add explicit property for steam

This commit is contained in:
Elias Steurer 2021-09-04 12:13:00 +02:00
parent 99688634ee
commit d233e10441
6 changed files with 62 additions and 9 deletions

View File

@ -15,6 +15,9 @@ Popup {
anchors.centerIn: Overlay.overlay
dim: true
property ScreenPlayWorkshop workshop
property SteamWorkshop steam
Text {
id: txtOffline
@ -22,7 +25,7 @@ Popup {
font.family: ScreenPlay.settings.font
font.pointSize: 21
color: Material.foreground
text: qsTr("You need to run Steam for this :)")
text: qsTr("You need to run Steam for this. steamErrorRestart: %1 - steamErrorAPIInit: %2").arg(steam.steamErrorRestart).arg(steam.steamErrorAPIInit)
}
Button {

View File

@ -10,14 +10,14 @@ Item {
id: root
ScreenPlayWorkshop {
id: workshop
id: ws
Component.onCompleted: {
const success = workshop.init();
const success = ws.init();
if(success){
stackView.push("qrc:/qml/Workshop/SteamWorkshop.qml", {
"workshop": workshop,
"steam": workshop.steamWorkshop
"workshop": ws,
"steam": ws.steamWorkshop
})
} else {
popupOffline.open()
@ -27,6 +27,8 @@ Item {
PopupOffline {
id: popupOffline
workshop: ws
steam: ws.steamWorkshop
}
StackView {
@ -39,8 +41,8 @@ Item {
ignoreUnknownSignals: true
function onOpenSteamProfile(){
stackView.push("qrc:/qml/Workshop/SteamProfile.qml", {
"workshop": workshop,
"steam": workshop.steamWorkshop
"workshop": ws,
"steam": ws.steamWorkshop
})
}
function onRequestWorkshopMainPage(){

View File

@ -1,4 +1,3 @@
#pragma once
#include <QByteArray>
#include <QJsonArray>
#include <QString>

View File

@ -121,6 +121,42 @@ void SteamWorkshop::onRequestItemDetailReturned(SteamUGCQueryCompleted_t* pCallb
}
}
bool SteamWorkshop::steamErrorAPIInit() const
{
return m_steamErrorAPIInit;
}
void SteamWorkshop::setSteamErrorAPIInit(bool newSteamErrorAPIInit)
{
if (m_steamErrorAPIInit == newSteamErrorAPIInit)
return;
m_steamErrorAPIInit = newSteamErrorAPIInit;
emit steamErrorAPIInitChanged();
}
void SteamWorkshop::resetSteamErrorAPIInit()
{
setSteamErrorAPIInit({}); // TODO: Adapt to use your actual default value
}
bool SteamWorkshop::steamErrorRestart() const
{
return m_steamErrorRestart;
}
void SteamWorkshop::setSteamErrorRestart(bool newSteamErrorRestart)
{
if (m_steamErrorRestart == newSteamErrorRestart)
return;
m_steamErrorRestart = newSteamErrorRestart;
emit steamErrorRestartChanged();
}
void SteamWorkshop::resetSteamErrorRestart()
{
setSteamErrorRestart({}); // TODO: Adapt to use your actual default value
}
void SteamWorkshop::requestUserItems()
{
if (!checkOnline())

View File

@ -48,6 +48,8 @@ class SteamWorkshop : public QObject {
Q_PROPERTY(SteamWorkshopListModel* workshopProfileListModel READ workshopProfileListModel WRITE setWorkshopProfileListModel NOTIFY workshopProfileListModelChanged)
Q_PROPERTY(UploadListModel* uploadListModel READ uploadListModel NOTIFY uploadListModelChanged)
Q_PROPERTY(SteamAccount* steamAccount READ steamAccount WRITE setSteamAccount NOTIFY steamAccountChanged)
Q_PROPERTY(bool steamErrorRestart READ steamErrorRestart WRITE setSteamErrorRestart RESET resetSteamErrorRestart NOTIFY steamErrorRestartChanged)
Q_PROPERTY(bool steamErrorAPIInit READ steamErrorAPIInit WRITE setSteamErrorAPIInit RESET resetSteamErrorAPIInit NOTIFY steamErrorAPIInitChanged)
public:
SteamWorkshop()
@ -72,6 +74,14 @@ public:
SteamWorkshopListModel* workshopListModel() const { return m_workshopListModel.get(); }
SteamWorkshopListModel* workshopProfileListModel() const { return m_workshopProfileListModel.get(); }
bool steamErrorRestart() const;
void setSteamErrorRestart(bool newSteamErrorRestart);
void resetSteamErrorRestart();
bool steamErrorAPIInit() const;
void setSteamErrorAPIInit(bool newSteamErrorAPIInit);
void resetSteamErrorAPIInit();
public slots:
bool checkOnline();
void bulkUploadToWorkshop(QStringList absoluteStoragePaths);
@ -175,6 +185,10 @@ signals:
void workshopProfileListModelChanged(SteamWorkshopListModel*);
void steamErrorRestartChanged();
void steamErrorAPIInitChanged();
private:
void onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool bIOFailure);
bool queryWorkshopItemFromHandle(SteamWorkshopListModel* listModel, SteamUGCQueryCompleted_t* pCallback);

View File

@ -7,7 +7,6 @@ Workshop::Workshop(QQuickItem* parent)
m_installedListModel = std::make_unique<InstalledListModel>();
m_steamWorkshop = std::make_unique<SteamWorkshop>(672870);
m_installedListModel->init();
qInfo() << "Workshop init";
}
}