1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-26 04:33:06 +01:00

Add new offline options!

This commit is contained in:
kelteseth 2018-03-05 18:09:48 +01:00
parent ff1a93da8e
commit 1c9c03b9fa
7 changed files with 246 additions and 20 deletions

View File

@ -22,7 +22,8 @@ SOURCES += main.cpp \
src/sdkconnector.cpp \
src/projectsettingslistitem.cpp \
src/projectsettingslistmodel.cpp \
src/globalnavigationhelper.cpp
src/globalnavigationhelper.cpp \
src/startuperror.cpp
RESOURCES += \
Resources.qrc \
@ -46,7 +47,8 @@ HEADERS += \
src/sdkconnector.h \
src/projectsettingslistitem.h \
src/projectsettingslistmodel.h \
src/globalnavigationhelper.h
src/globalnavigationhelper.h \
src/startuperror.h
INCLUDEPATH += \
$$PWD/ThirdParty/ \

View File

@ -22,18 +22,18 @@
#include <QtQuick/QQuickItem>
#include <qt_windows.h>
#include "globalnavigationhelper.h"
#include "installedlistfilter.h"
#include "installedlistmodel.h"
#include "monitorlistmodel.h"
#include "profilelistmodel.h"
#include "sdkconnector.h"
#include "settings.h"
#include "startuperror.h"
#include "steam/steam_api.h"
#include "steamworkshop.h"
#include "steamworkshoplistmodel.h"
#include "widget.h"
#include "globalnavigationhelper.h"
int main(int argc, char* argv[])
{
@ -63,7 +63,6 @@ int main(int argc, char* argv[])
QCoreApplication::setApplicationName("ScreenPlay");
QCoreApplication::setApplicationVersion("0.1.0");
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
bool steamErrorRestart = false;
@ -88,6 +87,7 @@ int main(int argc, char* argv[])
SDKConnector sdkConnector;
InstalledListFilter installedListFilter(&installedListModel);
// Create settings in the end because for now it depends on
// such things as the profile list model to complete
// It will also set the m_absoluteStoragePath in profileListModel and installedListModel
@ -125,23 +125,22 @@ int main(int argc, char* argv[])
profileListModel.loadProfiles();
settings.loadActiveProfiles();
QQmlApplicationEngine mainWindowEngine;
QQmlApplicationEngine errorWindowEngine,mainWindowEngine;
StartupError suError(&mainWindowEngine, &errorWindowEngine);
mainWindowEngine.rootContext()->setContextProperty("globalNavigationHelper", &gnh);
mainWindowEngine.rootContext()->setContextProperty("installedListFilter", &installedListFilter);
mainWindowEngine.rootContext()->setContextProperty("workshopListModel", &steamWorkshopListModel);
mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel);
mainWindowEngine.rootContext()->setContextProperty("profileListModel", &profileListModel);
mainWindowEngine.rootContext()->setContextProperty("screenPlaySettings", &settings);
mainWindowEngine.rootContext()->setContextProperty("steamWorkshop", &steamWorkshop);
QQmlApplicationEngine errorWindowEngine;
if (steamErrorRestart || steamErrorAPIInit) {
errorWindowEngine.load(QUrl(QStringLiteral("qrc:/qml/StartupErrorWindow.qml")));
errorWindowEngine.rootContext()->setContextProperty("suError", &suError);
settings.setOfflineMode(true);
} else {
mainWindowEngine.load(QUrl(QStringLiteral("qrc:/main.qml")));
}

View File

