90 lines
2.7 KiB
QML
90 lines
2.7 KiB
QML
import QtQuick 2.9
|
|
import QtMultimedia 5.8
|
|
import QtQuick.Window 2.2
|
|
import QtQuick.Controls 2.2
|
|
|
|
Dialog {
|
|
|
|
x: startButt.x
|
|
y: startButt.y
|
|
width: startButt.width
|
|
height: startButt.height
|
|
modal: false
|
|
enabled: false
|
|
|
|
enter: Transition {
|
|
NumberAnimation { properties: "scale"; from: 0; to: 1; duration: 500; easing.type: Easing.InCubic }
|
|
}
|
|
|
|
exit: Transition {
|
|
NumberAnimation { properties: "scale"; from: 1; to: 0; duration: 500; easing.type: Easing.OutCubic }
|
|
}
|
|
|
|
|
|
background: Rectangle {
|
|
radius: width * 0.5
|
|
color: "white"
|
|
border.color: "grey"
|
|
border.width: 1
|
|
Label {
|
|
text: "Options"
|
|
font.pixelSize: headlineUnderline.width * 0.1
|
|
anchors {
|
|
horizontalCenter: parent.horizontalCenter
|
|
top: parent.top
|
|
topMargin: headlineUnderline.anchors.topMargin / 2 - height / 2
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
id: headlineUnderline
|
|
height: 1
|
|
width: parent.width
|
|
color: "grey"
|
|
anchors {
|
|
top: parent.top
|
|
left: parent.left
|
|
right: parent.right
|
|
topMargin: parent.height * 0.15
|
|
rightMargin: parent.radius - Math.sqrt(Math.pow(parent.radius,2)-Math.pow(parent.radius-anchors.topMargin,2))
|
|
leftMargin: parent.radius - Math.sqrt(Math.pow(parent.radius,2)-Math.pow(parent.radius-anchors.topMargin,2))
|
|
}
|
|
}
|
|
}
|
|
Column {
|
|
anchors.fill: parent
|
|
|
|
ItemDelegate {
|
|
id: connect_del
|
|
anchors.fill: parent
|
|
text: "connect"
|
|
onClicked: {
|
|
var i;
|
|
if(i === 100){
|
|
i = 0
|
|
running = false
|
|
}
|
|
|
|
var theUrl = "http://192.168.4.1";
|
|
var xmlHttp = null;
|
|
|
|
xmlHttp = new XMLHttpRequest();
|
|
xmlHttp.open( "GET", theUrl, false );
|
|
xmlHttp.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
|
|
xmlHttp.send( null );
|
|
var response = xmlHttp.responseText
|
|
var response_status = xmlHttp.status
|
|
connect_del.text = response
|
|
var res = response.split("<br>");
|
|
var time_now = new Date().getTime()
|
|
console.log(time_now)
|
|
console.log(res[1])
|
|
console.log(time_now-res[0])
|
|
root.buzzer_offset = time_now-res[0]
|
|
root.last_button_pressed = res[1]
|
|
console.log("buzzer_offset: "+root.buzzer_offset)
|
|
connect_del.text = response
|
|
}
|
|
}
|
|
}
|
|
}
|