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

Washing Machine: improved programs screen

parent 0f5df0d9
......@@ -5,90 +5,144 @@ 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
readonly property real delegateHeight: 30
QtObject {
id: privateContainer
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
function getColorName(modelIndex : int) : string {
if (modelIndex < colorModel.count)
return colorModel.get(modelIndex).name
return ""
}
function getSoilName(modelIndex : int) : string {
if (modelIndex < soilModel.count)
return soilModel.get(modelIndex).name
return ""
}
function getFabricName(modelIndex : int) : string {
if (modelIndex < fabricModel.count)
return fabricModel.get(modelIndex).name
return ""
}
function getTimeName(modelIndex : int) : string {
if (modelIndex < timeModel.count)
return timeModel.get(modelIndex).name
return ""
}
function getTemperatureName(modelIndex : int) : string {
if (modelIndex < temperatureModel.count)
return temperatureModel.get(modelIndex).name
return ""
}
function getTimerName(modelIndex : int) : string {
if (modelIndex < timerModel.count)
return timerModel.get(modelIndex).name
return ""
}
function getWeightName(modelIndex : int) : string {
if (modelIndex < weightModel.count)
return weightModel.get(modelIndex).name
return ""
}
function getSpinName(modelIndex : int) : string {
if (modelIndex < spinModel.count)
return spinModel.get(modelIndex).name
return ""
}
function getWaterName(modelIndex : int) : string {
if (modelIndex < waterModel.count)
return waterModel.get(modelIndex).name
return ""
}
function newItemSelected(index : int) {
//pick correct model
var i
var element
switch(settingsModelId) {
case 0:
for (i = 0; i < colorModel.count; i++) {
var element = colorView.itemAtIndex(i)
// if (element !== null)
element = colorView.itemAtIndex(i)
// if (element !== null) //check is not supported in qt4mcu 1.6 for that type
element.selected = false
}
colorView.itemAtIndex(index).selected = true
activeColorId = index
break;
case 1:
for (i = 0; i < soilModel.count; i++) {
var element = soilView.itemAtIndex(i)
element = soilView.itemAtIndex(i)
element.selected = false
}
soilView.itemAtIndex(index).selected = true
activeSoilId = index
break;
case 2:
for (i = 0; i < fabricModel.count; i++) {
var element = fabricView.itemAtIndex(i)
element = fabricView.itemAtIndex(i)
element.selected = false
}
fabricView.itemAtIndex(index).selected = true
activeFabricId = index
break;
case 3:
for (i = 0; i < timeModel.count; i++) {
var element = timeView.itemAtIndex(i)
element = timeView.itemAtIndex(i)
element.selected = false
}
timeView.itemAtIndex(index).selected = true
activeTimeId = index
break;
case 4:
for (i = 0; i < temperatureModel.count; i++) {
var element = temperatureView.itemAtIndex(i)
element = temperatureView.itemAtIndex(i)
element.selected = false
}
temperatureView.itemAtIndex(index).selected = true
activeTemperatureId = index
break;
case 5:
for (i = 0; i < timerModel.count; i++) {
var element = timerView.itemAtIndex(i)
element = timerView.itemAtIndex(i)
element.selected = false
}
timerView.itemAtIndex(index).selected = true
activeTimerId = index
break;
case 6:
for (i = 0; i < weightModel.count; i++) {
var element = weightView.itemAtIndex(i)
element = weightView.itemAtIndex(i)
element.selected = false
}
weightView.itemAtIndex(index).selected = true
activeWeightId = index
break;
case 7:
for (i = 0; i < spinModel.count; i++) {
var element = spinView.itemAtIndex(i)
element = spinView.itemAtIndex(i)
element.selected = false
}
spinView.itemAtIndex(index).selected = true
activeSpinId = index
break;
case 8:
for (i = 0; i < waterModel.count; i++) {
var element = waterView.itemAtIndex(i)
element = waterView.itemAtIndex(i)
element.selected = false
}
waterView.itemAtIndex(index).selected = true
activeWaterId = index
break;
default: return;
}
......@@ -142,7 +196,6 @@ Item {
ListView {
id: colorView
// height: 170
height: (colorModel.count * root.delegateHeight + colorModel.count * spacing)
width: 80
anchors.verticalCenter: parent.verticalCenter
......
......@@ -17,29 +17,39 @@ Item {
}
Washprogramgrid {
id: washprogramgridinstance
id: washProgramGrid
x: -9
y: 5
width: 260
height: 270
Connections {
target: washprogramgridinstance
target: washProgramGrid
onActiveItemChanged: {
washprogsettingsinstance.activeItem = washprogramgridinstance.activeItem
washProgramSettings.activeItem = washProgramGrid.activeItem
}
}
colorLabel: washProgramSettings.colorStr
soilLabel: washProgramSettings.soilStr
fabricLabel: washProgramSettings.fabricStr
timeLabel: washProgramSettings.timeStr
temperatureLabel: washProgramSettings.temperatureStr
timerLabel: washProgramSettings.timerStr
weightLabel: washProgramSettings.weightStr
spinLabel: washProgramSettings.spinStr
waterLabel: washProgramSettings.waterStr
}
Washprogramsettings {
id: washprogsettingsinstance
id: washProgramSettings
x: 269
y: 1
width: 131
height: 273
Connections {
target: washprogsettingsinstance
target: washProgramSettings
onCancelClicked: {
washprogramScreen.canceled()
......
......@@ -7,6 +7,16 @@ Item {
property int activeItem: 4
property alias colorLabel: washprogramitem0.currentvaluelabelText
property alias soilLabel: washprogramitem1.currentvaluelabelText
property alias fabricLabel: washprogramitem2.currentvaluelabelText
property alias timeLabel: washprogramitem3.currentvaluelabelText
property alias temperatureLabel: washprogramitem4.currentvaluelabelText
property alias timerLabel: washprogramitem5.currentvaluelabelText
property alias weightLabel: washprogramitem6.currentvaluelabelText
property alias spinLabel: washprogramitem7.currentvaluelabelText
property alias waterLabel: washprogramitem8.currentvaluelabelText
Image {
id: gridimage
x: 9
......
......@@ -10,6 +10,18 @@ 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)
property string timeStr: programList.getTimeName(programList.activeTimeId)
property string temperatureStr: programList.getTemperatureName(programList.activeTemperatureId)
property string timerStr: programList.getTimerName(programList.activeTimerId)
property string weightStr: programList.getWeightName(programList.activeWeightId)
property string spinStr: programList.getSpinName(programList.activeSpinId)
property string waterStr: programList.getWaterName(programList.activeWaterId)
Image {
id: scrollcontrol_temp
x: 41
......
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