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

Add steam plugin load only on Workshop

This should make it possible again to open ScreenPlay without
Steam again!
This commit is contained in:
Elias Steurer 2020-10-22 22:43:25 +02:00
parent 31a47fb99b
commit f6b02cfea5
4 changed files with 25 additions and 17 deletions

View File

@ -187,7 +187,6 @@ void App::init()
}
qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this);
loadSteamPlugin();
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
}
@ -208,7 +207,7 @@ void App::exit()
}
}
void App::loadSteamPlugin()
bool App::loadSteamPlugin()
{
#ifdef Q_OS_MACOS
const QString fileSuffix = ".dylib";
@ -228,9 +227,12 @@ void App::loadSteamPlugin()
if (!m_workshopPlugin.load()) {
qWarning() << "Steam plugin not provided!";
qWarning() << m_workshopPlugin.fileName() << " - With error: " << m_workshopPlugin.errorString();
return false;
}
const ScreenPlayWorkshopPlugin* workshopPlugin = reinterpret_cast<ScreenPlayWorkshopPlugin*>(m_workshopPlugin.instance());
Q_UNUSED(workshopPlugin)
settings()->setSteamVersion(true);
return true;
}
}

View File

@ -153,6 +153,7 @@ signals:
public slots:
void exit();
bool loadSteamPlugin();
void setTrackerSendEvent(const QString& category, const QString& page)
{
if (m_telemetry) {
@ -248,9 +249,6 @@ public slots:
emit mainWindowEngineChanged(m_mainWindowEngine.get());
}
private:
void loadSteamPlugin();
private:
QPluginLoader m_workshopPlugin;
QNetworkAccessManager m_networkAccessManager;

View File

@ -4,7 +4,6 @@ import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
import Settings 1.0
@ -37,8 +36,6 @@ ApplicationWindow {
}
}
// Partial workaround for
// https://bugreports.qt.io/browse/QTBUG-86047
Material.accent: Material.color(Material.Orange)
@ -97,14 +94,19 @@ ApplicationWindow {
pageLoaderWorkshop.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
} else if (name === "Workshop") {
if (ScreenPlay.settings.steamVersion) {
bg.state = "init"
pageLoader.visible = false
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = true
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
if (!ScreenPlay.settings.steamVersion) {
const steamAvialable = ScreenPlay.loadSteamPlugin()
if (!steamAvialable) {
dialogSteam.open()
switchPage("Installed")
return
}
}
bg.state = "init"
pageLoader.visible = false
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = true
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
} else if (name === "Community") {
bg.state = "community"
pageLoader.visible = true
@ -122,6 +124,14 @@ ApplicationWindow {
sidebar.state = "inactive"
}
Dialog {
id: dialogSteam
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok
title: qsTr("Could not load steam integration!")
}
Common.TrayIcon {}
Common.Background {
@ -129,7 +139,6 @@ ApplicationWindow {
anchors.fill: parent
}
Loader {
id: pageLoader
asynchronous: true

View File

@ -85,7 +85,6 @@ Rectangle {
id: navWorkshop
state: "inactive"
name: "Workshop"
enabled: ScreenPlay.settings.steamVersion
iconSource: "qrc:/assets/icons/icon_steam.svg"
onPageClicked: navigation.onPageChanged(name)
}