From 19b3bf936c10ba5aa1823e0be4277e20dc129616 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 26 Jan 2020 16:17:09 +0100 Subject: [PATCH] Fix not clickable navigation by replacing it with the official quick controls navigation --- ScreenPlay/Resources.qrc | 1 - ScreenPlay/qml/Installed/Installed.qml | 132 +++++++------- .../qml/Installed/InstalledNavigation.qml | 162 ------------------ 3 files changed, 59 insertions(+), 236 deletions(-) delete mode 100644 ScreenPlay/qml/Installed/InstalledNavigation.qml diff --git a/ScreenPlay/Resources.qrc b/ScreenPlay/Resources.qrc index b5d4c8ed..5142e8f2 100644 --- a/ScreenPlay/Resources.qrc +++ b/ScreenPlay/Resources.qrc @@ -82,7 +82,6 @@ qml/Create/CreateContent.qml qml/Create/CreateContentButton.qml qml/Installed/Installed.qml - qml/Installed/InstalledNavigation.qml qml/Installed/ScreenPlayItem.qml qml/Installed/ScreenPlayItemImage.qml qml/Installed/Sidebar.qml diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index cd327380..a5f919fc 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -1,5 +1,5 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.5 +import QtQuick 2.14 +import QtQuick.Controls 2.14 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 @@ -17,13 +17,13 @@ Item { Component.onCompleted: { pageInstalled.state = "in" - ScreenPlay.installedListFilter.sortByRoleType("All") + ScreenPlay.installedListFilter.sortByRoleType("All") checkIsContentInstalled() } Action { shortcut: "F5" - onTriggered: ScreenPlay.installedListModel.reset() + onTriggered: ScreenPlay.installedListModel.reset() } Connections { @@ -37,8 +37,8 @@ Item { onInstalledLoadingFinished: { checkIsContentInstalled() } - onCountChanged:{ - if(count === 0){ + onCountChanged: { + if (count === 0) { checkIsContentInstalled() } } @@ -186,35 +186,6 @@ Item { } } - function onPageChanged(name) { - setSidebarActive(false) - if (name === "All") { - ScreenPlay.installedListFilter.sortByRoleType("All") - navAll.state = "active" - navWallpaper.state = "inactive" - navWidgets.state = "inactive" - navScenes.state = "inactive" - } else if (name === "Videos") { - ScreenPlay.installedListFilter.sortByRoleType("Videos") - navAll.state = "inactive" - navWallpaper.state = "active" - navWidgets.state = "inactive" - navScenes.state = "inactive" - } else if (name === "Widgets") { - ScreenPlay.installedListFilter.sortByRoleType("Widgets") - navAll.state = "inactive" - navWallpaper.state = "inactive" - navWidgets.state = "active" - navScenes.state = "inactive" - } else if (name === "Scenes") { - ScreenPlay.installedListFilter.sortByRoleType("Scenes") - navAll.state = "inactive" - navWallpaper.state = "inactive" - navWidgets.state = "inactive" - navScenes.state = "active" - } - } - Item { id: navWrapper height: 115 @@ -248,56 +219,71 @@ Item { right: parent.right left: parent.left } - - Row { + TabBar { + height: parent.height + background: Item {} anchors { top: parent.top - right: icnSearch.left + topMargin: 5 left: parent.left leftMargin: 20 bottom: parent.bottom - bottomMargin: -5 } - spacing: 0 - - InstalledNavigation { - id: navAll - state: "active" - name: qsTr("All") - iconSource: "qrc:/assets/icons/icon_installed.svg" - onPageClicked: { - onPageChanged(name) + TabButton { + text: qsTr("All") + icon.height: 16 + icon.width: 16 + height: parent.height + width: implicitWidth + background: Item {} + icon.source: "qrc:/assets/icons/icon_installed.svg" + onClicked: { + setSidebarActive(false) + ScreenPlay.installedListFilter.sortByRoleType("All") } } - InstalledNavigation { - id: navWallpaper - state: "inactive" - name: qsTr("Videos") - iconSource: "qrc:/assets/icons/icon_movie.svg" - onPageClicked: { - onPageChanged(name) + TabButton { + text: qsTr("Scenes") + icon.height: 16 + icon.width: 16 + width: implicitWidth + height: parent.height + background: Item {} + icon.source: "qrc:/assets/icons/icon_code.svg" + onClicked: { + setSidebarActive(false) + ScreenPlay.installedListFilter.sortByRoleType("Scenes") } } - InstalledNavigation { - id: navScenes - state: "inactive" - name: qsTr("Scenes") - iconSource: "qrc:/assets/icons/icon_code.svg" - onPageClicked: { - onPageChanged(name) + TabButton { + text: qsTr("Videos") + icon.height: 16 + icon.width: 16 + height: parent.height + width: implicitWidth + background: Item {} + icon.source: "qrc:/assets/icons/icon_movie.svg" + onClicked: { + setSidebarActive(false) + ScreenPlay.installedListFilter.sortByRoleType("Videos") } } - InstalledNavigation { - id: navWidgets - state: "inactive" - name: qsTr("Widgets") - iconSource: "qrc:/assets/icons/icon_widgets.svg" - onPageClicked: { - onPageChanged(name) + TabButton { + text: qsTr("Widgets") + icon.height: 16 + icon.width: 16 + height: parent.height + width: implicitWidth + background: Item {} + icon.source: "qrc:/assets/icons/icon_widgets.svg" + onClicked: { + setSidebarActive(false) + ScreenPlay.installedListFilter.sortByRoleType("Widgets") } } } + Image { id: icnSearch source: "qrc:/assets/icons/icon_search.svg" @@ -320,18 +306,18 @@ Item { anchors { right: icnSearch.right rightMargin: 20 - top:parent.top - topMargin:10 + top: parent.top + topMargin: 10 } onTextChanged: { if (txtSearch.text.length === 0) { ScreenPlay.installedListFilter.resetFilter() } else { - ScreenPlay.installedListFilter.sortByName(txtSearch.text) + ScreenPlay.installedListFilter.sortByName( + txtSearch.text) } } - selectByMouse: true placeholderText: qsTr("Search for Wallpaper & Widgets") } diff --git a/ScreenPlay/qml/Installed/InstalledNavigation.qml b/ScreenPlay/qml/Installed/InstalledNavigation.qml deleted file mode 100644 index f1d35a8f..00000000 --- a/ScreenPlay/qml/Installed/InstalledNavigation.qml +++ /dev/null @@ -1,162 +0,0 @@ -import QtQuick 2.12 -import QtGraphicalEffects 1.0 - -Item { - id: navigationItem - width: 150 - height: 50 - state: "inactive" - clip: true - - property string name: "value" - onNameChanged: { - txt.text = name - textMetrics.text = name - item2.width = textMetrics.width + 30 - } - - property string iconSource: "qrc:/assets/icons/icon_installed.svg" - - signal pageClicked(string name) - - function setActive(isActive) { - if (isActive) { - navigationItem.state = "active" - } else { - navigationItem.state = "inactive" - } - } - - TextMetrics { - id: textMetrics - font.pointSize: 14 - font.family: "Roboto" - } - - MouseArea { - id: mouseArea - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - navigationItem.pageClicked(navigationItem.name) - } - - Item { - id: item2 - - width: 80 - height: 31 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - - Text { - id: txt - anchors.left: icon.right - anchors.leftMargin: 10 - text: "name" - font.pointSize: 12 - color: "#626262" - anchors.verticalCenter: parent.verticalCenter - font.family: "Roboto" - font.weight: Font.Normal - - } - - Image { - id: icon - source: iconSource - width: 14 - height: 14 - sourceSize.height: 14 - sourceSize.width: 14 - fillMode: Image.PreserveAspectFit - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.verticalCenter: parent.verticalCenter - } - - ColorOverlay { - id: iconColorOverlay - anchors.fill: icon - source: icon - color: "#FFAB00" - } - } - - Rectangle { - id: navIndicator - y: 83 - height: 3 - color: "#FFAB00" - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - } - } - - states: [ - State { - name: "active" - - PropertyChanges { - target: navIndicator - anchors.bottomMargin: 0 - } - - PropertyChanges { - target: iconColorOverlay - color: "#FFAB00" - } - }, - State { - name: "disabled" - - PropertyChanges { - target: navIndicator - anchors.bottomMargin: -3 - } - - PropertyChanges { - target: iconColorOverlay - color: "#00000000" - } - }, - State { - name: "inactive" - - PropertyChanges { - target: navIndicator - anchors.bottomMargin: -3 - } - - PropertyChanges { - target: iconColorOverlay - color: "#BEBEBE" - } - } - ] - - transitions: [ - Transition { - to: "active" - - NumberAnimation { - properties: "anchors.bottomMargin" - duration: 100 - easing.type: Easing.OutQuart - } - }, - Transition { - to: "inactive" - - NumberAnimation { - properties: "anchors.bottomMargin" - duration: 100 - easing.type: Easing.OutQuart - } - } - ] -}