remotecontrolplugin: change sendCommand function params to allow support for scroll

This commit is contained in:
Piyush Aggarwal 2021-07-13 21:11:34 +05:30
parent 6712953279
commit 6c4ba39653
3 changed files with 7 additions and 7 deletions

View file

@ -30,7 +30,7 @@ Kirigami.Page
Layout.fillHeight: true Layout.fillHeight: true
property var lastPos: Qt.point(-1, -1) property var lastPos: Qt.point(-1, -1)
onClicked: mousepad.pluginInterface.sendCommand("singleclick", true); onClicked: mousepad.pluginInterface.sendCommand({"singleclick": true});
onPositionChanged: { onPositionChanged: {
if (lastPos.x > -1) { if (lastPos.x > -1) {
@ -58,17 +58,17 @@ Kirigami.Page
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
icon.name: "input-mouse-click-left" icon.name: "input-mouse-click-left"
onClicked: mousepad.pluginInterface.sendCommand("singleclick", true); onClicked: mousepad.pluginInterface.sendCommand({"singleclick": true});
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
icon.name: "input-mouse-click-middle" icon.name: "input-mouse-click-middle"
onClicked: mousepad.pluginInterface.sendCommand("middleclick", true); onClicked: mousepad.pluginInterface.sendCommand({"middleclick": true});
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
icon.name: "input-mouse-click-right" icon.name: "input-mouse-click-right"
onClicked: mousepad.pluginInterface.sendCommand("rightclick", true); onClicked: mousepad.pluginInterface.sendCommand({"rightclick": true});
} }
} }
} }

View file

@ -35,9 +35,9 @@ void RemoteControlPlugin::moveCursor(const QPoint &p)
sendPacket(np); sendPacket(np);
} }
void RemoteControlPlugin::sendCommand(const QString &name, bool val) void RemoteControlPlugin::sendCommand(const QJsonObject& body)
{ {
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {{name, val}}); NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, body.toVariantMap());
sendPacket(np); sendPacket(np);
} }

View file

@ -28,7 +28,7 @@ public:
QString dbusPath() const override; QString dbusPath() const override;
Q_SCRIPTABLE void moveCursor(const QPoint &p); Q_SCRIPTABLE void moveCursor(const QPoint &p);
Q_SCRIPTABLE void sendCommand(const QString &name, bool val); Q_SCRIPTABLE void sendCommand(const QJsonObject& body);
}; };
#endif #endif