BrightnessGroupBox qml complete

This commit is contained in:
ykeara
2019-04-10 20:28:45 -05:00
parent d866725724
commit e57aafe4f2
@@ -36,13 +36,12 @@ GroupBox {
id: brightnessToggle id: brightnessToggle
text: "Toggle Brightness Adjustment" text: "Toggle Brightness Adjustment"
onCheckedChanged: { onCheckedChanged: {
MoveCenterTabController.turnBindLeft = this.checked VideoTabController.setBrightnessEnabled(this.checked, false) }
}
} }
Item { //Item {
Layout.fillWidth: true // Layout.fillWidth: true
} //}
MyText { MyText {
text: "Brightness:" text: "Brightness:"
@@ -55,18 +54,19 @@ GroupBox {
from: 0.00 from: 0.00
to: 1.0 to: 1.0
stepSize: 0.01 stepSize: 0.01
value: 1.0. value: 1.0
var val = (this.position * 100)/2 + 50 onPositionChanged: {
chaperoneVisibilityText.text = Math.round(val) + "%" var val = (this.position * 100)/2
brightnessValueText.text = Math.round(val) + "%"
} }
onValueChanged: { onValueChanged: {
//TODO change value //TODO change value
ChaperoneTabController.setBoundsVisibility(value.toFixed(2), false) VideoTabController.setBrightnessValue(value.toFixed(2), false)
} }
} }
MyTextField { MyTextField {
id: chaperoneVisibilityText id: brightnessValueText
text: "100.00" text: "100.00"
keyBoardUID: 301 keyBoardUID: 301
Layout.preferredWidth: 100 Layout.preferredWidth: 100
@@ -75,41 +75,37 @@ GroupBox {
function onInputEvent(input) { function onInputEvent(input) {
var val = parseFloat(input) var val = parseFloat(input)
if (!isNaN(val)) { if (!isNaN(val)) {
if (val < 50.0) { if (val < 0.0) {
val = 50.0 val = 0
} else if (val > 100.0) { } else if (val > 100.0) {
val = 100.0 val = 100.0
} }
var v = (val/100).toFixed(2) var v = (val/100).toFixed(2)
if (v <= chaperoneVisibilitySlider.to) { if (v <= brightnessSlider.to) {
chaperoneVisibilitySlider.value = v brightnessSlider.value = v
} else { } else {
ChaperoneTabController.setBoundsVisibility(v, false) VideoTabController.setBrightnessValue(v, false)
} }
} }
text = Math.round(ChaperoneTabController.boundsVisibility * 100) + "%" text = Math.round(VideoTabController.boundsVisibility * 100) + "%"
} }
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
turnBindLeft.checked = MoveCenterTabController.turnBindLeft brightnessSlider.value = VideoTabController.brightnessValue
turnBindRight.checked = MoveCenterTabController.turnBindRight brightnessToggle.checked = VideoTabController.brightnessEnabled
turnComfortSlider.value = MoveCenterTabController.turnComfortFactor
} }
Connections { Connections {
target: MoveCenterTabController target: VideoTabController
onTurnBindLeftChanged: { onBrightnessValueChanged: {
turnBindLeft.checked = MoveCenterTabController.turnBindLeft brightnessSlider.value = VideoTabController.brightnessValue
} }
onTurnBindRightChanged: { onBrightnessEnabledChanged: {
turnBindRight.checked = MoveCenterTabController.turnBindRight brightnessToggle.checked = VideoTabController.brightnessEnabled
}
onTurnComfortFactorChanged: {
turnComfortSlider.value = MoveCenterTabController.turnComfortFactor
} }
} }
} }