1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 02:52:29 +01:00

Fix not clickable navigation by replacing it with the official quick controls navigation

This commit is contained in:
Elias Steurer 2020-01-26 16:17:09 +01:00
parent 537f14dace
commit 19b3bf936c
3 changed files with 59 additions and 236 deletions

View File

@ -82,7 +82,6 @@
<file>qml/Create/CreateContent.qml</file>
<file>qml/Create/CreateContentButton.qml</file>
<file>qml/Installed/Installed.qml</file>
<file>qml/Installed/InstalledNavigation.qml</file>
<file>qml/Installed/ScreenPlayItem.qml</file>
<file>qml/Installed/ScreenPlayItemImage.qml</file>
<file>qml/Installed/Sidebar.qml</file>

View File

@ -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")
}

View File

@ -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
}
}
]
}