[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:48 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=058f7c7

The following commit has been merged in the master branch:
commit 058f7c7c90ba727748202e52cce67ab67464ea33
Author: Aleix Pol <aleixpol at kde.org>
Date:   Wed Jul 22 03:19:29 2015 +0200

    Implement the touchpad forwarding into kcapp
    
    This way the computer's cursor can be controlled from the device. Keyboard
    is not yet implemented.
---
 app/qml/main.qml                                   |  7 +++
 app/qml/{mpris.qml => mousepad.qml}                | 54 +++++++++----------
 app/resources.qrc                                  |  1 +
 interfaces/CMakeLists.txt                          |  2 +-
 interfaces/dbusinterfaces.cpp                      |  9 ++++
 interfaces/dbusinterfaces.h                        | 10 ++++
 .../kdeconnectdeclarativeplugin.cpp                |  8 +++
 plugins/CMakeLists.txt                             |  1 +
 plugins/remotecontrol/CMakeLists.txt               |  7 +++
 .../remotecontrol/kdeconnect_remotecontrol.json    | 26 ++++++++++
 .../remotecontrolplugin.cpp}                       | 60 ++++++++++++----------
 .../remotecontrolplugin.h}                         | 23 ++++-----
 12 files changed, 137 insertions(+), 71 deletions(-)

diff --git a/app/qml/main.qml b/app/qml/main.qml
index 9b4cf82..c2db431 100644
--- a/app/qml/main.qml
+++ b/app/qml/main.qml
@@ -123,6 +123,13 @@ ApplicationWindow
                             } );
                         }
                         Button {
+                            text: i18n("Mouse Pad")
+                            onClicked: stack.push( {
+                                item: "qrc:/qml/mousepad.qml",
+                                properties: { remoteControlInterface: RemoteControlDbusInterfaceFactory.create(deviceView.currentDevice.id()) }
+                            } );
+                        }
+                        Button {
                             text: i18n("Remote touch and keyboard")
                             enabled: false
                         }
diff --git a/app/qml/mpris.qml b/app/qml/mousepad.qml
similarity index 54%
copy from app/qml/mpris.qml
copy to app/qml/mousepad.qml
index 45ffa67..b8e4418 100644
--- a/app/qml/mpris.qml
+++ b/app/qml/mousepad.qml
@@ -18,55 +18,47 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-import QtQuick 2.2
+import QtQuick 2.5
 import QtQuick.Controls 1.2
 import QtQuick.Layouts 1.2
 
 ColumnLayout
 {
-    id: root
-    property QtObject mprisInterface
+    id: mousepad
+    property QtObject remoteControlInterface
 
-    Component.onCompleted: {
-        mprisInterface.requestPlayerList();
-    }
-
-    Item { Layout.fillHeight: true }
-    ComboBox {
-        Layout.fillWidth: true
-        model: root.mprisInterface.playerList
-        onCurrentTextChanged: root.mprisInterface.player = currentText
-    }
-    Label {
+    MouseArea {
+        id: area
         Layout.fillWidth: true
-        text: root.mprisInterface.nowPlaying
+        Layout.fillHeight: true
+        property var lastPos: Qt.point(-1, -1)
+
+        onClicked: mousepad.remoteControlInterface.sendCommand("singleclick", true);
+
+        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);
+
+                remoteControlInterface.moveCursor(delta);
+            }
+            lastPos = Qt.point(mouse.x, mouse.y);
+        }
     }
     RowLayout {
         Layout.fillWidth: true
+
         Button {
             Layout.fillWidth: true
-            iconName: "media-skip-backward"
-            onClicked: root.mprisInterface.sendAction("Previous")
+            onClicked: mousepad.remoteControlInterface.sendCommand("singleclick", true);
         }
         Button {
             Layout.fillWidth: true
-            iconName: root.mprisInterface.isPlaying ? "media-playback-pause" : "media-playback-start"
-            onClicked: root.mprisInterface.sendAction("PlayPause");
+            onClicked: mousepad.remoteControlInterface.sendCommand("middleclick", true);
         }
         Button {
             Layout.fillWidth: true
-            iconName: "media-skip-forward"
-            onClicked: root.mprisInterface.sendAction("Next")
-        }
-    }
-    RowLayout {
-        Layout.fillWidth: true
-        Label { text: i18n("Volume:") }
-        Slider {
-            value: root.mprisInterface.volume
-            maximumValue: 100
-            Layout.fillWidth: true
+            onClicked: mousepad.remoteControlInterface.sendCommand("rightclick", true);
         }
     }
