diff options
Diffstat (limited to 'Main.qml')
| -rw-r--r-- | Main.qml | 127 |
1 files changed, 97 insertions, 30 deletions
@@ -6,6 +6,8 @@ import QmlCustomPlot 1.0 import "request.js" as XHR +import eurydice + ApplicationWindow { id: mainWindowRoot @@ -13,7 +15,8 @@ ApplicationWindow { height: 480 visible: true // visibility: Window.Maximized - visibility: ApplicationWindow.Maximized + // visibility: ApplicationWindow.Maximized + visibility: ApplicationWindow.FullScreen title: qsTr("Hello World") @@ -122,6 +125,23 @@ ApplicationWindow { }, JSON.stringify(json)); } + function resetEncoder() { + var url = apiRoot + "/commands/resetEncoder"; + console.log("resetEncoder:", url); + + XHR.sendRequest("POST", url, function(response) { + + if (response.status != "200") { + console.log("response status: ", response.status); + return; + } + + // console.log("resetEncoder result:", response.content); + + // var json = JSON.parse(response.content); + }); + } + RowLayout { id: horizontalLayout @@ -219,6 +239,28 @@ ApplicationWindow { } Label { + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop + + text: "Pos: " + (parseFloat(encoderPosition) / 200.).toFixed(3) + } + + Label { + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop + + text: "Measurement: " + measurementCounter + } + + Label { + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop + + text: "Timestamp (ms): " + + (parseFloat(timestampUs % (1000 * 1000 * 1000)) / 1000.).toFixed(1) + } + + Label { text: qsTr("Exposure time (us):") } @@ -232,7 +274,7 @@ ApplicationWindow { stepSize: 100 editable: true - value: 200 + value: 1000 onValueChanged: writeParams() } @@ -258,50 +300,75 @@ ApplicationWindow { onCheckedChanged: writeParams() } + Button { + text: qsTr("Reset encoder") + onClicked: resetEncoder() + } + Item { Layout.fillHeight: true } } } - ImageViewer { - id: image + ColumnLayout { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: 200 - } + TabBar { + id: tabBar - Item { + Layout.fillWidth: true - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: 900 - Layout.minimumHeight: 600 + currentIndex: 0 + + Shortcut { + sequence: "alt+1" + onActivated: tabBar.currentIndex = 0 + } + + Shortcut { + sequence: "alt+2" + onActivated: tabBar.currentIndex = 1 + } - Rectangle { - color: "red" - opacity: 0.1 - z: 101 + TabButton { + text: qsTr("Image") + } + + TabButton { + text: qsTr("Pixels") + } } - QmlCustomPlot { - id: qmlPlot + SwipeView { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: mainWindowRoot.width * 0.8 - anchors.fill: parent + currentIndex: tabBar.currentIndex + clip: true + interactive: false - Label { - anchors { - top: parent.top - topMargin: 8 * 2 - horizontalCenter: parent.horizontalCenter - } - text: qmlPlot.fps - color: Material.color(Material.accent) + ImageViewer { + id: image } - plot: myPlot - // Component.onCompleted: initCustomPlot() + QmlCustomPlot { + id: qmlPlot + + Label { + anchors { + top: parent.top + topMargin: 8 * 2 + horizontalCenter: parent.horizontalCenter + } + text: qmlPlot.fps + color: Material.accent + } + + plot: myPlot + // Component.onCompleted: setRange(Qt.rect(-640, 0, 1280, 800)) + // Component.onCompleted: initCustomPlot() + } } } } |
