finished calibration-ui updates

This commit is contained in:
Dante Ruiz 2017-07-06 17:32:40 +01:00
parent 6c15dffb9d
commit 258c21838e
3 changed files with 111 additions and 40 deletions

View file

@ -18,15 +18,47 @@ Item {
anchors.fill: parent anchors.fill: parent
property alias source: image.source property alias source: image.source
property alias imageWidth: image.width property alias imageWidth: image.width
proeprty alias imageHeight: image.height property alias imageHeight: image.height
Rectangle { Rectangle {
acnhors.fill: parent anchors.fill: parent
color: "black" color: "black"
opacity: 0.5 opacity: 0.3
} }
Image { Image {
id: image id: image
anchors.centerIn: parent
HiFiGlyphs {
id: closeGlyphButton
text: hifi.glyphs.close
size: 25
anchors {
top: parent.top
topMargin: 15
right: parent.right
rightMargin: 15
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.text = hifi.glyphs.closeInverted;
}
onExited: {
parent.text = hifi.glyphs.close;
}
onClicked: {
imageBox.visible = false;
}
}
}
} }
} }

View file

@ -16,6 +16,7 @@ import "../../controls-uit" as HifiControls
StackView { StackView {
id: stack id: stack
initialItem: inputConfiguration initialItem: inputConfiguration
property alias messageVisible: imageMessageBox.visible
Rectangle { Rectangle {
id: inputConfiguration id: inputConfiguration
anchors.fill: parent anchors.fill: parent
@ -26,6 +27,15 @@ StackView {
property var pluginSettings: null property var pluginSettings: null
HifiControls.ImageMessageBox {
id: imageMessageBox
anchors.fill: parent
z: 2000
imageWidth: 442
imageHeight: 670
source: "../../../images/calibration-help.png"
}
Rectangle { Rectangle {
width: inputConfiguration.width width: inputConfiguration.width
height: 1 height: 1
@ -167,7 +177,7 @@ StackView {
loader.item.pluginName = box.currentText; loader.item.pluginName = box.currentText;
} }
} }
if (loader.item.hasOwnProperty("displayInformation")) { if (loader.item.hasOwnProperty("displayInformation")) {
loader.item.displayConfiguration(); loader.item.displayConfiguration();
} }
@ -183,20 +193,20 @@ StackView {
return InputConfiguration.activeInputPlugins(); return InputConfiguration.activeInputPlugins();
} }
} }
function initialize() { function initialize() {
changeSource(); changeSource();
} }
function changeSource() { function changeSource() {
loader.source = ""; loader.source = "";
var source = ""; var source = "";
if (box.currentText == "Vive") { if (box.currentText == "Vive") {
source = InputConfiguration.configurationLayout("OpenVR"); source = InputConfiguration.configurationLayout("OpenVR");
} else { } else {
source = InputConfiguration.configurationLayout(box.currentText); source = InputConfiguration.configurationLayout(box.currentText);
} }
loader.source = source; loader.source = source;
if (source === "") { if (source === "") {
box.label = "(not configurable)"; box.label = "(not configurable)";
@ -204,14 +214,14 @@ StackView {
box.label = ""; box.label = "";
} }
} }
Timer { Timer {
id: timer id: timer
repeat: false repeat: false
interval: 300 interval: 300
onTriggered: initialize() onTriggered: initialize()
} }
Component.onCompleted: { Component.onCompleted: {
timer.start(); timer.start();
} }

View file

@ -50,9 +50,12 @@ Rectangle {
readonly property int apply: 1 readonly property int apply: 1
readonly property int applyAndCalibrate: 2 readonly property int applyAndCalibrate: 2
readonly property int calibrate: 3 readonly property int calibrate: 3
} }
MouseArea { MouseArea {
id: mouseArea id: mouseArea
@ -64,6 +67,7 @@ Rectangle {
mouse.accepted = false; mouse.accepted = false;
} }
} }
color: hifi.colors.baseGray color: hifi.colors.baseGray
RalewayBold { RalewayBold {
@ -162,14 +166,14 @@ Rectangle {
stepSize: 0.0254 stepSize: 0.0254
decimals: 4 decimals: 4
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
onEditingFinished: { onEditingFinished: {
sendConfigurationSettings(); sendConfigurationSettings();
} }
} }
} }
RalewayBold { RalewayBold {
id: hands id: hands
@ -245,7 +249,7 @@ Rectangle {
anchors.left: openVrConfiguration.left anchors.left: openVrConfiguration.left
anchors.leftMargin: leftMargin + 10 anchors.leftMargin: leftMargin + 10
spacing: 10 spacing: 10
HifiControls.SpinBox { HifiControls.SpinBox {
id: handYOffset id: handYOffset
decimals: 4 decimals: 4
@ -269,7 +273,7 @@ Rectangle {
stepSize: 0.0254 stepSize: 0.0254
decimals: 4 decimals: 4
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
onEditingFinished: { onEditingFinished: {
sendConfigurationSettings(); sendConfigurationSettings();
} }
@ -302,12 +306,37 @@ Rectangle {
verticalCenter: additional.verticalCenter verticalCenter: additional.verticalCenter
} }
Rectangle {
id: selected
color: hifi.colors.blueHighlight
width: info.width
height: 1
anchors {
top: info.bottom
topMargin: 1
left: info.left
right: info.right
}
visible: false
}
MouseArea { MouseArea {
anchors.fill: parent; anchors.fill: parent;
hoverEnabled: true
onEntered: info.color = hifi.colors.blueAccent onEntered: {
onExited: info.color = hifi.colors.blueHighlight selected.visible = true;
onClicked: console.log("text clicked"); }
onExited: {
selected.visible = false;
}
onClicked: {
stack.messageVisible = true;
}
} }
} }
@ -486,7 +515,7 @@ Rectangle {
anchors.leftMargin: leftMargin anchors.leftMargin: leftMargin
radius: hifi.buttons.radius radius: hifi.buttons.radius
gradient: Gradient { gradient: Gradient {
GradientStop { GradientStop {
position: 0.2 position: 0.2
@ -502,7 +531,7 @@ Rectangle {
} }
} }
} }
GradientStop { GradientStop {
position: 1.0 position: 1.0
color: { color: {
@ -518,10 +547,10 @@ Rectangle {
} }
} }
} }
HiFiGlyphs { HiFiGlyphs {
id: glyphButton id: glyphButton
color: enabled ? hifi.buttons.textColor[calibrationButton.color] color: enabled ? hifi.buttons.textColor[calibrationButton.color]
@ -535,7 +564,7 @@ Rectangle {
bottomMargin: 1 bottomMargin: 1
} }
} }
RalewayBold { RalewayBold {
id: calibrationText id: calibrationText
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
@ -550,7 +579,7 @@ Rectangle {
topMargin: 7 topMargin: 7
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -572,19 +601,19 @@ Rectangle {
} }
} }
} }
onPressed: { onPressed: {
calibrationButton.pressed = true; calibrationButton.pressed = true;
} }
onReleased: { onReleased: {
calibrationButton.pressed = false; calibrationButton.pressed = false;
} }
onEntered: { onEntered: {
calibrationButton.hovered = true; calibrationButton.hovered = true;
} }
onExited: { onExited: {
calibrationButton.hovered = false; calibrationButton.hovered = false;
} }
@ -690,14 +719,14 @@ Rectangle {
calibratingScreen = screen.createObject(); calibratingScreen = screen.createObject();
stack.push(calibratingScreen); stack.push(calibratingScreen);
} }
if (status["calibrated"]) { if (status["calibrated"]) {
calibrationScreen.success(); calibrationScreen.success();
if (status["UI"]) { if (status["UI"]) {
logAction("mocap_ui_success", status); logAction("mocap_ui_success", status);
} }
} else if (!status["calibrated"]) { } else if (!status["calibrated"]) {
calibrationScreen.failure(); calibrationScreen.failure();
@ -809,11 +838,11 @@ Rectangle {
var handOverride = handSetting["override"]; var handOverride = handSetting["override"];
var settingsChanged = false; var settingsChanged = false;
if (lastConfiguration["bodyConfiguration"] !== bodySetting) { if (lastConfiguration["bodyConfiguration"] !== bodySetting) {
settingsChanged = true; settingsChanged = true;
} }
var lastHead = lastConfiguration["headConfiguration"]; var lastHead = lastConfiguration["headConfiguration"];
if (lastHead["override"] !== headOverride) { if (lastHead["override"] !== headOverride) {
settingsChanged = true; settingsChanged = true;
@ -823,13 +852,13 @@ Rectangle {
if (lastHand["override"] !== handOverride) { if (lastHand["override"] !== handOverride) {
settingsChanged = true; settingsChanged = true;
} }
if (settingsChanged) { if (settingsChanged) {
if ((!handOverride) && (!headOverride) && (bodySetting === "None")) { if ((!handOverride) && (!headOverride) && (bodySetting === "None")) {
state = buttonState.apply; state = buttonState.apply;
} else { } else {
state = buttonState.applyAndCalibrate; state = buttonState.applyAndCalibrate;
} }
} else { } else {
if (state == buttonState.apply) { if (state == buttonState.apply) {
state = buttonState.disabled; state = buttonState.disabled;
@ -837,7 +866,7 @@ Rectangle {
state = buttonState.calibrate; state = buttonState.calibrate;
} }
} }
lastConfiguration = settings; lastConfiguration = settings;
} }
@ -854,7 +883,7 @@ Rectangle {
state = buttonState.disabled; state = buttonState.disabled;
} else { } else {
state = buttonState.calibrate; state = buttonState.calibrate;
} }
} }
function updateCalibrationButton() { function updateCalibrationButton() {
@ -920,11 +949,11 @@ Rectangle {
"Y": handYOffset.value, "Y": handYOffset.value,
"Z": handZOffset.value "Z": handZOffset.value
} }
var settingsObject = { var settingsObject = {
"bodyConfiguration": trackerConfiguration, "bodyConfiguration": trackerConfiguration,
"headConfiguration": headObject, "headConfiguration": headObject,
"handConfiguration": handObject "handConfiguration": handObject
} }
return settingsObject; return settingsObject;