-    Item { Layout.fillHeight: true }
 }
diff --git a/app/resources.qrc b/app/resources.qrc
index 3731e0a..225f851 100644
--- a/app/resources.qrc
+++ b/app/resources.qrc
@@ -3,5 +3,6 @@
     <file>qml/main.qml</file>
     <file>qml/DeviceDelegate.qml</file>
     <file>qml/mpris.qml</file>
+    <file>qml/mousepad.qml</file>
  </qresource>
 </RCC>
diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt
index 0220af8..c2e41a9 100644
--- a/interfaces/CMakeLists.txt
+++ b/interfaces/CMakeLists.txt
@@ -39,7 +39,7 @@ geninterface(${CMAKE_SOURCE_DIR}/plugins/sftp/sftpplugin.h devicesftpinterface.h
 geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notificationsdbusinterface.h devicenotificationsinterface.h)
 geninterface(${CMAKE_SOURCE_DIR}/plugins/notifications/notification.h notificationinterface.h)
 geninterface(${CMAKE_SOURCE_DIR}/plugins/mprisremote/mprisremoteplugin.h mprisremoteinterface)
-
+geninterface(${CMAKE_SOURCE_DIR}/plugins/remotecontrol/remotecontrolplugin.h remotecontrolinterface)
 
 add_library(kdeconnectinterfaces SHARED ${libkdeconnect_SRC})
 set_target_properties(kdeconnectinterfaces PROPERTIES
diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp
index 68b4c64..5f5479a 100644
--- a/interfaces/dbusinterfaces.cpp
+++ b/interfaces/dbusinterfaces.cpp
@@ -113,3 +113,12 @@ MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
 MprisDbusInterface::~MprisDbusInterface()
 {
 }
+
+RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent)
+    : OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/remotecontrol", QDBusConnection::sessionBus(), parent)
+{
+}
+
+RemoteControlDbusInterface::~RemoteControlDbusInterface()
+{
+}
diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h
index d42a28f..a2befb4 100644
--- a/interfaces/dbusinterfaces.h
+++ b/interfaces/dbusinterfaces.h
@@ -30,6 +30,7 @@
 #include "interfaces/devicenotificationsinterface.h"
 #include "interfaces/notificationinterface.h"
 #include "interfaces/mprisremoteinterface.h"
