1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 16:32:33 +02:00

Change check if steam version from qml to cpp

We now have a steamVersion property to set
if we can load the steam plugin. Because of this
we no longer need the WorkshopLoader and WorkshopAvailableTest
This commit is contained in:
Elias Steurer 2020-08-22 13:59:28 +02:00
parent 5d8f7c4519
commit b08c12425d
8 changed files with 33 additions and 38 deletions

View File

@ -208,7 +208,11 @@ bool App::loadSteamPlugin()
const QString fileSuffix = ".dylib";
#endif
#ifdef Q_OS_WIN
#ifdef QT_NO_DEBUG
const QString fileSuffix = ".dll";
#else
const QString fileSuffix = "d.dll";
#endif
#else
const QString fileSuffix = ".so";
#endif
@ -220,6 +224,7 @@ bool App::loadSteamPlugin()
}
const ScreenPlayWorkshopPlugin* workshopPlugin = reinterpret_cast<ScreenPlayWorkshopPlugin*>(m_workshopPlugin.instance());
settings()->setSteamVersion(true);
return true;
}
}

View File

@ -84,11 +84,14 @@ ApplicationWindow {
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
pageLoaderCreate.item.checkFFMPEG()
} else if (name === "Workshop") {
bg.state = "init"
pageLoader.visible = false
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = true
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
if (ScreenPlay.settings.steamVersion) {
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
@ -262,6 +265,7 @@ ApplicationWindow {
Loader {
id: pageLoaderWorkshop
visible: false
enabled: ScreenPlay.settings.steamVersion
asynchronous: true
anchors {
top: nav.bottom
@ -319,5 +323,4 @@ ApplicationWindow {
Monitors {
id: monitors
}
}

View File

@ -30,8 +30,6 @@
<file>qml/Settings/SettingsHeader.qml</file>
<file>qml/Settings/SettingsHorizontalSeperator.qml</file>
<file>qml/Workshop/Workshop.qml</file>
<file>qml/Workshop/WorkshopAvailableTest.qml</file>
<file>qml/Workshop/WorkshopLoader.qml</file>
<file>qml/Monitors/Monitors.qml</file>
<file>qml/Monitors/MonitorSelection.qml</file>
<file>qml/Monitors/MonitorSelectionItem.qml</file>

View File

@ -62,9 +62,6 @@ Rectangle {
}
}
WorkshopLoader {
id: wl
}
Row {
id: row
@ -86,7 +83,7 @@ Rectangle {
id: navWorkshop
state: "inactive"
name: "Workshop"
enabled: wl.available
enabled: ScreenPlay.settings.steamVersion
iconSource: "qrc:/assets/icons/icon_steam.svg"
onPageClicked: navigation.onPageChanged(name)
}

View File

@ -1,6 +0,0 @@
import QtQuick 2.12
import ScreenPlay.Workshop 1.0
Item {
}

View File

@ -1,19 +0,0 @@
import QtQuick 2.12
Item {
id: workshopLoader
property bool available: true
Loader {
id: wsLoader
source: "qrc:/qml/Workshop/WorkshopAvailableTest.qml"
onStatusChanged: {
if (status == Loader.Ready) {
available = true
} else if (status == Loader.Error) {
available = false
}
}
}
}

View File

@ -80,7 +80,6 @@ Settings::Settings(const std::shared_ptr<GlobalVariables>& globalVariables,
QFile profilesFile(m_globalVariables->localSettingsPath().toString() + "/profiles.json");
if (!profilesFile.exists()) {
qInfo("No profiles.json found, creating default profiles.json");
qDebug() << profilesFile;
writeJsonFileFromResource("profiles");
}

View File

@ -81,6 +81,7 @@ class Settings : public QObject {
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
Q_PROPERTY(bool checkWallpaperVisible READ checkWallpaperVisible WRITE setCheckWallpaperVisible NOTIFY checkWallpaperVisibleChanged)
Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged)
Q_PROPERTY(bool steamVersion READ steamVersion WRITE setSteamVersion NOTIFY steamVersionChanged)
Q_PROPERTY(ScreenPlay::FillMode::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged)
Q_PROPERTY(Language language READ language WRITE setLanguage NOTIFY languageChanged)
@ -181,6 +182,11 @@ public:
return m_theme;
}
bool steamVersion() const
{
return m_steamVersion;
}
signals:
void requestRetranslation();
void resetInstalledListmodel();
@ -200,6 +206,8 @@ signals:
void fontChanged(QString font);
void themeChanged(ScreenPlay::Settings::Theme theme);
void steamVersionChanged(bool steamVersion);
public slots:
void writeJsonFileFromResource(const QString& filename);
void setupWidgetAndWindowPaths();
@ -355,6 +363,15 @@ public slots:
emit themeChanged(m_theme);
}
void setSteamVersion(bool steamVersion)
{
if (m_steamVersion == steamVersion)
return;
m_steamVersion = steamVersion;
emit steamVersionChanged(m_steamVersion);
}
private:
void restoreDefault(const QString& appConfigLocation, const QString& settingsFileType);
@ -377,5 +394,6 @@ private:
Language m_language { Language::En };
Theme m_theme { Theme::System };
QString m_font { "Roboto" };
bool m_steamVersion { false };
};
}