diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index f6d4f829..efebf295 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -24,15 +24,9 @@ ApplicationWindow { visible: false width: 1400 height: 788 - title: "ScreenPlay Alpha - V0.13.0" + title: "ScreenPlay Alpha - 0.13.0" minimumHeight: 450 minimumWidth: 1050 - onVisibilityChanged: { - if (window.visibility === 2) { - switchPage("Installed") - nav.setNavigation("Installed") - } - } // Partial workaround for // https://bugreports.qt.io/browse/QTBUG-86047 @@ -40,6 +34,7 @@ ApplicationWindow { Component.onCompleted: { setTheme(ScreenPlay.settings.theme) + switchPage("Installed") if (!ScreenPlay.settings.silentStart) { window.show() @@ -85,6 +80,9 @@ ApplicationWindow { } function switchPage(name) { + if (nav.currentNavigationName === name) + return + if (name === "Workshop") { if (!ScreenPlay.settings.steamVersion) { const steamAvialable = ScreenPlay.loadSteamPlugin() @@ -111,7 +109,6 @@ ApplicationWindow { Common.TrayIcon {} - StackView { id: stackView anchors { diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index 63a40684..2ba3f686 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -10,7 +10,7 @@ import "../Workshop" import "../Common" Rectangle { - id: navigation + id: root height: 60 clip: true width: 1366 @@ -24,6 +24,7 @@ Rectangle { signal changePage(string name) + property string currentNavigationName: "" property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity] property bool navActive: true @@ -40,18 +41,19 @@ Rectangle { function setActive(active) { navActive = active if (active) { - navigation.state = "enabled" + root.state = "enabled" } else { - navigation.state = "disabled" + root.state = "disabled" } } - function setNavigation(name){ + function setNavigation(name) { var i = 0 for (; i < navArray.length; i++) { - if (navArray[i].name === name) + if (navArray[i].name === name) { navArray[i].state = "active" - else { + root.currentNavigationName = name + } else { navArray[i].state = "inactive" } } @@ -64,7 +66,7 @@ Rectangle { if (!navActive) return - navigation.changePage(name) + root.changePage(name) setNavigation(name) } @@ -81,7 +83,7 @@ Rectangle { name: "Create" iconSource: "qrc:/assets/icons/icon_plus.svg" - onPageClicked: navigation.onPageChanged(name) + onPageClicked: root.onPageChanged(name) } NavigationItem { @@ -89,7 +91,7 @@ Rectangle { state: "inactive" name: "Workshop" iconSource: "qrc:/assets/icons/icon_steam.svg" - onPageClicked: navigation.onPageChanged(name) + onPageClicked: root.onPageChanged(name) } NavigationItem { @@ -98,7 +100,7 @@ Rectangle { name: "Installed" amount: ScreenPlay.installedListModel.count iconSource: "qrc:/assets/icons/icon_installed.svg" - onPageClicked: navigation.onPageChanged(name) + onPageClicked: root.onPageChanged(name) } NavigationItem { @@ -106,18 +108,19 @@ Rectangle { state: "inactive" name: "Community" iconSource: "qrc:/assets/icons/icon_community.svg" - onPageClicked: navigation.onPageChanged(name) + onPageClicked: root.onPageChanged(name) } NavigationItem { id: navSettings state: "inactive" name: "Settings" iconSource: "qrc:/assets/icons/icon_settings.svg" - onPageClicked: navigation.onPageChanged(name) + onPageClicked: root.onPageChanged(name) } } NavigationWallpaperConfiguration {} + states: [ State { name: "enabled"