Commit 46e76c72 authored by Aleksei German's avatar Aleksei German
Browse files

Washing Machine: Improved default programs state

parent c31daafb
......@@ -57,16 +57,6 @@ Item {
MouseArea {
id: ma
anchors.fill: parent
Connections {
target: ma
onPressed: {
console.log("Hello, i am pressed")
}
onReleased: {
console.log("hi, i was released")
}
}
}
Connections {
......
......@@ -27,7 +27,6 @@ Item {
target: presets
onPresetSelected: {
presetsScreen.runDuration = presets.duration
console.log("duration is:" + presetsScreen.runDuration)
quickstart.runDuration = presetsScreen.runDuration
......@@ -48,6 +47,7 @@ Item {
}
onDetailsClicked: {
washprogram.resetSettings()
presetsScreen.state = "WashProgram"
}
}
......
......@@ -21,8 +21,6 @@ Item {
Connections {
target: preset0
onClicked: {
console.log("Custom Clicked")
presetsroll.duration = preset0.customDefaultDuration
presetSelected()
......@@ -43,8 +41,6 @@ Item {
Connections {
target: preset1
onClicked: {
console.log("Sports Clicked")
presetsroll.duration = preset1.sportsDuration
presetSelected()
......@@ -65,8 +61,6 @@ Item {
Connections {
target: preset2
onClicked: {
console.log("Eco Clicked")
presetsroll.duration = preset2.ecoDuration
presetSelected()
......@@ -87,8 +81,6 @@ Item {
Connections {
target: preset3
onClicked: {
console.log("Hot Clicked")
presetsroll.duration = preset3.hotDuration
presetSelected()
......
......@@ -28,8 +28,6 @@ Item {
Connections {
target: quickstartdetails
onClicked: {
console.log("Details Clicked")
detailsClicked()
}
}
......@@ -46,8 +44,6 @@ Item {
Connections {
target: quickstartgo
onClicked: {
console.log("Go Clicked")
applied()
}
}
......
......@@ -27,8 +27,6 @@ Item {
Connections {
target: quickstartdetails
onClicked: {
console.log("No")
canceled()
}
}
......@@ -45,8 +43,6 @@ Item {
Connections {
target: quickstartgo
onClicked: {
console.log("Yes")
accepted()
}
}
......
......@@ -5,18 +5,75 @@ Item {
property int settingsModelId: 4
property int activeColorId
property int activeSoilId
property int activeFabricId
property int activeTimeId
property int activeTemperatureId
property int activeTimerId
property int activeWeightId
property int activeSpinId
property int activeWaterId
property int activeColorId: defaultIds.color
property int activeSoilId: defaultIds.soil
property int activeFabricId: defaultIds.fabric
property int activeTimeId: defaultIds.time
property int activeTemperatureId: defaultIds.temperature
property int activeTimerId: defaultIds.timer
property int activeWeightId: defaultIds.weight
property int activeSpinId: defaultIds.spin
property int activeWaterId: defaultIds.water
readonly property real delegateHeight: 30
QtObject {
id: defaultIds
readonly property int color: 1
readonly property int soil: 1
readonly property int fabric: 2
readonly property int time: 2
readonly property int temperature: 2
readonly property int timer: 0
readonly property int weight: 1
readonly property int spin: 2
readonly property int water: 1
}
function resetActiveIds() {
root.activeColorId = defaultIds.color
root.activeSoilId = defaultIds.soil
root.activeFabricId = defaultIds.fabric
root.activeTimeId = defaultIds.time
root.activeTemperatureId = defaultIds.temperature
root.activeTimerId = defaultIds.timer
root.activeWeightId = defaultIds.weight
root.activeSpinId = defaultIds.spin
root.activeWaterId = defaultIds.water
}
function updateActiveView() {
switch(settingsModelId) {
case 0:
colorView.updateView()
break
case 1:
soilView.updateView()
break
case 2:
fabricView.updateView()
break
case 3:
timeView.updateView()
break
case 4:
temperatureView.updateView()
break
case 5:
timerView.updateView()
break
case 6:
weightView.updateView()
break
case 7:
spinView.updateView()
break
case 8:
waterView.updateView()
break
default: break;
}
}
function getColorName(modelIndex : int) : string {
if (modelIndex < colorModel.count)
......@@ -65,6 +122,8 @@ Item {
}
function newItemSelected(index : int) {
//pick correct model
var i
......@@ -205,6 +264,14 @@ Item {
model: colorModel
visible: false
function updateView() {
for (var i = 0; i < colorModel.count; i++) {
var element = colorView.itemAtIndex(i)
element.selected = false
}
colorView.itemAtIndex(activeColorId).selected = true
}
}
......@@ -219,7 +286,16 @@ Item {
model: soilModel
visible: false
function updateView() {
for (var i = 0; i < soilModel.count; i++) {
var element = soilView.itemAtIndex(i)
element.selected = false
}
soilView.itemAtIndex(activeSoilId).selected = true
}
}
ListView {
id: fabricView
height: (fabricModel.count * root.delegateHeight + fabricModel.count * spacing)
......@@ -231,7 +307,16 @@ Item {
model: fabricModel
visible: false
function updateView() {
for (var i = 0; i < fabricModel.count; i++) {
var element = fabricView.itemAtIndex(i)
element.selected = false
}
fabricView.itemAtIndex(activeFabricId).selected = true
}
}
ListView {
id: timeView
height: (timeModel.count * root.delegateHeight + timeModel.count * spacing)
......@@ -243,7 +328,16 @@ Item {
model: timeModel
visible: false
function updateView() {
for (var i = 0; i < timeModel.count; i++) {
var element = timeView.itemAtIndex(i)
element.selected = false
}
timeView.itemAtIndex(activeTimeId).selected = true
}
}
ListView {
id: temperatureView
height: (temperatureModel.count * root.delegateHeight + temperatureModel.count * spacing)
......@@ -255,7 +349,16 @@ Item {
model: temperatureModel
visible: false
function updateView() {
for (var i = 0; i < temperatureModel.count; i++) {
var element = temperatureView.itemAtIndex(i)
element.selected = false
}
temperatureView.itemAtIndex(activeTemperatureId).selected = true
}
}
ListView {
id: timerView
height: (timerModel.count * root.delegateHeight + timerModel.count * spacing)
......@@ -267,7 +370,16 @@ Item {
model: timerModel
visible: false
function updateView() {
for (var i = 0; i < timerModel.count; i++) {
var element = timerView.itemAtIndex(i)
element.selected = false
}
timerView.itemAtIndex(activeTimerId).selected = true
}
}
ListView {
id: weightView
height: (weightModel.count * root.delegateHeight + weightModel.count * spacing)
......@@ -279,7 +391,16 @@ Item {
model: weightModel
visible: false
function updateView() {
for (var i = 0; i < weightModel.count; i++) {
var element = weightView.itemAtIndex(i)
element.selected = false
}
weightView.itemAtIndex(activeWeightId).selected = true
}
}
ListView {
id: spinView
height: (spinModel.count * root.delegateHeight + spinModel.count * spacing)
......@@ -291,7 +412,16 @@ Item {
model: spinModel
visible: false
function updateView() {
for (var i = 0; i < spinModel.count; i++) {
var element = spinView.itemAtIndex(i)
element.selected = false
}
spinView.itemAtIndex(activeSpinId).selected = true
}
}
ListView {
id: waterView
height: (waterModel.count * root.delegateHeight + waterModel.count * spacing)
......@@ -303,6 +433,14 @@ Item {
model: waterModel
visible: false
function updateView() {
for (var i = 0; i < waterModel.count; i++) {
var element = waterView.itemAtIndex(i)
element.selected = false
}
waterView.itemAtIndex(activeWaterId).selected = true
}
}
......
......@@ -8,6 +8,8 @@ Item {
signal canceled
signal applied
signal resetSettings
Flatbackground {
id: backgroundfull
x: 0
......@@ -60,4 +62,13 @@ Item {
}
}
}
Connections {
target: washprogramScreen
onResetSettings: {
washProgramSettings.resetSettingsScreen()
washProgramGrid.activeItem = 4
}
}
}
......@@ -10,8 +10,6 @@ Item {
property int activeItem: 4
signal getItemText (int itemId)
property string colorStr: programList.getColorName(programList.activeColorId)
property string soilStr: programList.getSoilName(programList.activeSoilId)
property string fabricStr: programList.getFabricName(programList.activeFabricId)
......@@ -22,6 +20,17 @@ Item {
property string spinStr: programList.getSpinName(programList.activeSpinId)
property string waterStr: programList.getWaterName(programList.activeWaterId)
signal resetSettingsScreen
onActiveItemChanged: {
programList.settingsModelId = washprogramsettings.activeItem
programList.updateActiveView()
}
onResetSettingsScreen: {
programList.resetActiveIds()
}
Image {
id: scrollcontrol_temp
x: 41
......@@ -83,8 +92,6 @@ Item {
id: programList
anchors.fill: parent
settingsModelId: washprogramsettings.activeItem
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment