Make dashboard wizard usable on small screens

pull/1067/head
Michael Zanetti 2023-10-11 23:50:23 +02:00
parent d4ee1af24b
commit a84c7905d5
2 changed files with 73 additions and 51 deletions

View File

@ -42,6 +42,11 @@ BigThingTile {
id: dataGrid id: dataGrid
columns: Math.floor(contentItem.width / 120) columns: Math.floor(contentItem.width / 120)
Connections {
target: itemDelegate
onThingChanged: stateModel.update()
}
ListModel { ListModel {
id: interfacesModel id: interfacesModel
ListElement { interfaceName: "temperaturesensor"; stateName: "temperature" } ListElement { interfaceName: "temperaturesensor"; stateName: "temperature" }
@ -74,8 +79,13 @@ BigThingTile {
} }
Repeater { Repeater {
model: ListModel { model: ListModel {
id: stateModel
dynamicRoles: true dynamicRoles: true
Component.onCompleted: { Component.onCompleted: {
update()
}
function update() {
for (var i = 0; i < interfacesModel.count; i++) { for (var i = 0; i < interfacesModel.count; i++) {
if (itemDelegate.thing.thingClass.interfaces.indexOf(interfacesModel.get(i).interfaceName) >= 0) { if (itemDelegate.thing.thingClass.interfaces.indexOf(interfacesModel.get(i).interfaceName) >= 0) {
append(interfacesModel.get(i)) append(interfacesModel.get(i))

View File

@ -57,63 +57,75 @@ NymeaDialog {
implicitHeight: currentItem.implicitHeight implicitHeight: currentItem.implicitHeight
clip: true clip: true
initialItem: ColumnLayout { initialItem: Flickable {
id: contentColumn id: flickable
implicitHeight: childrenRect.height width: internalPageStack.width
NymeaItemDelegate { implicitHeight: contentColumn.implicitHeight
Layout.fillWidth: true contentHeight: contentColumn.implicitHeight
text: qsTr("Thing") contentWidth: width
iconName: "things"
onClicked: { ScrollBar.vertical: ScrollBar {}
internalPageStack.push(addThingSelectionComponent)
ColumnLayout {
id: contentColumn
width: flickable.width
implicitHeight: childrenRect.height
NymeaItemDelegate {
Layout.fillWidth: true
text: qsTr("Thing")
iconName: "things"
onClicked: {
internalPageStack.push(addThingSelectionComponent)
}
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true text: qsTr("Sensor")
iconName: "sensors" iconName: "sensors"
text: qsTr("Sensor") onClicked: {
onClicked: { internalPageStack.push(addSensorComponent)
internalPageStack.push(addSensorComponent) }
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true text: qsTr("State")
iconName: "folder" iconName: "state"
text: qsTr("Folder") onClicked: {
onClicked: { internalPageStack.push(addStateSelectThingComponent)
internalPageStack.push(addFolderComponent) }
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true text: qsTr("Chart")
text: qsTr("State") iconName: "chart"
iconName: "state" onClicked: {
onClicked: { internalPageStack.push(addGraphSelectThingComponent)
internalPageStack.push(addStateSelectThingComponent) }
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true iconName: "folder"
text: qsTr("Chart") text: qsTr("Folder")
iconName: "chart" onClicked: {
onClicked: { internalPageStack.push(addFolderComponent)
internalPageStack.push(addGraphSelectThingComponent) }
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true text: qsTr("Scene")
text: qsTr("Scene") iconName: "slideshow"
iconName: "slideshow" onClicked: {
onClicked: { internalPageStack.push(addSceneComponent)
internalPageStack.push(addSceneComponent) }
} }
} NymeaItemDelegate {
NymeaItemDelegate { Layout.fillWidth: true
Layout.fillWidth: true text: qsTr("Web view")
text: qsTr("Web view") iconName: "stock_website"
iconName: "stock_website" onClicked: {
onClicked: { internalPageStack.push(addWebViewComponent)
internalPageStack.push(addWebViewComponent) }
} }
} }
} }