Commit ad260f0e authored by Aleksei German's avatar Aleksei German
Browse files

Washing Machine Washprogram extension

parent c514111d
import QtQuick 2.8
Item {
id: root
property int settingsModelId: 4
readonly property real delegateHeight: 30
QtObject {
id: privateContainer
property int previousIndex: -1
}
function newItemSelected(index : int) {
//pick correct model
// var element
// var localView
// switch(settingsModelId) {
// case 0:
// localView = colorView
// break;
// case 1:
// localView = soilView
// break;
// case 2:
// localView = fabricView
// break;
// case 3:
// localView = timeView
// break;
// case 4:
// localView = temperatureView
// break;
// case 5:
// localView = timerView
// break;
// case 6:
// localView = weightView
// break;
// case 7:
// localView = spinView
// break;
// case 8:
// localView = waterView
// break;
// default: return;
// }
// switch(settingsModelId) {
// case 0:
// element = colorView.itemAtIndex(index)
// break;
// case 1:
// element = soilView.itemAtIndex(index)
// break;
// case 2:
// element = fabricView.itemAtIndex(index)
// break;
// case 3:
// element = timeView.itemAtIndex(index)
// break;
// case 4:
// element = temperatureView.itemAtIndex(index)
// break;
// case 5:
// element = timerView.itemAtIndex(index)
// break;
// case 6:
// element = weightView.itemAtIndex(index)
// break;
// case 7:
// element = spinView.itemAtIndex(index)
// break;
// case 8:
// element = waterView.itemAtIndex(index)
// break;
// default: return;
// }
// if (privateContainer.previousIndex > -1) {
// //deselect item
// var element = localView.itemAtIndex(privateContainer.previousIndex)
// if (element != null)
// element.selected = false
// }
// var i;
// for (i = 0; i < localView.model.count; i++) {
// var element = localView.itemAtIndex(i)
// if (element != null)
// element.selected = false
// }
// // select indexed item
// localView.itemAtIndex(index).selected = true
// privateContainer.previousIndex = index
}
Component {
id: textDelegate
Item {
id: delegateItem
x: 5
width: 60
height: delegateHeight
property bool selected: false
Text {
id: delegateText
text: model.name
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 18
horizontalAlignment: Text.AlignHCenter
font.family: "Maven Pro"
color: "#B8B8B8"
visible: !delegateItem.selected
}
Text {
id: delegateSelectedText
text: model.name
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 21
horizontalAlignment: Text.AlignHCenter
font.family: "Maven Pro"
color: "#B8B8FF"
visible: delegateItem.selected
}
MouseArea {
id: delegateMA
anchors.fill: parent
onClicked: {
newItemSelected(index)
}
}
}
}
ListView {
id: colorView
// height: 170
height: (colorModel.count * root.delegateHeight + colorModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: colorModel
visible: false
}
ListView {
id: soilView
height: (soilModel.count * root.delegateHeight + soilModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: soilModel
visible: false
}
ListView {
id: fabricView
height: (fabricModel.count * root.delegateHeight + fabricModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: fabricModel
visible: false
}
ListView {
id: timeView
height: (timeModel.count * root.delegateHeight + timeModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: timeModel
visible: false
}
ListView {
id: temperatureView
height: (temperatureModel.count * root.delegateHeight + temperatureModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: temperatureModel
visible: false
}
ListView {
id: timerView
height: (timerModel.count * root.delegateHeight + timerModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: timerModel
visible: false
}
ListView {
id: weightView
height: (weightModel.count * root.delegateHeight + weightModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: weightModel
visible: false
}
ListView {
id: spinView
height: (spinModel.count * root.delegateHeight + spinModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: spinModel
visible: false
}
ListView {
id: waterView
height: (waterModel.count * root.delegateHeight + waterModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: waterModel
visible: false
}
ListModel {
id: colorModel
ListElement {
name: "Colors"
}
ListElement {
name: "White"
}
ListElement {
name: "Dark"
}
}
ListModel {
id: soilModel
ListElement {
name: "Light"
}
ListElement {
name: "Medium"
}
ListElement {
name: "Heavy"
}
}
ListModel {
id: fabricModel
ListElement {
name: "Wool"
}
ListElement {
name: "Synthetic"
}
ListElement {
name: "Cotton"
}
ListElement {
name: "Silk"
}
ListElement {
name: "Delicates"
}
}
ListModel {
id: timeModel
ListElement {
name: "30"
}
ListElement {
name: "60"
}
ListElement {
name: "90"
}
ListElement {
name: "120"
}
ListElement {
name: "180"
}
}
ListModel {
id: temperatureModel
ListElement {
name: "20°"
}
ListElement {
name: "30°"
}
ListElement {
name: "40°"
}
ListElement {
name: "60°"
}
ListElement {
name: "90°"
}
}
ListModel {
id: timerModel
ListElement {
name: "Off"
}
}
ListModel {
id: weightModel
ListElement {
name: "Light"
}
ListElement {
name: "Medium"
}
ListElement {
name: "Heavy"
}
}
ListModel {
id: spinModel
ListElement {
name: "400"
}
ListElement {
name: "800"
}
ListElement {
name: "1200"
}
ListElement {
name: "1600"
}
ListElement {
name: "2000"
}
}
ListModel {
id: waterModel
ListElement {
name: "Less"
}
ListElement {
name: "Medium"
}
ListElement {
name: "More"
}
}
states: [
State {
name: "colorState"
when: settingsModelId === 0
PropertyChanges {
target: colorView
visible: true
}
},
State {
name: "soilState"
when: settingsModelId === 1
PropertyChanges {
target: soilView
visible: true
}
},
State {
name: "fabricState"
when: settingsModelId === 2
PropertyChanges {
target: fabricView
visible: true
}
},
State {
name: "timeState"
when: settingsModelId === 3
PropertyChanges {
target: timeView
visible: true
}
},
State {
name: "temperatureState"
when: settingsModelId === 4
PropertyChanges {
target: temperatureView
visible: true
}
},
State {
name: "timerState"
when: settingsModelId === 5
PropertyChanges {
target: timerView
visible: true
}
},
State {
name: "weightState"
when: settingsModelId === 6
PropertyChanges {
target: weightView
visible: true
}
},
State {
name: "spinState"
when: settingsModelId === 7
PropertyChanges {
target: spinView
visible: true
}
},
State {
name: "waterState"
when: settingsModelId === 8
PropertyChanges {
target: waterView
visible: true
}
}
]
}
......@@ -26,7 +26,7 @@ Item {
Connections {
target: washprogramgridinstance
onActiveItemChanged: {
washprogsettingsinstance.settingsModelId = washprogramgridinstance.activeItem
washprogsettingsinstance.activeItem = washprogramgridinstance.activeItem
}
}
}
......
......@@ -8,7 +8,7 @@ Item {
signal cancelClicked
signal applyClicked
property int settingsModelId: 4
property int activeItem: 4
Image {
id: scrollcontrol_temp
......@@ -61,359 +61,20 @@ Item {
}
Item {
id: item1
y: 24
id: programs
width: 81
height: 177
height: 149
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
Component {
id: textDelegate
Item {
x: 5
width: 60
height: 30
Text {
text: model.name
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: "#B8B8B8"
font.pixelSize: 18
horizontalAlignment: Text.AlignHCenter
font.family: "Maven Pro"
}
}
}
ListView {
id: colorView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: colorModel
visible: false
}
ListView {
id: soilView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: soilModel
visible: false
}
ListView {
id: fabricView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: fabricModel
visible: false
}
ListView {
id: timeView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: timeModel
visible: false
}
ListView {
id: temperatureView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: temperatureModel
visible: false
}
ListView {
id: timerView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: timerModel
visible: false
}
ListView {
id: weightView
height: 170
width: 80
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
delegate: textDelegate
model: weightModel
visible: false
}
ListView {