diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index 60482dbc..f0932512 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -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() + + property int duration: 300 + + 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 + } + } + 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 } } } - Timer { - id: timerLoader - interval: 500 - onTriggered: { - pageLoaderCreate.source = "qrc:/qml/Create/Create.qml" - } - } - - Loader { - id: pageLoaderCreate - visible: false - anchors { - top: nav.bottom - right: parent.right - bottom: parent.bottom - left: parent.left - } - } - - Loader { - id: pageLoaderWorkshop - visible: false - enabled: ScreenPlay.settings.steamVersion - asynchronous: true - anchors { - top: nav.bottom - right: parent.right - bottom: parent.bottom - left: parent.left - } - } - Connections { - target: pageLoader.item + target: stackView.currentItem ignoreUnknownSignals: true function onSetSidebarActive(active) { diff --git a/ScreenPlay/qml.qrc b/ScreenPlay/qml.qrc index 9651dd86..7a915696 100644 --- a/ScreenPlay/qml.qrc +++ b/ScreenPlay/qml.qrc @@ -72,5 +72,7 @@ qml/Installed/Navigation.qml qml/Common/Search.qml qml/Common/MouseHoverBlocker.qml + qml/Common/Dialogs/MonitorConfiguration.qml + qml/Common/Dialogs/SteamNotAvailable.qml diff --git a/ScreenPlay/qml/Common/Background.qml b/ScreenPlay/qml/Common/Background.qml index 8787f393..bb34f2c2 100644 --- a/ScreenPlay/qml/Common/Background.qml +++ b/ScreenPlay/qml/Common/Background.qml @@ -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: "*" diff --git a/ScreenPlay/qml/Common/Dialogs/MonitorConfiguration.qml b/ScreenPlay/qml/Common/Dialogs/MonitorConfiguration.qml new file mode 100644 index 00000000..4dce81a6 --- /dev/null +++ b/ScreenPlay/qml/Common/Dialogs/MonitorConfiguration.qml @@ -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() + } + } +} diff --git a/ScreenPlay/qml/Common/Dialogs/SteamNotAvailable.qml b/ScreenPlay/qml/Common/Dialogs/SteamNotAvailable.qml new file mode 100644 index 00000000..faa8932d --- /dev/null +++ b/ScreenPlay/qml/Common/Dialogs/SteamNotAvailable.qml @@ -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!") +} diff --git a/ScreenPlay/qml/Community/Community.qml b/ScreenPlay/qml/Community/Community.qml index 5dc4b958..c45b0f47 100644 --- a/ScreenPlay/qml/Community/Community.qml +++ b/ScreenPlay/qml/Community/Community.qml @@ -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 { - url: "https://kelteseth.gitlab.io/ScreenPlayDocs/" - } + ListElement { + url: "https://kelteseth.gitlab.io/ScreenPlayDocs/" + } + ListElement { + url: "https://forum.screen-play.app/" + } - WebEngineView { - url: "https://forum.screen-play.app/" - } + ListElement { + url: "https://gitlab.com/kelteseth/ScreenPlay/-/issues" + } - WebEngineView { - url: "https://gitlab.com/kelteseth/ScreenPlay/-/issues" - } + ListElement { + url: "https://gitlab.com/kelteseth/ScreenPlay/-/releases" + } - WebEngineView { - url: "https://gitlab.com/kelteseth/ScreenPlay/-/releases" - } + ListElement { + url: "https://gitlab.com/kelteseth/ScreenPlay#contributing-for-none-programmer" + } - WebEngineView { - url: "https://gitlab.com/kelteseth/ScreenPlay#contributing-for-none-programmer" - } + ListElement { + url: "https://steamcommunity.com/app/672870/workshop/" + } + } - WebEngineView { - 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 + } + } + } } } } diff --git a/ScreenPlay/qml/Create/Create.qml b/ScreenPlay/qml/Create/Create.qml index e8818448..4f09929b 100644 --- a/ScreenPlay/qml/Create/Create.qml +++ b/ScreenPlay/qml/Create/Create.qml @@ -12,7 +12,6 @@ import "Wizards/CreateWallpaper" Item { id: create - anchors.fill: parent state: "out" Component.onCompleted: { diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index 531da4e3..a1786b7f 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -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 diff --git a/ScreenPlay/qml/Installed/Navigation.qml b/ScreenPlay/qml/Installed/Navigation.qml index 13e5ef40..bf55d939 100644 --- a/ScreenPlay/qml/Installed/Navigation.qml +++ b/ScreenPlay/qml/Installed/Navigation.qml @@ -14,7 +14,6 @@ import "../Common" as Common Item { id: navWrapper - state: "out" Rectangle { diff --git a/ScreenPlay/qml/Navigation/NavigationItem.qml b/ScreenPlay/qml/Navigation/NavigationItem.qml index 5afad722..fe30d6a7 100644 --- a/ScreenPlay/qml/Navigation/NavigationItem.qml +++ b/ScreenPlay/qml/Navigation/NavigationItem.qml @@ -69,7 +69,6 @@ Item { font.family: ScreenPlay.settings.font font.weight: Font.Normal text: "" - } Text { diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 7d68cdcc..8fa5a964 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -14,7 +14,6 @@ import "../Common" Item { id: root - anchors.fill: parent function indexOfValue(model, value) { diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 9a560be7..8edd01d1 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -13,7 +13,6 @@ import "upload/" Item { id: workshop state: "base" - anchors.fill: parent onVisibleChanged: { if (!visible) sidebar.close()