|
@@ -1,16 +1,19 @@
|
|
|
import QtQuick 2.5
|
|
import QtQuick 2.5
|
|
|
import QtQuick.Controls 1.4
|
|
import QtQuick.Controls 1.4
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
|
+import QtQuick.Dialogs 1.1
|
|
|
|
|
+import QtQuick.Window 2.2
|
|
|
|
|
|
|
|
-import "./simplify.js" as Simplify
|
|
|
|
|
import "components" as Comps
|
|
import "components" as Comps
|
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
ApplicationWindow {
|
|
|
id: aw
|
|
id: aw
|
|
|
visible: true
|
|
visible: true
|
|
|
- width: 960
|
|
|
|
|
- height: 540
|
|
|
|
|
|
|
+ width: 600
|
|
|
|
|
+ height: 960
|
|
|
|
|
+ visibility: Screen.height > Screen.width ? "FullScreen" : "Windowed"
|
|
|
|
|
+
|
|
|
color: "#fffffe"
|
|
color: "#fffffe"
|
|
|
|
|
|
|
|
Comps.WebSocket {
|
|
Comps.WebSocket {
|
|
@@ -19,17 +22,19 @@ ApplicationWindow {
|
|
|
property alias t_slides: socket.tot_slides
|
|
property alias t_slides: socket.tot_slides
|
|
|
Item {
|
|
Item {
|
|
|
id: item1
|
|
id: item1
|
|
|
- width: parent.width
|
|
|
|
|
- height: parent.height
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
+ transformOrigin: Item.Center
|
|
|
|
|
+ rotation: Screen.height > Screen.width ? 90 : 0
|
|
|
property alias mouseArea1: mouseArea1
|
|
property alias mouseArea1: mouseArea1
|
|
|
property alias button3: button3
|
|
property alias button3: button3
|
|
|
property int curImage: 1
|
|
property int curImage: 1
|
|
|
property variant pregs: []
|
|
property variant pregs: []
|
|
|
|
|
|
|
|
property string curPDF: "EBA"
|
|
property string curPDF: "EBA"
|
|
|
- anchors.fill: parent
|
|
|
|
|
|
|
+ width: parent.height
|
|
|
|
|
+ height: parent.width
|
|
|
|
|
+ anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
onCurPDFChanged: {
|
|
onCurPDFChanged: {
|
|
|
canvas.change_image(curPDF, curImage)
|
|
canvas.change_image(curPDF, curImage)
|
|
|
diapoStatus.text = qsTr("%1/%2 (%3 preg)").arg(curImage).arg(
|
|
diapoStatus.text = qsTr("%1/%2 (%3 preg)").arg(curImage).arg(
|
|
@@ -57,18 +62,18 @@ ApplicationWindow {
|
|
|
id: grid1
|
|
id: grid1
|
|
|
width: parent.width
|
|
width: parent.width
|
|
|
height: parent.height
|
|
height: parent.height
|
|
|
- anchors.right: parent.right
|
|
|
|
|
- anchors.bottom: parent.bottom
|
|
|
|
|
- anchors.top: parent.top
|
|
|
|
|
- anchors.left: parent.left
|
|
|
|
|
|
|
+
|
|
|
columns: 4
|
|
columns: 4
|
|
|
spacing: 4
|
|
spacing: 4
|
|
|
|
|
|
|
|
Rectangle {
|
|
Rectangle {
|
|
|
id: canvasCol
|
|
id: canvasCol
|
|
|
- height: parent.height
|
|
|
|
|
- width: height * 4 / 3
|
|
|
|
|
- color: aw.color
|
|
|
|
|
|
|
+ height: grid1.height
|
|
|
|
|
+ width: Screen.height > Screen.width ? grid1.width *3/4 : grid1.width/2
|
|
|
|
|
+ color: "#333"
|
|
|
|
|
+ smooth: false
|
|
|
|
|
+ //aw.color
|
|
|
|
|
+
|
|
|
|
|
|
|
|
Canvas {
|
|
Canvas {
|
|
|
id: canvas
|
|
id: canvas
|
|
@@ -89,20 +94,20 @@ ApplicationWindow {
|
|
|
width: parent.width
|
|
width: parent.width
|
|
|
height: parent.height
|
|
height: parent.height
|
|
|
|
|
|
|
|
- onPaint: full_repaint()
|
|
|
|
|
- //paint_canvas()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ onPaint: full_repaint(region)
|
|
|
onImageLoaded: {
|
|
onImageLoaded: {
|
|
|
clean_path()
|
|
clean_path()
|
|
|
if (ctx === null)
|
|
if (ctx === null)
|
|
|
ctx = canvas.getContext("2d");
|
|
ctx = canvas.getContext("2d");
|
|
|
ctx.lineCap = 'square'
|
|
ctx.lineCap = 'square'
|
|
|
ctx.lineWidth = 4
|
|
ctx.lineWidth = 4
|
|
|
- full_repaint()
|
|
|
|
|
|
|
+ requestPaint()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function clean_path() {
|
|
function clean_path() {
|
|
|
points_array.length=0
|
|
points_array.length=0
|
|
|
- full_repaint()
|
|
|
|
|
|
|
+ requestPaint()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function start_path() {
|
|
function start_path() {
|
|
@@ -135,15 +140,19 @@ ApplicationWindow {
|
|
|
lastpoint = pts[pts.length-1];
|
|
lastpoint = pts[pts.length-1];
|
|
|
|
|
|
|
|
pts.push(p)
|
|
pts.push(p)
|
|
|
- socket.send_point(p);
|
|
|
|
|
- if (lastpoint)
|
|
|
|
|
- markDirty(Qt.rect(Math.min(p.x,lastpoint.x),Math.min(p.y,lastpoint.y), Math.abs(p.x-lastpoint.x)+4, Math.abs(p.y-lastpoint.y)+1))
|
|
|
|
|
|
|
+ /*socket.send_point(p);*/
|
|
|
|
|
+ if (lastpoint) {
|
|
|
|
|
+ markDirty(Qt.rect(Math.min(p.x,lastpoint.x),Math.min(p.y,lastpoint.y), Math.abs(p.x-lastpoint.x)+4, Math.abs(p.y-lastpoint.y)+4));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
function stroke(points, color) {
|
|
function stroke(points, color) {
|
|
|
if (points.length===0)
|
|
if (points.length===0)
|
|
|
return;
|
|
return;
|
|
|
|
|
+
|
|
|
if (ctx.strokeStyle !== color){
|
|
if (ctx.strokeStyle !== color){
|
|
|
ctx.strokeStyle = color;
|
|
ctx.strokeStyle = color;
|
|
|
}
|
|
}
|
|
@@ -157,31 +166,31 @@ ApplicationWindow {
|
|
|
ctx.stroke()
|
|
ctx.stroke()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function full_repaint(){
|
|
|
|
|
- //console.log("Fullpaint")
|
|
|
|
|
|
|
+ function full_repaint(region){
|
|
|
if (ctx === null )
|
|
if (ctx === null )
|
|
|
ctx = canvas.getContext("2d");
|
|
ctx = canvas.getContext("2d");
|
|
|
- if (canvas.isImageLoaded(curImageUrl)) {
|
|
|
|
|
- ctx.drawImage(curImageUrl, 0, 0, canvas.width,
|
|
|
|
|
- canvas.height)
|
|
|
|
|
- }
|
|
|
|
|
- var j = 0
|
|
|
|
|
- for (j = 0; j < points_array.length; j++) {
|
|
|
|
|
- if (points_array[j].points.length <= 1)
|
|
|
|
|
- continue
|
|
|
|
|
- stroke(points_array[j].points,points_array[j].color);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if ( region === undefined || region.width > 150 || region.height > 150 ) {
|
|
|
|
|
+ console.log("Full", region.width, region.height);
|
|
|
|
|
+ if (canvas.isImageLoaded(curImageUrl)) {
|
|
|
|
|
+ ctx.drawImage(curImageUrl, 0, 0, canvas.width,
|
|
|
|
|
+ canvas.height)
|
|
|
|
|
+ }
|
|
|
|
|
+ var j = 0
|
|
|
|
|
+ for (j = 0; j < points_array.length; j++) {
|
|
|
|
|
+ if (points_array[j].points.length <= 1)
|
|
|
|
|
+ continue
|
|
|
|
|
+ stroke(points_array[j].points,points_array[j].color);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ var lastLine = points_array[points_array.length-1];
|
|
|
|
|
+ if (lastLine === undefined)
|
|
|
|
|
+ return;
|
|
|
|
|
+ stroke(lastLine.points, lastLine.color);
|
|
|
}
|
|
}
|
|
|
- requestPaint()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function paint_canvas() {
|
|
|
|
|
- if (ctx === null )
|
|
|
|
|
- ctx = canvas.getContext("2d");
|
|
|
|
|
- if (points_array.length === 0)
|
|
|
|
|
- return;
|
|
|
|
|
- var ar = points_array[points_array.length -1];
|
|
|
|
|
- stroke(ar.points,ar.color);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
MouseArea {
|
|
@@ -223,20 +232,17 @@ ApplicationWindow {
|
|
|
spacing: 10
|
|
spacing: 10
|
|
|
width: parent.width - canvasCol.width - parent.spacing * 2
|
|
width: parent.width - canvasCol.width - parent.spacing * 2
|
|
|
height: parent.height
|
|
height: parent.height
|
|
|
-
|
|
|
|
|
Column {
|
|
Column {
|
|
|
width: parent.width
|
|
width: parent.width
|
|
|
- height: parent.height / 2 - 60
|
|
|
|
|
-
|
|
|
|
|
|
|
+ height: parent.height / 2 - 10
|
|
|
Row {
|
|
Row {
|
|
|
id: row2
|
|
id: row2
|
|
|
width: parent.width
|
|
width: parent.width
|
|
|
- height: 70
|
|
|
|
|
-
|
|
|
|
|
|
|
+ height: 120
|
|
|
MouseArea {
|
|
MouseArea {
|
|
|
id: image1
|
|
id: image1
|
|
|
width: parent.width/2
|
|
width: parent.width/2
|
|
|
- height: 70
|
|
|
|
|
|
|
+ height: parent.height
|
|
|
Image {
|
|
Image {
|
|
|
anchors.centerIn: parent.Center
|
|
anchors.centerIn: parent.Center
|
|
|
source: "qrc:///images/back.png"
|
|
source: "qrc:///images/back.png"
|
|
@@ -250,7 +256,7 @@ ApplicationWindow {
|
|
|
MouseArea {
|
|
MouseArea {
|
|
|
id: image2
|
|
id: image2
|
|
|
width: parent.width/2
|
|
width: parent.width/2
|
|
|
- height: 70
|
|
|
|
|
|
|
+ height: parent.height
|
|
|
|
|
|
|
|
Image {
|
|
Image {
|
|
|
anchors.centerIn: parent.Center
|
|
anchors.centerIn: parent.Center
|
|
@@ -294,7 +300,8 @@ ApplicationWindow {
|
|
|
Column {
|
|
Column {
|
|
|
id: column1
|
|
id: column1
|
|
|
width: parent.width
|
|
width: parent.width
|
|
|
- height: parent.height / 2 - 60
|
|
|
|
|
|
|
+ height: parent.height / 2 - 10
|
|
|
|
|
+ spacing: 2
|
|
|
Repeater{
|
|
Repeater{
|
|
|
model: [ ["#0000ff", "#00ff00", "#ff0000"], ["#ffff00", "#00ffff", "#000000"] ]
|
|
model: [ ["#0000ff", "#00ff00", "#ff0000"], ["#ffff00", "#00ffff", "#000000"] ]
|
|
|
Row {
|
|
Row {
|
|
@@ -348,6 +355,15 @@ ApplicationWindow {
|
|
|
id: diapoStatus
|
|
id: diapoStatus
|
|
|
text: qsTr("Diapo status")
|
|
text: qsTr("Diapo status")
|
|
|
}
|
|
}
|
|
|
|
|
+ Button {
|
|
|
|
|
+ id: salir
|
|
|
|
|
+ width: 40
|
|
|
|
|
+ height: 20
|
|
|
|
|
+ text: qsTr("Salir")
|
|
|
|
|
+ onClicked: {
|
|
|
|
|
+ messageDialog.visible = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -355,4 +371,18 @@ ApplicationWindow {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ MessageDialog {
|
|
|
|
|
+ id: messageDialog
|
|
|
|
|
+ title: "Salir"
|
|
|
|
|
+ text: "Seguro que desea salir?"
|
|
|
|
|
+ standardButtons: StandardButton.Yes | StandardButton.No
|
|
|
|
|
+ icon: StandardIcon.Warning
|
|
|
|
|
+ onYes: {
|
|
|
|
|
+ Qt.quit()
|
|
|
|
|
+ }
|
|
|
|
|
+ onNo: {
|
|
|
|
|
+ visible = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|