1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00

Replace custom loader with swipeview

Move Dialogs into dedicated files
This commit is contained in:
Elias Steurer 2020-11-14 19:37:41 +01:00
parent 52d38e204c
commit 626455c4ac
12 changed files with 149 additions and 145 deletions

View File

@ -8,12 +8,9 @@ import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import Settings 1.0
import ScreenPlay.Shader 1.0
import "ShaderWrapper" as ShaderWrapper
import "qml/"
import "qml/Monitors" as Monitors
import "qml/Common" as Common
import "qml/Common/Dialogs" as Dialogs
import "qml/Installed" as Installed
import "qml/Navigation" as Navigation
import "qml/Workshop" as Workshop
@ -87,13 +84,7 @@ ApplicationWindow {
}
function switchPage(name) {
if (name === "Create") {
bg.state = "create"
pageLoader.visible = false
pageLoaderCreate.visible = true
pageLoaderWorkshop.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
} else if (name === "Workshop") {
if (name === "Workshop") {
if (!ScreenPlay.settings.steamVersion) {
const steamAvialable = ScreenPlay.loadSteamPlugin()
if (!steamAvialable) {
@ -102,76 +93,19 @@ ApplicationWindow {
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
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = false
pageLoader.setSource("qrc:/qml/Community/Community.qml")
} else {
bg.state = "init"
pageLoader.visible = true
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = false
pageLoader.setSource("qrc:/qml/" + name + "/" + name + ".qml")
}
stackView.replace("qrc:/qml/" + name + "/" + name + ".qml")
sidebar.state = "inactive"
}
Dialog {
Dialogs.SteamNotAvailable {
id: dialogSteam
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok
title: qsTr("Could not load steam integration!")
}
Dialog {
Dialogs.MonitorConfiguration {
id: dialogMonitorConfigurationChanged
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok
contentHeight: 250
contentItem: Item {
ColumnLayout {
anchors.margins: 20
anchors.fill: parent
spacing: 20
Image {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 150
Layout.preferredHeight: 150
source: "qrc:/assets/icons/monitor_setup.svg"
fillMode: Image.PreserveAspectFit
}
Text {
text: qsTr("Your monitor setup changed!\n Please configure your wallpaper again.")
Layout.fillWidth: true
Layout.fillHeight: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
horizontalAlignment: Text.AlignHCenter
font.family: ScreenPlay.settings.font
font.pointSize: 16
color: Material.primaryTextColor
}
}
}
Connections {
target: ScreenPlay.monitorListModel
function onMonitorConfigurationChanged() {
dialogMonitorConfigurationChanged.open()
}
}
}
Common.TrayIcon {}
@ -181,58 +115,49 @@ ApplicationWindow {
anchors.fill: parent
}
Loader {
id: pageLoader
asynchronous: true
source: "qrc:/qml/Installed/Installed.qml"
StackView {
id: stackView
anchors {
top: nav.bottom
right: parent.right
bottom: parent.bottom
left: parent.left
}
onStatusChanged: {
if (status == Loader.Ready) {
if (pageLoaderCreate.source != "qrc:/qml/Create/Create.qml")
timerLoader.start()
}
}
}
Timer {
id: timerLoader
interval: 500
onTriggered: {
pageLoaderCreate.source = "qrc:/qml/Create/Create.qml"
}
}
property int duration: 300
Loader {
id: pageLoaderCreate
visible: false
anchors {
top: nav.bottom
right: parent.right
bottom: parent.bottom
left: parent.left
replaceEnter: Transition {
OpacityAnimator {
from: 0
to: 1
duration: stackView.duration
easing.type: Easing.InOutQuart
}
ScaleAnimator {
from: 0.8
to: 1
duration: stackView.duration
easing.type: Easing.InOutQuart
}
}
Loader {
id: pageLoaderWorkshop
visible: false
enabled: ScreenPlay.settings.steamVersion
asynchronous: true
anchors {
top: nav.bottom
right: parent.right
bottom: parent.bottom
left: parent.left
replaceExit: Transition {
OpacityAnimator {
from: 1
to: 0
duration: stackView.duration
easing.type: Easing.InOutQuart
}
ScaleAnimator {
from: 1
to: 0.8
duration: stackView.duration
easing.type: Easing.InOutQuart
}
}
}
Connections {
target: pageLoader.item
target: stackView.currentItem
ignoreUnknownSignals: true
function onSetSidebarActive(active) {

View File

@ -72,5 +72,7 @@
<file>qml/Installed/Navigation.qml</file>
<file>qml/Common/Search.qml</file>
<file>qml/Common/MouseHoverBlocker.qml</file>
<file>qml/Common/Dialogs/MonitorConfiguration.qml</file>
<file>qml/Common/Dialogs/SteamNotAvailable.qml</file>
</qresource>
</RCC>

View File

@ -6,7 +6,8 @@ import QtQuick.Particles 2.0
Rectangle {
id: element
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Qt.darker( Material.background)
color: Material.theme === Material.Light ? "white" : Qt.darker(
Material.background)
state: "init"
onStateChanged: {
if (state === "init") {
@ -111,7 +112,6 @@ Rectangle {
transitions: [
Transition {
from: "*"
to: "*"

View File

@ -0,0 +1,48 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.12
import ScreenPlay 1.0
Dialog {
id: dialogMonitorConfigurationChanged
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok
contentHeight: 250
contentItem: Item {
ColumnLayout {
anchors.margins: 20
anchors.fill: parent
spacing: 20
Image {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 150
Layout.preferredHeight: 150
source: "qrc:/assets/icons/monitor_setup.svg"
fillMode: Image.PreserveAspectFit
}
Text {
text: qsTr("Your monitor setup changed!\n Please configure your wallpaper again.")
Layout.fillWidth: true
Layout.fillHeight: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
horizontalAlignment: Text.AlignHCenter
font.family: ScreenPlay.settings.font
font.pointSize: 16
color: Material.primaryTextColor
}
}
}
Connections {
target: ScreenPlay.monitorListModel
function onMonitorConfigurationChanged() {
dialogMonitorConfigurationChanged.open()
}
}
}

View File

@ -0,0 +1,11 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
Dialog {
id: dialogSteam
modal: true
anchors.centerIn: Overlay.overlay
standardButtons: Dialog.Ok
title: qsTr("Could not load steam integration!")
}

View File

@ -7,8 +7,7 @@ import ScreenPlay 1.0
import QtWebEngine 1.8
Item {
id: community
anchors.fill: parent
id: root
Rectangle {
id: navWrapper
@ -22,6 +21,7 @@ Item {
TabBar {
id: nav
height: parent.height
currentIndex: 0
background: Item {}
anchors {
top: parent.top
@ -32,28 +32,28 @@ Item {
CommunityNavItem {
text: qsTr("Wiki")
openLink: swipeView.itemAt(0).url
openLink: webModel.get(0).url
icon.source: "qrc:/assets/icons/icon_help_center.svg"
}
CommunityNavItem {
text: qsTr("Forum")
openLink: swipeView.itemAt(1).url
openLink: webModel.get(1).url
icon.source: "qrc:/assets/icons/icon_forum.svg"
}
CommunityNavItem {
text: qsTr("Issue List")
openLink: swipeView.itemAt(2).url
openLink: webModel.get(2).url
icon.source: "qrc:/assets/icons/icon_report_problem.svg"
}
CommunityNavItem {
text: qsTr("Release Notes")
openLink: swipeView.itemAt(3).url
openLink: webModel.get(3).url
icon.source: "qrc:/assets/icons/icon_new_releases.svg"
}
CommunityNavItem {
text: qsTr("Contribution Guide")
openLink: swipeView.itemAt(4).url
openLink: webModel.get(4).url
icon.source: "qrc:/assets/icons/icon_supervisor_account.svg"
}
CommunityNavItem {
@ -96,29 +96,52 @@ Item {
bottom: parent.bottom
left: parent.left
}
Repeater {
id: repeater
model: ListModel {
id: webModel
WebEngineView {
ListElement {
url: "https://kelteseth.gitlab.io/ScreenPlayDocs/"
}
WebEngineView {
ListElement {
url: "https://forum.screen-play.app/"
}
WebEngineView {
ListElement {
url: "https://gitlab.com/kelteseth/ScreenPlay/-/issues"
}
WebEngineView {
ListElement {
url: "https://gitlab.com/kelteseth/ScreenPlay/-/releases"
}
WebEngineView {
ListElement {
url: "https://gitlab.com/kelteseth/ScreenPlay#contributing-for-none-programmer"
}
WebEngineView {
ListElement {
url: "https://steamcommunity.com/app/672870/workshop/"
}
}
Loader {
active: SwipeView.isCurrentItem || SwipeView.isNextItem
|| SwipeView.isPreviousItem
sourceComponent: Item {
Component.onCompleted: timer.start()
Timer {
id: timer
interval: 200
onTriggered: webView.url = webModel.get(index).url
}
WebEngineView {
id: webView
anchors.fill: parent
}
}
}
}
}
}

View File

@ -12,7 +12,6 @@ import "Wizards/CreateWallpaper"
Item {
id: create
anchors.fill: parent
state: "out"
Component.onCompleted: {

View File

@ -240,6 +240,7 @@ Item {
}
}
}
Dialog {
id: deleteDialog
title: qsTr("Are you sure you want to delete this item?")
@ -256,7 +257,6 @@ Item {
Navigation {
id: navWrapper
height: 115
width: parent.width
anchors {
top: parent.top
right: parent.right

View File

@ -14,7 +14,6 @@ import "../Common" as Common
Item {
id: navWrapper
state: "out"
Rectangle {

View File

@ -69,7 +69,6 @@ Item {
font.family: ScreenPlay.settings.font
font.weight: Font.Normal
text: ""
}
Text {

View File

@ -14,7 +14,6 @@ import "../Common"
Item {
id: root
anchors.fill: parent
function indexOfValue(model, value) {

View File

@ -13,7 +13,6 @@ import "upload/"
Item {
id: workshop
state: "base"
anchors.fill: parent
onVisibleChanged: {
if (!visible)
sidebar.close()