@ -17,6 +17,11 @@ ApplicationWindow {
title: "ScreenPlay Alpha"
minimumHeight: 788
minimumWidth: 1050
Component.onCompleted: {
if(!screenPlaySettings.autostart){
show()
}
}
Connections {
target: screenPlaySettings
@ -270,7 +275,7 @@ ApplicationWindow {
pageLoaderCreate.visible = true
pageLoaderWorkshop.visible = false
sidebar.state = "inactive"
} else if (name === "Workshop") {
} else if (name === "Workshop" ) {
pageLoader.visible = false
pageLoaderCreate.visible = false
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")

View File

@ -34,6 +34,10 @@ Rectangle {
}
function onPageChanged(name) {
if(name === "Workshop" && screenPlaySettings.offlineMode){
return
}
navigation.changePage(name)
if (name === "Workshop") {
navWorkshop.state = "active"

View File

@ -1,25 +1,210 @@
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
ApplicationWindow {
id: window
visible: true
height: 200
width: 500
height: 500
width: 400
Component.onCompleted: {
setX(Screen.width / 2 - width / 2)
setY(Screen.height / 2 - height / 2)
}
LinearGradient {
id: gradient
anchors.fill: parent
cached: true
start: Qt.point(0, 0)
end: Qt.point(gradient.width, gradient.height)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#FF9700"
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation {
from: "#FF9700"
to: "#F83C3C"
duration: 5000
}
ColorAnimation {
from: "#F83C3C"
to: "#FF9700"
duration: 5000
}
}
}
GradientStop {
position: 1.0
color: "#F83C3C"
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation {
from: "#F83C3C"
to: "#FF9700"
duration: 100000
}
ColorAnimation {
from: "#FF9700"
to: "#F83C3C"
duration: 100000
}
}
}
}
}
Item {
anchors.fill: parent
MouseArea {
id: ma
anchors.fill: parent
hoverEnabled: true
onPressed: {
attractor.enabled = true
}
onPositionChanged: {
if (ma.pressed) {
attractor.pointX = mouseX
attractor.pointY = mouseY
}
}
onReleased: {
attractor.enabled = false
}
}
Attractor {
id: attractor
system: particleSystem
affectedParameter: Attractor.Acceleration
strength: 8000000
proportionalToDistance: Attractor.InverseQuadratic
}
ParticleSystem {
id: particleSystem
}
Emitter {
id: emitter
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
width: parent.width
height: 80
system: particleSystem
emitRate: 25
lifeSpan: 5000
lifeSpanVariation: 1000
size: 8
endSize: 18
sizeVariation: 4
velocity: AngleDirection {
angle: -90
magnitude: 50
magnitudeVariation: 25
angleVariation: 10
}
}
ImageParticle {
height: 16
width: 16
source: "qrc:/assets/particle/dot.png"
system: particleSystem
opacity: .5
}
Image {
id: bgGlow
width: 500
height: width
opacity: .3
source: "qrc:/assets/particle/backgroundGlow.png"
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: -width * .65
}
}
}
Text {
id: name
text: qsTr("Could not connect to steam Error")
color: "orange"
font.pixelSize: 23
anchors.centerIn: parent
text: qsTr("Could not connect to Steam :(")
color: "white"
font.family: "Roboto"
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
font.pixelSize: 25
anchors {
top: parent.top
margins: 30
right: parent.right
left: parent.left
}
}
Text {
id: txtDescription
text: qsTr("To use ScreenPlay with all its features you have to have Steam running!")
color: "white"
font.family: "Roboto"
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 18
anchors {
top: name.bottom
margins: 30
right: parent.right
left: parent.left
}
}
ColumnLayout {
spacing: 10
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: 10
}
Button {
text: qsTr("Close ScreenPlay")
Material.background: Material.Red
Material.foreground: "white"
Layout.alignment: Qt.AlignCenter
onClicked: Qt.quit()
}
Button {
text: qsTr("Continue using ScreenPlay offline")
Material.background: Material.Orange
Material.foreground: "white"
Layout.alignment: Qt.AlignCenter
onClicked: {
suError.startScreenPlayAnyway()
window.close()
}
}
Button {
text: qsTr("Seek help in our greate community!")
Material.background: Material.LightGreen
Material.foreground: "white"
Layout.alignment: Qt.AlignCenter
onClicked: Qt.openUrlExternally("https://forum.screen-play.rocks")
}
}
}

View File

@ -0,0 +1,13 @@
#include "startuperror.h"
StartupError::StartupError(QQmlApplicationEngine* main, QQmlApplicationEngine* err, QObject *parent) : QObject(parent)
{
m_errorWindow = err;
m_mainWindow = main;
}
void StartupError::startScreenPlayAnyway()
{
m_mainWindow->load(QUrl(QStringLiteral("qrc:/main.qml")));
}

View File

@ -0,0 +1,18 @@
#pragma once
#include <QObject>
#include <QQmlApplicationEngine>
class StartupError : public QObject {
Q_OBJECT
public:
explicit StartupError(QQmlApplicationEngine* main, QQmlApplicationEngine* err, QObject* parent = nullptr);
signals:
public slots:
void startScreenPlayAnyway();
private:
QQmlApplicationEngine *m_mainWindow, *m_errorWindow;
};