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

View file

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