+#include "interfaces/remotecontrolinterface.h"
 
 /**
  * Using these "proxy" classes just in case we need to rename the
@@ -124,4 +125,13 @@ Q_SIGNALS:
     void propertiesChangedProxy();
 };
 
+class KDECONNECTINTERFACES_EXPORT RemoteControlDbusInterface
+    : public OrgKdeKdeconnectDeviceRemotecontrolInterface
+{
+    Q_OBJECT
+public:
+    RemoteControlDbusInterface(const QString& deviceId, QObject* parent = 0);
+    ~RemoteControlDbusInterface() override;
+};
+
 #endif
diff --git a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
index 0db9e8b..dfa92e9 100644
--- a/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
+++ b/plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.cpp
@@ -49,6 +49,11 @@ QObject* createSftpInterface(QVariant deviceId)
     return new SftpDbusInterface(deviceId.toString());
 }
 
+QObject* createRemoteControlInterface(QVariant deviceId)
+{
+    return new RemoteControlDbusInterface(deviceId.toString());
+}
+
 QObject* createMprisInterface(QVariant deviceId)
 {
     return new MprisDbusInterface(deviceId.toString());
@@ -85,6 +90,9 @@ void KdeConnectDeclarativePlugin::initializeEngine(QQmlEngine* engine, const cha
 
     engine->rootContext()->setContextProperty("MprisDbusInterfaceFactory"
       , new ObjectFactory(engine, createMprisInterface));
+
+    engine->rootContext()->setContextProperty("RemoteControlDbusInterfaceFactory"
+      , new ObjectFactory(engine, createRemoteControlInterface));
     
     engine->rootContext()->setContextProperty("DBusResponseFactory"
       , new ObjectFactory(engine, createDBusResponse));    
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 35aec66..10d26e6 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -16,6 +16,7 @@ add_subdirectory(screensaver-inhibit)
 
 if(EXPERIMENTALAPP_ENABLED)
     add_subdirectory(mprisremote)
+    add_subdirectory(remotecontrol)
 endif()
 
 #FIXME: If we split notifications in several files, they won't appear in the same group in the Notifications KCM
diff --git a/plugins/remotecontrol/CMakeLists.txt b/plugins/remotecontrol/CMakeLists.txt
new file mode 100644
index 0000000..c33d932
--- /dev/null
+++ b/plugins/remotecontrol/CMakeLists.txt
@@ -0,0 +1,7 @@
+kdeconnect_add_plugin(kdeconnect_remotecontrol JSON kdeconnect_remotecontrol.json SOURCES remotecontrolplugin.cpp)
+
+target_link_libraries(kdeconnect_remotecontrol
+    kdeconnectcore
+    Qt5::DBus
+    KF5::I18n
+)
diff --git a/plugins/remotecontrol/kdeconnect_remotecontrol.json b/plugins/remotecontrol/kdeconnect_remotecontrol.json
new file mode 100644
index 0000000..5ff9ca3
--- /dev/null
+++ b/plugins/remotecontrol/kdeconnect_remotecontrol.json
@@ -0,0 +1,26 @@
+{
+    "Encoding": "UTF-8", 
+    "KPlugin": {
+        "Authors": [
+            {
+                "Email": "aleixpol at kde.org", 
+                "Name": "Aleix Pol"
+            }
+        ], 
+        "Description": "Control Remote systems",
+        "EnabledByDefault": true, 
+        "Icon": "applications-multimedia", 
+        "Id": "kdeconnect_remotecontrol",
+        "License": "GPL", 
+        "Name": "RemoteControl",
+        "ServiceTypes": [
+            "KdeConnect/Plugin"
+        ], 
+        "Version": "0.1", 
+        "Website": "https://kde.org"
+    }, 
+    "X-KdeConnect-OutgoingPackageType": [
+        "kdeconnect.mousepad"
+    ], 
+    "X-KdeConnect-SupportedPackageType": []
+}
diff --git a/plugins/clipboard/clipboardplugin.cpp b/plugins/remotecontrol/remotecontrolplugin.cpp
similarity index 50%
copy from plugins/clipboard/clipboardplugin.cpp
copy to plugins/remotecontrol/remotecontrolplugin.cpp
index 656dc72..935f3b9 100644
--- a/plugins/clipboard/clipboardplugin.cpp
+++ b/plugins/remotecontrol/remotecontrolplugin.cpp
@@ -18,47 +18,53 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "clipboardplugin.h"
-
-#include <QClipboard>
-#include <QGuiApplication>
+#include "remotecontrolplugin.h"
 
+#include <KLocalizedString>
 #include <KPluginFactory>
 
-K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_clipboard.json", registerPlugin< ClipboardPlugin >(); )
+#include <QDebug>
+#include <QDBusConnection>
+#include <QPoint>
+#include <QLoggingCategory>
+
+#include <core/device.h>
 
-Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CLIPBOARD, "kdeconnect.plugin.clipboard")
+K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_remotecontrol.json", registerPlugin< RemoteControlPlugin >(); )
 
-ClipboardPlugin::ClipboardPlugin(QObject *parent, const QVariantList &args)
+Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_REMOTECONTROL, "kdeconnect.plugin.remotecontrol")
+
+RemoteControlPlugin::RemoteControlPlugin(QObject *parent, const QVariantList &args)
     : KdeConnectPlugin(parent, args)
-    , clipboard(QGuiApplication::clipboard())
 {
-    connect(clipboard, SIGNAL(changed(QClipboard::Mode)), this, SLOT(clipboardChanged(QClipboard::Mode)));
 }
 
-void ClipboardPlugin::clipboardChanged(QClipboard::Mode mode)
-{
-    if (mode != QClipboard::Clipboard) {
-        return;
-    }
+RemoteControlPlugin::~RemoteControlPlugin()
+{}
 
-    QString content = clipboard->text();
-
-    if (content == currentContent) {
-        return;
-    }
-
-    currentContent = content;
+void RemoteControlPlugin::moveCursor(const QPoint &p)
+{
+    NetworkPackage np(PACKAGE_TYPE_MOUSEPAD);
+    np.set("dx", p.x());
+    np.set("dy", p.y());
+    sendPackage(np);
+}
 
-    NetworkPackage np(PACKAGE_TYPE_CLIPBOARD);
-    np.set("content", content);
+void RemoteControlPlugin::sendCommand(const QString &name, bool val)
+{
+    NetworkPackage np(PACKAGE_TYPE_MOUSEPAD);
+    np.set(name, val);
     sendPackage(np);
 }
 
-bool ClipboardPlugin::receivePackage(const NetworkPackage& np)
+void RemoteControlPlugin::connected()
+{
+    QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents);
+}
+
+QString RemoteControlPlugin::dbusPath() const
 {
-    clipboard->setText(np.get<QString>("content"));
-    return true;
+    return "/modules/kdeconnect/devices/" + device()->id() + "/remotecontrol";
 }
 
-#include "clipboardplugin.moc"
+#include "remotecontrolplugin.moc"
diff --git a/plugins/ping/pingplugin.h b/plugins/remotecontrol/remotecontrolplugin.h
similarity index 64%
copy from plugins/ping/pingplugin.h
copy to plugins/remotecontrol/remotecontrolplugin.h
index 3217dcd..0c2fbc9 100644
--- a/plugins/ping/pingplugin.h
+++ b/plugins/remotecontrol/remotecontrolplugin.h
@@ -18,31 +18,30 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PINGPLUGIN_H
-#define PINGPLUGIN_H
+#ifndef MPRISREMOTEPLUGIN_H
+#define MPRISREMOTEPLUGIN_H
 
 #include <QObject>
 
 #include <core/kdeconnectplugin.h>
 
-#define PACKAGE_TYPE_PING QLatin1String("kdeconnect.ping")
+#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad")
 
-class Q_DECL_EXPORT PingPlugin
+class Q_DECL_EXPORT RemoteControlPlugin
     : public KdeConnectPlugin
 {
     Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
+    Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecontrol")
 
 public:
-    explicit PingPlugin(QObject *parent, const QVariantList &args);
-    virtual ~PingPlugin();
+    explicit RemoteControlPlugin(QObject *parent, const QVariantList &args);
+    ~RemoteControlPlugin() override;
 
-    Q_SCRIPTABLE void sendPing();
-    Q_SCRIPTABLE void sendPing(const QString& customMessage);
+    bool receivePackage(const NetworkPackage& /*np*/) override { return false; }
+    void connected() override;
 
-public Q_SLOTS:
-    virtual bool receivePackage(const NetworkPackage& np);
-    virtual void connected();
+    Q_INVOKABLE void moveCursor(const QPoint &p);
+    Q_INVOKABLE void sendCommand(const QString &name, bool val);
 
 private:
     QString dbusPath() const;

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list