Merge lp:~mzanetti/unity8/aethercast-cursor into lp:unity8

Proposed by Michael Zanetti
Status: Work in progress
Proposed branch: lp:~mzanetti/unity8/aethercast-cursor
Merge into: lp:unity8
Diff against target: 902 lines (+759/-3)
18 files modified
debian/unity8-private.install (+1/-0)
plugins/Aethercast/CMakeLists.txt (+11/-0)
plugins/Aethercast/aethercastmanager.cpp (+76/-0)
plugins/Aethercast/aethercastmanager.h (+59/-0)
plugins/Aethercast/inputprovider.cpp (+159/-0)
plugins/Aethercast/inputprovider.h (+64/-0)
plugins/Aethercast/inputprovideradaptor.cpp (+52/-0)
plugins/Aethercast/inputprovideradaptor.h (+62/-0)
plugins/Aethercast/managerinterface.cpp (+25/-0)
plugins/Aethercast/managerinterface.h (+93/-0)
plugins/Aethercast/org.aethercast.xml (+52/-0)
plugins/Aethercast/plugin.cpp (+35/-0)
plugins/Aethercast/plugin.h (+32/-0)
plugins/Aethercast/qmldir (+3/-0)
plugins/CMakeLists.txt (+1/-0)
plugins/Cursor/CursorImageProvider.h (+17/-2)
plugins/Cursor/plugin.cpp (+2/-1)
qml/Shell.qml (+15/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/aethercast-cursor
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+280806@code.launchpad.net

Commit message

Add support for cursor streaming over aethercast

Description of the change

WIP, want a diff

To post a comment you must log in.
2101. By Michael Zanetti

ABS, not REL

2102. By Michael Zanetti

more work on providing a cursor to aethercast

2103. By Michael Zanetti

merge trunk

2104. By Michael Zanetti

make whitespace test happy

2105. By Michael Zanetti

merge trunk

2106. By Michael Zanetti

fix plugin name

2107. By Michael Zanetti

install files

2108. By Michael Zanetti

typo--

2109. By Michael Zanetti

merge trunk

2110. By Michael Zanetti

merge trunk

Unmerged revisions

2110. By Michael Zanetti

merge trunk

2109. By Michael Zanetti

merge trunk

2108. By Michael Zanetti

typo--

2107. By Michael Zanetti

install files

2106. By Michael Zanetti

fix plugin name

2105. By Michael Zanetti

merge trunk

2104. By Michael Zanetti

make whitespace test happy

2103. By Michael Zanetti

merge trunk

2102. By Michael Zanetti

more work on providing a cursor to aethercast

2101. By Michael Zanetti

ABS, not REL

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/unity8-private.install'
2--- debian/unity8-private.install 2016-04-04 13:38:56 +0000
3+++ debian/unity8-private.install 2016-05-04 14:25:35 +0000
4@@ -1,5 +1,6 @@
5 usr/lib/*/libunity8-private.*
6 usr/lib/*/unity8/libUbuntuGestures*
7+usr/lib/*/unity8/qml/Aethercast
8 usr/lib/*/unity8/qml/AccountsService
9 usr/lib/*/unity8/qml/Cursor
10 usr/lib/*/unity8/qml/Dash
11
12=== added directory 'plugins/Aethercast'
13=== added file 'plugins/Aethercast/CMakeLists.txt'
14--- plugins/Aethercast/CMakeLists.txt 1970-01-01 00:00:00 +0000
15+++ plugins/Aethercast/CMakeLists.txt 2016-05-04 14:25:35 +0000
16@@ -0,0 +1,11 @@
17+add_library(Aethercast-qml MODULE
18+ plugin.cpp
19+ aethercastmanager.cpp
20+ inputprovider.cpp
21+ inputprovideradaptor.cpp
22+ managerinterface.cpp
23+ )
24+
25+qt5_use_modules(Aethercast-qml Qml Gui DBus)
26+
27+add_unity8_plugin(Aethercast 0.1 Aethercast TARGETS Aethercast-qml)
28
29=== added file 'plugins/Aethercast/aethercastmanager.cpp'
30--- plugins/Aethercast/aethercastmanager.cpp 1970-01-01 00:00:00 +0000
31+++ plugins/Aethercast/aethercastmanager.cpp 2016-05-04 14:25:35 +0000
32@@ -0,0 +1,76 @@
33+/*
34+ * Copyright (C) 2015 Canonical, Ltd.
35+ *
36+ * This program is free software; you can redistribute it and/or modify
37+ * it under the terms of the GNU General Public License as published by
38+ * the Free Software Foundation; version 3.
39+ *
40+ * This program is distributed in the hope that it will be useful,
41+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
42+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43+ * GNU General Public License for more details.
44+ *
45+ * You should have received a copy of the GNU General Public License
46+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
47+ */
48+
49+#include "aethercastmanager.h"
50+#include "managerinterface.h"
51+#include "inputprovider.h"
52+
53+#include <QDebug>
54+#include <QDBusConnection>
55+
56+#define MANAGER_PATH QStringLiteral("/org/aethercast/InputProvider")
57+
58+AethercastManager::AethercastManager(QObject *parent):
59+ QObject(parent),
60+ m_manager(new ManagerInterface(QStringLiteral("org.aethercast"), QStringLiteral("/org/aethercast"), QDBusConnection::systemBus(), this)),
61+ m_inputProvider(new InputProvider(this))
62+{
63+ QDBusConnection::systemBus().registerObject(MANAGER_PATH, QStringLiteral("org.aethercast.InputProvider"), m_inputProvider);
64+ m_manager->RegisterInputProvider(QDBusObjectPath(MANAGER_PATH), QVariantMap());
65+
66+ connect(m_inputProvider, &InputProvider::cursorChanged, this, &AethercastManager::cursorChanged);
67+ connect(m_inputProvider, &InputProvider::mouseXChanged, this, &AethercastManager::mouseXChanged);
68+ connect(m_inputProvider, &InputProvider::mouseYChanged, this, &AethercastManager::mouseYChanged);
69+}
70+
71+AethercastManager::~AethercastManager()
72+{
73+ m_manager->UnregisterInputProvider(QDBusObjectPath(MANAGER_PATH));
74+}
75+
76+int AethercastManager::mouseX() const
77+{
78+ return m_inputProvider->mouseX();
79+}
80+
81+void AethercastManager::setMouseX(int mouseX)
82+{
83+ if (mouseX != m_inputProvider->mouseX()) {
84+ m_inputProvider->setMouseX(mouseX);
85+ }
86+}
87+
88+int AethercastManager::mouseY() const
89+{
90+ return m_inputProvider->mouseY();
91+}
92+
93+void AethercastManager::setMouseY(int mouseY)
94+{
95+ if (mouseY != m_inputProvider->mouseY()) {
96+ m_inputProvider->setMouseY(mouseY);
97+ }
98+}
99+
100+QString AethercastManager::cursor() const
101+{
102+ return m_inputProvider->cursor();
103+}
104+
105+void AethercastManager::setCursor(const QString &cursor)
106+{
107+ m_inputProvider->setCursorSource(cursor);
108+}
109
110=== added file 'plugins/Aethercast/aethercastmanager.h'
111--- plugins/Aethercast/aethercastmanager.h 1970-01-01 00:00:00 +0000
112+++ plugins/Aethercast/aethercastmanager.h 2016-05-04 14:25:35 +0000
113@@ -0,0 +1,59 @@
114+/*
115+ * Copyright (C) 2015 Canonical, Ltd.
116+ *
117+ * This program is free software; you can redistribute it and/or modify
118+ * it under the terms of the GNU General Public License as published by
119+ * the Free Software Foundation; version 3.
120+ *
121+ * This program is distributed in the hope that it will be useful,
122+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
123+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+ * GNU General Public License for more details.
125+ *
126+ * You should have received a copy of the GNU General Public License
127+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
128+ */
129+
130+#ifndef AETHERCAST_MANAGER_H
131+#define AETHERCAST_MANAGER_H
132+
133+#include <QtCore/QObject>
134+#include <QtGui/QColor>
135+
136+class ManagerInterface;
137+class InputProvider;
138+
139+class AethercastManager: public QObject
140+{
141+ Q_OBJECT
142+ Q_PROPERTY(int mouseX READ mouseX WRITE setMouseX NOTIFY mouseXChanged)
143+ Q_PROPERTY(int mouseY READ mouseY WRITE setMouseY NOTIFY mouseYChanged)
144+ Q_PROPERTY(QString cursor READ cursor WRITE setCursor NOTIFY cursorChanged)
145+
146+public:
147+ explicit AethercastManager(QObject *parent = 0);
148+ ~AethercastManager();
149+
150+ int mouseX() const;
151+ void setMouseX(int mouseX);
152+
153+ int mouseY() const;
154+ void setMouseY(int mouseY);
155+
156+ QString cursor() const;
157+ void setCursor(const QString &cursor);
158+
159+//public Q_SLOTS:
160+// void sendMousePosition(int x, int y);
161+
162+Q_SIGNALS:
163+ void cursorChanged();
164+ void mouseXChanged();
165+ void mouseYChanged();
166+
167+private:
168+ ManagerInterface *m_manager;
169+ InputProvider *m_inputProvider;
170+};
171+
172+#endif
173
174=== added file 'plugins/Aethercast/inputprovider.cpp'
175--- plugins/Aethercast/inputprovider.cpp 1970-01-01 00:00:00 +0000
176+++ plugins/Aethercast/inputprovider.cpp 2016-05-04 14:25:35 +0000
177@@ -0,0 +1,159 @@
178+/*
179+ * Copyright (C) 2015 Canonical, Ltd.
180+ *
181+ * This program is free software; you can redistribute it and/or modify
182+ * it under the terms of the GNU General Public License as published by
183+ * the Free Software Foundation; version 3.
184+ *
185+ * This program is distributed in the hope that it will be useful,
186+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
187+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
188+ * GNU General Public License for more details.
189+ *
190+ * You should have received a copy of the GNU General Public License
191+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
192+ */
193+
194+#include "inputprovider.h"
195+#include "inputprovideradaptor.h"
196+
197+#include <linux/input.h>
198+#include <unistd.h>
199+
200+#include <QStandardPaths>
201+
202+
203+InputProvider::InputProvider(QObject *parent):
204+ QObject(parent),
205+ m_adaptor(new InputProviderAdaptor(this))
206+{
207+
208+}
209+
210+void InputProvider::setMouseX(int x)
211+{
212+ m_x = x;
213+
214+ if (!m_file.isOpen()) {
215+ return;
216+ }
217+
218+ struct input_event event;
219+ memset(&event, 0, sizeof(event));
220+ clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time);
221+ event.type = EV_ABS;
222+ event.code = ABS_X;
223+ event.value = m_x;
224+ write(m_file.handle(), &event, sizeof(event));
225+
226+ Q_EMIT mouseXChanged();
227+}
228+
229+void InputProvider::setMouseY(int y)
230+{
231+ m_y = y;
232+
233+ if (!m_file.isOpen()) {
234+ return;
235+ }
236+
237+ struct input_event event;
238+ memset(&event, 0, sizeof(event));
239+ clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time);
240+ event.type = EV_ABS;
241+ event.code = ABS_Y;
242+ event.value = m_y;
243+ write(m_file.handle(), &event, sizeof(event));
244+
245+ Q_EMIT mouseYChanged();
246+}
247+
248+int InputProvider::mouseX() const
249+{
250+ return m_x;
251+}
252+
253+int InputProvider::mouseY() const
254+{
255+ return m_y;
256+}
257+
258+QString InputProvider::cursorSource() const
259+{
260+ return m_cursorSource;
261+}
262+
263+QString InputProvider::cursor() const
264+{
265+ return m_cursor;
266+}
267+
268+void InputProvider::setCursorSource(const QString &cursorSource)
269+{
270+ if (m_cursorSource == cursorSource) {
271+ return;
272+ }
273+
274+// QStringList parts = cursorSource.split('/');
275+// if (parts.count() != 2) {
276+// qWarning() << "Invalid cursor image. Needs to be \"theme/file\"";
277+// return;
278+// }
279+// QString theme = parts.first();
280+// QString cursor = parts.last();
281+
282+// // Check if we have this in cache
283+// QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
284+// QFile cacheFile(cachePath + QStringLiteral("/cursors/") + theme + QStringLiteral("/") + cursor + QStringLiteral(".png"));
285+
286+// if (!cacheFile.exists()) {
287+// XcursorImages *xcursorImages = XcursorLibraryLoadImages(QFile::encodeName(parts.last()), QFile::encodeName(parts.first()), 32);
288+// if (!xcursorImages || xcursorImages->nimage == 0) {
289+// qWarning() << "Error reading XcursorsImages for" << theme << cursor;
290+// return;
291+// }
292+
293+// XcursorImage *xcursorImage = xcursorImages->images[0];
294+
295+// QImage qimage = QImage((uchar*)xcursorImage->pixels, xcursorImage->width, xcursorImage->height, QImage::Format_ARGB32);
296+// }
297+
298+// m_cursor = cacheFile.fileName();
299+// Q_EMIT cursorChanged();
300+
301+// QVariantMap propertyChanges;
302+// propertyChanges["cursor"] = cursor;
303+// Q_EMIT PropertiesChanged("org.aethercast.InputProvider", propertyChanges, QStringList());
304+}
305+
306+void InputProvider::NewConnection(const QDBusUnixFileDescriptor &fd, const QVariantMap &options)
307+{
308+ Q_UNUSED(options)
309+ qDebug() << "have new connection" << fd.fileDescriptor();
310+
311+ if (m_file.isOpen()) {
312+ qWarning() << "Already have an Aethercast connection. Closing old one.";
313+ m_file.close();
314+ }
315+
316+ if (!m_file.open(fd.fileDescriptor(), QFile::WriteOnly)) {
317+ qWarning() << "Cannot open file for writing. Streaming mouse cursor to Aethercast will not work.";
318+ return;
319+ }
320+
321+ struct input_event event;
322+ memset(&event, 0, sizeof(event));
323+ clock_gettime(CLOCK_MONOTONIC, (timespec*)&event.time);
324+ event.type = EV_ABS;
325+ event.code = ABS_X;
326+ event.value = m_x;
327+ write(m_file.handle(), &event, sizeof(event));
328+ event.code = ABS_Y;
329+ event.value = m_y;
330+ write(m_file.handle(), &event, sizeof(event));
331+}
332+
333+void InputProvider::RequestDisconnection()
334+{
335+ m_file.close();
336+}
337
338=== added file 'plugins/Aethercast/inputprovider.h'
339--- plugins/Aethercast/inputprovider.h 1970-01-01 00:00:00 +0000
340+++ plugins/Aethercast/inputprovider.h 2016-05-04 14:25:35 +0000
341@@ -0,0 +1,64 @@
342+/*
343+ * Copyright (C) 2015 Canonical, Ltd.
344+ *
345+ * This program is free software; you can redistribute it and/or modify
346+ * it under the terms of the GNU General Public License as published by
347+ * the Free Software Foundation; version 3.
348+ *
349+ * This program is distributed in the hope that it will be useful,
350+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
351+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352+ * GNU General Public License for more details.
353+ *
354+ * You should have received a copy of the GNU General Public License
355+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
356+ */
357+
358+#ifndef INPUT_PROVIDER_H
359+#define INPUT_PROVIDER_H
360+
361+#include <QDBusConnection>
362+#include <QDBusUnixFileDescriptor>
363+#include <QFile>
364+
365+class InputProviderAdaptor;
366+
367+class InputProvider: public QObject
368+{
369+ Q_OBJECT
370+ Q_PROPERTY(QString cursor READ cursor)
371+
372+public:
373+ InputProvider(QObject *parent = nullptr);
374+
375+ // exposed to Shell
376+ void setMouseX(int x);
377+ void setMouseY(int y);
378+ int mouseX() const;
379+ int mouseY() const;
380+ void setCursorSource(const QString &cursor);
381+ QString cursorSource() const;
382+
383+ // exposed on D-Bus
384+ QString cursor() const;
385+
386+public Q_SLOTS:
387+ void NewConnection(const QDBusUnixFileDescriptor &fd, const QVariantMap &options);
388+ void RequestDisconnection();
389+
390+Q_SIGNALS:
391+ void cursorChanged();
392+ void mouseXChanged();
393+ void mouseYChanged();
394+ void PropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
395+
396+private:
397+ int m_x = 0;
398+ int m_y = 0;
399+ QString m_cursorSource;
400+ QString m_cursor;
401+ QFile m_file;
402+ InputProviderAdaptor *m_adaptor;
403+};
404+
405+#endif
406
407=== added file 'plugins/Aethercast/inputprovideradaptor.cpp'
408--- plugins/Aethercast/inputprovideradaptor.cpp 1970-01-01 00:00:00 +0000
409+++ plugins/Aethercast/inputprovideradaptor.cpp 2016-05-04 14:25:35 +0000
410@@ -0,0 +1,52 @@
411+/*
412+ * This file was generated by qdbusxml2cpp version 0.8
413+ * Command line was: qdbusxml2cpp -a inputprovideradaptor -c InputProviderAdaptor org.aethercast.xml org.aethercast.InputProvider
414+ *
415+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
416+ *
417+ * This is an auto-generated file.
418+ * Do not edit! All changes made to it will be lost.
419+ */
420+
421+#include "inputprovideradaptor.h"
422+#include <QtCore/QMetaObject>
423+#include <QtCore/QByteArray>
424+#include <QtCore/QList>
425+#include <QtCore/QMap>
426+#include <QtCore/QString>
427+#include <QtCore/QStringList>
428+#include <QtCore/QVariant>
429+
430+/*
431+ * Implementation of adaptor class InputProviderAdaptor
432+ */
433+
434+InputProviderAdaptor::InputProviderAdaptor(QObject *parent)
435+ : QDBusAbstractAdaptor(parent)
436+{
437+ // constructor
438+ setAutoRelaySignals(true);
439+}
440+
441+InputProviderAdaptor::~InputProviderAdaptor()
442+{
443+ // destructor
444+}
445+
446+QString InputProviderAdaptor::cursor() const
447+{
448+ // get the value of property cursor
449+ return qvariant_cast< QString >(parent()->property("cursor"));
450+}
451+
452+void InputProviderAdaptor::NewConnection(const QDBusUnixFileDescriptor &fd, const QVariantMap &options)
453+{
454+ // handle method call org.aethercast.InputProvider.NewConnection
455+ QMetaObject::invokeMethod(parent(), "NewConnection", Q_ARG(QDBusUnixFileDescriptor, fd), Q_ARG(QVariantMap, options));
456+}
457+
458+void InputProviderAdaptor::RequestDisconnection()
459+{
460+ // handle method call org.aethercast.InputProvider.RequestDisconnection
461+ QMetaObject::invokeMethod(parent(), "RequestDisconnection");
462+}
463
464=== added file 'plugins/Aethercast/inputprovideradaptor.h'
465--- plugins/Aethercast/inputprovideradaptor.h 1970-01-01 00:00:00 +0000
466+++ plugins/Aethercast/inputprovideradaptor.h 2016-05-04 14:25:35 +0000
467@@ -0,0 +1,62 @@
468+/*
469+ * This file was generated by qdbusxml2cpp version 0.8
470+ *
471+ * ATTENTION: The PropertiesChanged signal is added manually
472+ *
473+ * Command line was: qdbusxml2cpp -a inputprovideradaptor -c InputProviderAdaptor org.aethercast.xml org.aethercast.InputProvider
474+ *
475+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
476+ *
477+ * This is an auto-generated file.
478+ * This file may have been hand-edited. Look for HAND-EDIT comments
479+ * before re-generating it.
480+ */
481+
482+#ifndef INPUTPROVIDERADAPTOR_H
483+#define INPUTPROVIDERADAPTOR_H
484+
485+#include <QtCore/QObject>
486+#include <QtDBus/QtDBus>
487+QT_BEGIN_NAMESPACE
488+class QByteArray;
489+template<class T> class QList;
490+template<class Key, class Value> class QMap;
491+class QString;
492+class QStringList;
493+class QVariant;
494+QT_END_NAMESPACE
495+
496+/*
497+ * Adaptor class for interface org.aethercast.InputProvider
498+ */
499+class InputProviderAdaptor: public QDBusAbstractAdaptor
500+{
501+ Q_OBJECT
502+ Q_CLASSINFO("D-Bus Interface", "org.aethercast.InputProvider")
503+ Q_CLASSINFO("D-Bus Introspection", ""
504+" <interface name=\"org.aethercast.InputProvider\">\n"
505+" <method name=\"NewConnection\">\n"
506+" <arg direction=\"in\" type=\"h\" name=\"fd\"/>\n"
507+" <arg direction=\"in\" type=\"a{sv}\" name=\"options\"/>\n"
508+" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
509+" </method>\n"
510+" <method name=\"RequestDisconnection\"/>\n"
511+" <property access=\"read\" type=\"s\" name=\"cursor\"/>\n"
512+" </interface>\n"
513+ "")
514+public:
515+ InputProviderAdaptor(QObject *parent);
516+ virtual ~InputProviderAdaptor();
517+
518+public: // PROPERTIES
519+ Q_PROPERTY(QString cursor READ cursor)
520+ QString cursor() const;
521+
522+public Q_SLOTS: // METHODS
523+ void NewConnection(const QDBusUnixFileDescriptor &fd, const QVariantMap &options);
524+ void RequestDisconnection();
525+Q_SIGNALS: // SIGNALS
526+ void PropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
527+};
528+
529+#endif
530
531=== added file 'plugins/Aethercast/managerinterface.cpp'
532--- plugins/Aethercast/managerinterface.cpp 1970-01-01 00:00:00 +0000
533+++ plugins/Aethercast/managerinterface.cpp 2016-05-04 14:25:35 +0000
534@@ -0,0 +1,25 @@
535+/*
536+ * This file was generated by qdbusxml2cpp version 0.8
537+ * Command line was: qdbusxml2cpp -p managerinterface -c ManagerInterface org.aethercast.xml org.aethercast.Manager
538+ *
539+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
540+ *
541+ * This is an auto-generated file.
542+ * This file may have been hand-edited. Look for HAND-EDIT comments
543+ * before re-generating it.
544+ */
545+
546+#include "managerinterface.h"
547+
548+/*
549+ * Implementation of interface class ManagerInterface
550+ */
551+
552+ManagerInterface::ManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
553+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
554+{
555+}
556+
557+ManagerInterface::~ManagerInterface()
558+{
559+}
560
561=== added file 'plugins/Aethercast/managerinterface.h'
562--- plugins/Aethercast/managerinterface.h 1970-01-01 00:00:00 +0000
563+++ plugins/Aethercast/managerinterface.h 2016-05-04 14:25:35 +0000
564@@ -0,0 +1,93 @@
565+/*
566+ * This file was generated by qdbusxml2cpp version 0.8
567+ * Command line was: qdbusxml2cpp -p managerinterface -c ManagerInterface org.aethercast.xml org.aethercast.Manager
568+ *
569+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
570+ *
571+ * This is an auto-generated file.
572+ * Do not edit! All changes made to it will be lost.
573+ */
574+
575+#ifndef MANAGERINTERFACE_H
576+#define MANAGERINTERFACE_H
577+
578+#include <QtCore/QObject>
579+#include <QtCore/QByteArray>
580+#include <QtCore/QList>
581+#include <QtCore/QMap>
582+#include <QtCore/QString>
583+#include <QtCore/QStringList>
584+#include <QtCore/QVariant>
585+#include <QtDBus/QtDBus>
586+
587+/*
588+ * Proxy class for interface org.aethercast.Manager
589+ */
590+class ManagerInterface: public QDBusAbstractInterface
591+{
592+ Q_OBJECT
593+public:
594+ static inline const char *staticInterfaceName()
595+ { return "org.aethercast.Manager"; }
596+
597+public:
598+ ManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
599+
600+ ~ManagerInterface();
601+
602+ Q_PROPERTY(QStringList Capabilities READ capabilities)
603+ inline QStringList capabilities() const
604+ { return qvariant_cast< QStringList >(property("Capabilities")); }
605+
606+ Q_PROPERTY(bool Scanning READ scanning)
607+ inline bool scanning() const
608+ { return qvariant_cast< bool >(property("Scanning")); }
609+
610+ Q_PROPERTY(QString State READ state)
611+ inline QString state() const
612+ { return qvariant_cast< QString >(property("State")); }
613+
614+public Q_SLOTS: // METHODS
615+ inline QDBusPendingReply<> RegisterInputProvider(const QDBusObjectPath &path, const QVariantMap &options)
616+ {
617+ QList<QVariant> argumentList;
618+ argumentList << QVariant::fromValue(path) << QVariant::fromValue(options);
619+ return asyncCallWithArgumentList(QStringLiteral("RegisterInputProvider"), argumentList);
620+ }
621+
622+ inline QDBusPendingReply<> RegisterMediaManager(const QDBusObjectPath &path)
623+ {
624+ QList<QVariant> argumentList;
625+ argumentList << QVariant::fromValue(path);
626+ return asyncCallWithArgumentList(QStringLiteral("RegisterMediaManager"), argumentList);
627+ }
628+
629+ inline QDBusPendingReply<> Scan()
630+ {
631+ QList<QVariant> argumentList;
632+ return asyncCallWithArgumentList(QStringLiteral("Scan"), argumentList);
633+ }
634+
635+ inline QDBusPendingReply<> UnregisterInputProvider(const QDBusObjectPath &path)
636+ {
637+ QList<QVariant> argumentList;
638+ argumentList << QVariant::fromValue(path);
639+ return asyncCallWithArgumentList(QStringLiteral("UnregisterInputProvider"), argumentList);
640+ }
641+
642+ inline QDBusPendingReply<> UnregisterMediaManager(const QDBusObjectPath &path)
643+ {
644+ QList<QVariant> argumentList;
645+ argumentList << QVariant::fromValue(path);
646+ return asyncCallWithArgumentList(QStringLiteral("UnregisterMediaManager"), argumentList);
647+ }
648+
649+Q_SIGNALS: // SIGNALS
650+};
651+
652+namespace org {
653+ namespace aethercast {
654+ typedef ::ManagerInterface Manager;
655+ }
656+}
657+#endif
658
659=== added file 'plugins/Aethercast/org.aethercast.xml'
660--- plugins/Aethercast/org.aethercast.xml 1970-01-01 00:00:00 +0000
661+++ plugins/Aethercast/org.aethercast.xml 2016-05-04 14:25:35 +0000
662@@ -0,0 +1,52 @@
663+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
664+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
665+<node>
666+ <interface name="org.aethercast.Manager">
667+ <method name="RegisterMediaManager">
668+ <arg name="path" type="o" direction="in"/>
669+ </method>
670+ <method name="UnregisterMediaManager">
671+ <arg name="path" type="o" direction="in"/>
672+ </method>
673+ <method name="Scan"/>
674+ <method name="RegisterInputProvider">
675+ <arg name="path" type="o" direction="in"/>
676+ <arg name="options" type="a{sv}" direction="in"/>
677+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
678+ </method>
679+ <method name="UnregisterInputProvider">
680+ <arg name="path" type="o" direction="in"/>
681+ </method>
682+ <property name="State" type="s" access="read"/>
683+ <property name="Capabilities" type="as" access="read"/>
684+ <property name="Scanning" type="b" access="read"/>
685+ </interface>
686+ <interface name="org.aethercast.InputProvider">
687+ <method name="NewConnection">
688+ <arg name="fd" type="h" direction="in"/>
689+ <arg name="options" type="a{sv}" direction="in"/>
690+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
691+ </method>
692+ <method name="RequestDisconnection"/>
693+ <property name="cursor" type="s" access="read"/>
694+ </interface>
695+ <interface name="org.aethercast.Device">
696+ <method name="Connect">
697+ <arg name="role" type="s" direction="in"/>
698+ </method>
699+ <method name="Disconnect"/>
700+ <property name="State" type="s" access="read"/>
701+ <property name="Address" type="s" access="read"/>
702+ <property name="Name" type="s" access="read"/>
703+ <property name="Capabilities" type="as" access="read"/>
704+ </interface>
705+ <interface name="org.aethercast.MediaManager">
706+ <method name="Configure">
707+ <arg name="address" type="s"/>
708+ <arg name="port" type="i"/>
709+ </method>
710+ <method name="Play"/>
711+ <method name="Pause"/>
712+ <method name="Teardown"/>
713+ </interface>
714+</node>
715
716=== added file 'plugins/Aethercast/plugin.cpp'
717--- plugins/Aethercast/plugin.cpp 1970-01-01 00:00:00 +0000
718+++ plugins/Aethercast/plugin.cpp 2016-05-04 14:25:35 +0000
719@@ -0,0 +1,35 @@
720+/*
721+ * Copyright (C) 2016 Canonical, Ltd.
722+ *
723+ * This program is free software; you can redistribute it and/or modify
724+ * it under the terms of the GNU General Public License as published by
725+ * the Free Software Foundation; version 3.
726+ *
727+ * This program is distributed in the hope that it will be useful,
728+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
729+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
730+ * GNU General Public License for more details.
731+ *
732+ * You should have received a copy of the GNU General Public License
733+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
734+ */
735+
736+#include "plugin.h"
737+#include "aethercastmanager.h"
738+
739+#include <QtQml/qqml.h>
740+#include <QDebug>
741+
742+static QObject *manager_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
743+{
744+ Q_UNUSED(engine)
745+ Q_UNUSED(scriptEngine)
746+ qDebug() << "imageprovider is" << engine->imageProvider("cursor");
747+ return new AethercastManager();
748+}
749+
750+void AethercastPlugin::registerTypes(const char *uri)
751+{
752+ Q_ASSERT(uri == QLatin1String("Aethercast"));
753+ qmlRegisterSingletonType<AethercastManager>(uri, 0, 1, "AethercastManager", manager_provider);
754+}
755
756=== added file 'plugins/Aethercast/plugin.h'
757--- plugins/Aethercast/plugin.h 1970-01-01 00:00:00 +0000
758+++ plugins/Aethercast/plugin.h 2016-05-04 14:25:35 +0000
759@@ -0,0 +1,32 @@
760+/*
761+ * Copyright (C) 2016 Canonical, Ltd.
762+ *
763+ * This program is free software; you can redistribute it and/or modify
764+ * it under the terms of the GNU General Public License as published by
765+ * the Free Software Foundation; version 3.
766+ *
767+ * This program is distributed in the hope that it will be useful,
768+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
769+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
770+ * GNU General Public License for more details.
771+ *
772+ * You should have received a copy of the GNU General Public License
773+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
774+ */
775+
776+#ifndef AETHERCAST_PLUGIN_H
777+#define AETHERCAST_PLUGIN_H
778+
779+#include <QtQml/QQmlEngine>
780+#include <QtQml/QQmlExtensionPlugin>
781+
782+class AethercastPlugin : public QQmlExtensionPlugin
783+{
784+ Q_OBJECT
785+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
786+
787+public:
788+ void registerTypes(const char *uri) override;
789+};
790+
791+#endif
792
793=== added file 'plugins/Aethercast/qmldir'
794--- plugins/Aethercast/qmldir 1970-01-01 00:00:00 +0000
795+++ plugins/Aethercast/qmldir 2016-05-04 14:25:35 +0000
796@@ -0,0 +1,3 @@
797+module Aethercast
798+plugin Aethercast-qml
799+typeinfo Lights.qmltypes
800
801=== modified file 'plugins/CMakeLists.txt'
802--- plugins/CMakeLists.txt 2016-04-04 13:37:49 +0000
803+++ plugins/CMakeLists.txt 2016-05-04 14:25:35 +0000
804@@ -12,6 +12,7 @@
805 endmacro()
806
807 add_subdirectory(AccountsService)
808+add_subdirectory(Aethercast)
809 add_subdirectory(Cursor)
810 add_subdirectory(GlobalShortcut)
811 add_subdirectory(Greeter)
812
813=== modified file 'plugins/Cursor/CursorImageProvider.h'
814--- plugins/Cursor/CursorImageProvider.h 2015-11-16 14:27:31 +0000
815+++ plugins/Cursor/CursorImageProvider.h 2016-05-04 14:25:35 +0000
816@@ -63,8 +63,12 @@
817 CursorImageProvider();
818 virtual ~CursorImageProvider();
819
820- static CursorImageProvider *instance() { return m_instance; }
821-
822+ static CursorImageProvider *instance() {
823+ if (m_instance == nullptr) {
824+ new CursorImageProvider();
825+ }
826+ return m_instance;
827+ }
828
829 QImage requestImage(const QString &cursorName, QSize *size, const QSize &requestedSize) override;
830
831@@ -89,4 +93,15 @@
832 static CursorImageProvider *m_instance;
833 };
834
835+class CursorImageHelper: public QObject
836+{
837+ Q_OBJECT
838+public:
839+ CursorImageHelper(QObject *parent = 0): QObject(parent) {}
840+ Q_INVOKABLE QImage cursorImage(const QString &cursorName) {
841+ QSize s;
842+ return CursorImageProvider::instance()->requestImage(cursorName, &s, QSize());
843+ }
844+};
845+
846 #endif // CURSORIMAGEPROVIDER_H
847
848=== modified file 'plugins/Cursor/plugin.cpp'
849--- plugins/Cursor/plugin.cpp 2015-11-20 15:01:39 +0000
850+++ plugins/Cursor/plugin.cpp 2016-05-04 14:25:35 +0000
851@@ -29,11 +29,12 @@
852 {
853 Q_ASSERT(uri == QLatin1String("Cursor"));
854 qmlRegisterType<MousePointer>(uri, 1, 0, "MousePointer");
855+ qmlRegisterType<CursorImageHelper>(uri, 1, 0, "CursorImageHelper");
856 }
857
858 void CursorPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
859 {
860 QQmlExtensionPlugin::initializeEngine(engine, uri);
861
862- engine->addImageProvider(QStringLiteral("cursor"), new CursorImageProvider());
863+ engine->addImageProvider(QStringLiteral("cursor"), CursorImageProvider::instance());
864 }
865
866=== modified file 'qml/Shell.qml'
867--- qml/Shell.qml 2016-04-27 15:01:10 +0000
868+++ qml/Shell.qml 2016-05-04 14:25:35 +0000
869@@ -42,6 +42,7 @@
870 import Unity.DashCommunicator 0.1
871 import Unity.Indicators 0.1 as Indicators
872 import Cursor 1.0
873+import Aethercast 0.1
874 import WindowManager 0.1
875
876
877@@ -224,11 +225,25 @@
878 }
879 }
880
881+ CursorImageHelper {
882+ id: cursorImageHelper
883+ }
884+
885 GSettings {
886 id: settings
887 schema.id: "com.canonical.Unity8"
888 }
889
890+ Binding { target: AethercastManager; property: "x"; value: cursor.x }
891+ Binding { target: AethercastManager; property: "cursorImage"; value: cursorImageHelper.cursorImage(cursor.themeName + "/" + cursor.cursorName) }
892+
893+// AethercastManager {
894+// id: aethercast
895+// cursorX: cursor.x
896+// cursorY: cursor.y
897+// cursor: mousePointer.themeName + "/" + mousePointer.cursorName
898+// }
899+
900 Item {
901 id: stages
902 objectName: "stages"

Subscribers

People subscribed via source and target branches