2015-07-22 02:19:29 +01:00
|
|
|
/*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2015-07-22 02:19:29 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2015-07-22 02:19:29 +01:00
|
|
|
*/
|
|
|
|
|
2015-07-22 11:05:16 +01:00
|
|
|
import QtQuick 2.2
|
2018-06-08 00:58:50 +01:00
|
|
|
import QtQuick.Controls 2.2
|
2015-07-22 11:05:16 +01:00
|
|
|
import QtQuick.Layouts 1.1
|
2020-06-16 16:59:36 +01:00
|
|
|
import org.kde.kirigami 2.7 as Kirigami
|
2018-11-08 01:21:49 +00:00
|
|
|
import org.kde.kdeconnect 1.0
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2016-06-05 21:42:19 +01:00
|
|
|
Kirigami.Page
|
2015-07-22 02:19:29 +01:00
|
|
|
{
|
|
|
|
id: mousepad
|
2019-12-21 07:59:36 +00:00
|
|
|
title: i18nd("kdeconnect-app", "Remote Control")
|
2016-08-21 12:05:43 +01:00
|
|
|
property QtObject pluginInterface
|
2018-11-08 01:21:49 +00:00
|
|
|
property QtObject device
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2020-06-16 16:59:36 +01:00
|
|
|
// Otherwise swiping on the MouseArea might trigger changing the page
|
|
|
|
Kirigami.ColumnView.preventStealing: true
|
|
|
|
|
2016-06-05 21:42:19 +01:00
|
|
|
ColumnLayout
|
|
|
|
{
|
|
|
|
anchors.fill: parent
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2016-06-05 21:42:19 +01:00
|
|
|
MouseArea {
|
|
|
|
id: area
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
property var lastPos: Qt.point(-1, -1)
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2016-08-21 12:05:43 +01:00
|
|
|
onClicked: mousepad.pluginInterface.sendCommand("singleclick", true);
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2016-06-05 21:42:19 +01:00
|
|
|
onPositionChanged: {
|
|
|
|
if (lastPos.x > -1) {
|
|
|
|
// console.log("move", mouse.x, mouse.y, lastPos)
|
|
|
|
var delta = Qt.point(mouse.x-lastPos.x, mouse.y-lastPos.y);
|
2015-07-22 02:19:29 +01:00
|
|
|
|
2016-08-21 12:05:43 +01:00
|
|
|
pluginInterface.moveCursor(delta);
|
2016-06-05 21:42:19 +01:00
|
|
|
}
|
|
|
|
lastPos = Qt.point(mouse.x, mouse.y);
|
|
|
|
}
|
|
|
|
onReleased: {
|
|
|
|
lastPos = Qt.point(-1, -1)
|
|
|
|
}
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
2018-11-08 01:21:49 +00:00
|
|
|
|
|
|
|
RemoteKeyboard {
|
|
|
|
device: mousepad.device
|
|
|
|
Layout.fillWidth: true
|
|
|
|
visible: remoteState
|
|
|
|
}
|
|
|
|
|
2016-06-05 21:42:19 +01:00
|
|
|
RowLayout {
|
2015-07-22 02:19:29 +01:00
|
|
|
Layout.fillWidth: true
|
2016-06-05 21:42:19 +01:00
|
|
|
|
|
|
|
Button {
|
|
|
|
Layout.fillWidth: true
|
2018-11-22 00:26:17 +00:00
|
|
|
icon.name: "input-mouse-click-left"
|
2016-08-21 12:05:43 +01:00
|
|
|
onClicked: mousepad.pluginInterface.sendCommand("singleclick", true);
|
2016-06-05 21:42:19 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
Layout.fillWidth: true
|
2018-11-22 00:26:17 +00:00
|
|
|
icon.name: "input-mouse-click-middle"
|
2016-08-21 12:05:43 +01:00
|
|
|
onClicked: mousepad.pluginInterface.sendCommand("middleclick", true);
|
2016-06-05 21:42:19 +01:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
Layout.fillWidth: true
|
2018-11-22 00:26:17 +00:00
|
|
|
icon.name: "input-mouse-click-right"
|
2016-08-21 12:05:43 +01:00
|
|
|
onClicked: mousepad.pluginInterface.sendCommand("rightclick", true);
|
2016-06-05 21:42:19 +01:00
|
|
|
}
|
2015-07-22 02:19:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|