Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them has been replaced with a symlink. Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still be present.
151 lines
4.1 KiB
QML
151 lines
4.1 KiB
QML
//
|
|
// FOCUS.qml
|
|
//
|
|
// Sam Cake Lab
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
import Hifi 1.0 as Hifi
|
|
import QtQuick 2.7
|
|
import QtQuick.Controls 1.4
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import "qrc:///qml/styles-uit"
|
|
import "qrc:///qml/controls-uit" as HifiControls
|
|
//import "./RichSlider.qml"
|
|
|
|
Item {
|
|
HifiConstants { id: hifi;}
|
|
id: root;
|
|
anchors.fill:parent
|
|
|
|
//color: hifi.colors.baseGray;
|
|
function fromScript(message) {
|
|
|
|
|
|
switch (message.method) {
|
|
case "initFov":
|
|
print("assigned value! " + message.params.v)
|
|
initFov(message.params.v)
|
|
break;
|
|
case "initExposure":
|
|
print("assigned value! " + message.params.v)
|
|
initExposure(message.params.v)
|
|
break;
|
|
}
|
|
}
|
|
|
|
function initFov(val) {
|
|
fovSliderControl.value = val;
|
|
}
|
|
function uiChangeFov(val) {
|
|
sendToScript({focusApp: "setFov", params: [val]})
|
|
fovSliderControl.value = val;
|
|
}
|
|
|
|
function getFocalLength() {
|
|
return 0.5 * 24 / Math.atan(Math.PI * (0.5 * fovSliderControl.value) / 180.0);
|
|
}
|
|
|
|
function initExposure(val) {
|
|
exposureSliderControl.value = val;
|
|
}
|
|
function uiChangeExposure(val) {
|
|
sendToScript({focusApp: "setExposure", params: [val]})
|
|
exposureSliderControl.value = val;
|
|
}
|
|
|
|
Column {
|
|
spacing: 5
|
|
anchors.left: root.left
|
|
anchors.right: root.right
|
|
anchors.margins: hifi.dimensions.contentMargin.x
|
|
|
|
HifiControls.Label {
|
|
text: "Focus " /* + Date.now() */
|
|
}
|
|
Separator {}
|
|
/*Hifi.ResourceImageItem {
|
|
id: spectatorCameraPreview;
|
|
visible: true;
|
|
url: "resource://spectatorCameraFrame";
|
|
ready: true;
|
|
mirrorVertically: true;
|
|
//anchors.fill: parent;
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
onVisibleChanged: {
|
|
//ready = cameraToggleCheckBox.checked;
|
|
print("inside the ResourceImageITem ...")
|
|
update();
|
|
}
|
|
}*/
|
|
Separator {}
|
|
HifiControls.Button {
|
|
text: "Shoot"
|
|
onClicked: {
|
|
sendToScript({focusApp: "takeShot"});
|
|
}
|
|
}
|
|
Separator {}
|
|
HifiControls.Label {
|
|
text: "FOV " + fovSliderControl.value.toFixed(0) + " deg"
|
|
}
|
|
HifiControls.Label {
|
|
text: "Focal length " + getFocalLength().toFixed(0) + " mm"
|
|
}
|
|
HifiControls.Slider {
|
|
id: fovSliderControl
|
|
stepSize: 0.0
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
value: 45;
|
|
minimumValue: 1;
|
|
maximumValue: 120;
|
|
|
|
onValueChanged: {
|
|
uiChangeFov(value);
|
|
}
|
|
}
|
|
|
|
Row {
|
|
HifiControls.Button {
|
|
text: "10"
|
|
onClicked: {
|
|
uiChangeFov(10);
|
|
}
|
|
}
|
|
HifiControls.Button {
|
|
text: "45"
|
|
onClicked: {
|
|
uiChangeFov(45);
|
|
}
|
|
}
|
|
HifiControls.Button {
|
|
text: "70"
|
|
onClicked: {
|
|
uiChangeFov(70);
|
|
}
|
|
}
|
|
}
|
|
Separator {}
|
|
HifiControls.Label {
|
|
text: "Exposure " + exposureSliderControl.value.toFixed(2) + " stop"
|
|
}
|
|
HifiControls.Slider {
|
|
id: exposureSliderControl
|
|
stepSize: 0.0
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
value: 0;
|
|
minimumValue: -1;
|
|
maximumValue: 1;
|
|
|
|
onValueChanged: {
|
|
uiChangeExposure(value);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|