|
@@ -1,5 +1,7 @@
|
|
|
import QtQuick 2.5
|
|
import QtQuick 2.5
|
|
|
import QtQuick.Controls 1.4
|
|
import QtQuick.Controls 1.4
|
|
|
|
|
+import QtWebSockets 1.0
|
|
|
|
|
+
|
|
|
import "./simplify.js" as Simplify
|
|
import "./simplify.js" as Simplify
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
ApplicationWindow {
|
|
@@ -9,9 +11,30 @@ ApplicationWindow {
|
|
|
title: qsTr("Hello World")
|
|
title: qsTr("Hello World")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ WebSocket {
|
|
|
|
|
+ id: socket
|
|
|
|
|
+ url: "wss://ws.especificosba.com.ar"
|
|
|
|
|
+ onTextMessageReceived: {
|
|
|
|
|
+ console.log("\nReceived message: " + message);
|
|
|
|
|
+ }
|
|
|
|
|
+ onStatusChanged: if (socket.status == WebSocket.Error) {
|
|
|
|
|
+ console.log("Error: " + socket.errorString)
|
|
|
|
|
+ } else if (socket.status == WebSocket.Open) {
|
|
|
|
|
+ socket.sendTextMessage("Hello World")
|
|
|
|
|
+ } else if (socket.status == WebSocket.Closed) {
|
|
|
|
|
+ console.log("\nSocket closed");
|
|
|
|
|
+ }
|
|
|
|
|
+ active: false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
MainForm {
|
|
MainForm {
|
|
|
- property int curImage:1;
|
|
|
|
|
|
|
+ property int curImage:1
|
|
|
anchors.fill: parent
|
|
anchors.fill: parent
|
|
|
|
|
+ button1.enabled: socket.active
|
|
|
|
|
+ button2.enabled: socket.active
|
|
|
|
|
+ button3.enabled: socket.active
|
|
|
|
|
+ button4.enabled: socket.active
|
|
|
|
|
+
|
|
|
button1.onClicked: {
|
|
button1.onClicked: {
|
|
|
curImage=Math.min(curImage+1,5);
|
|
curImage=Math.min(curImage+1,5);
|
|
|
}
|
|
}
|
|
@@ -27,20 +50,25 @@ ApplicationWindow {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mouseArea1.onPressed: {
|
|
mouseArea1.onPressed: {
|
|
|
|
|
+ if (!socket.active)
|
|
|
|
|
+ return;
|
|
|
canvas.start_path();
|
|
canvas.start_path();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mouseArea1.onPositionChanged: {
|
|
mouseArea1.onPositionChanged: {
|
|
|
|
|
+ if (!socket.active)
|
|
|
|
|
+ return;
|
|
|
canvas.add_point({x:mouse.x,y:mouse.y});
|
|
canvas.add_point({x:mouse.x,y:mouse.y});
|
|
|
- //canvas.paint_canvas();
|
|
|
|
|
}
|
|
}
|
|
|
mouseArea1.onReleased: {
|
|
mouseArea1.onReleased: {
|
|
|
|
|
+ if (!socket.active)
|
|
|
|
|
+ return;
|
|
|
canvas.finish_path();
|
|
canvas.finish_path();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Canvas {
|
|
Canvas {
|
|
|
id: canvas
|
|
id: canvas
|
|
|
- width: 320
|
|
|
|
|
|
|
+ width: parent.width
|
|
|
height: 250
|
|
height: 250
|
|
|
antialiasing: true
|
|
antialiasing: true
|
|
|
|
|
|
|
@@ -103,6 +131,7 @@ ApplicationWindow {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|