on xenial help sign in
cleanup review comments
commitd04170681d031132ff3c071a3f941b62c7b4de5f authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 25 Nov 2015, 15:58 (11 years ago) parent0daca65
4 files changed+48−5
plugins/UInput/UInput.qmltypes+44 plugins/UInput/uinput.cpp+3−3 plugins/UInput/uinput.h+1−1 tests/mocks/UInput/qmldir−1
plugins/UInput/UInput.qmltypesnew file+44
@@ -0,0 +1,44 @@
1+import QtQuick.tooling 1.1
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable UInput 0.1 plugins'
8+
9+Module {
10+ Component {
11+ name: "UInput"
12+ prototype: "QObject"
13+ exports: ["UInput/UInput 0.1"]
14+ exportMetaObjectRevisions: [0]
15+ Enum {
16+ name: "Button"
17+ values: {
18+ "ButtonLeft": 0,
19+ "ButtonRight": 1,
20+ "ButtonMiddle": 2
21+ }
22+ }
23+ Method { name: "createMouse" }
24+ Method { name: "removeMouse" }
25+ Method {
26+ name: "moveMouse"
27+ Parameter { name: "dx"; type: "int" }
28+ Parameter { name: "dy"; type: "int" }
29+ }
30+ Method {
31+ name: "pressMouse"
32+ Parameter { name: "button"; type: "Button" }
33+ }
34+ Method {
35+ name: "releaseMouse"
36+ Parameter { name: "button"; type: "Button" }
37+ }
38+ Method {
39+ name: "scrollMouse"
40+ Parameter { name: "dh"; type: "int" }
41+ Parameter { name: "dv"; type: "int" }
42+ }
43+ }
44+}
plugins/UInput/uinput.cpp+3−3
@@ -26,13 +26,13 @@
2626UInput::UInput(QObject *parent) :
2727 QObject(parent)
2828{
29− m_devName = QStringLiteral("unity8-simulated-mouse");
30− m_uinput.setFileName("/dev/uinput");
29+ m_devName = QByteArrayLiteral("unity8-simulated-mouse");
30+ m_uinput.setFileName(QStringLiteral("/dev/uinput"));
3131
3232 memset(&m_uinput_mouse_dev, 0, sizeof(m_uinput_mouse_dev));
3333 m_uinput_mouse_dev.id.bustype = BUS_USB;
3434 m_uinput_mouse_dev.id.version = 1;
35− strncpy(m_uinput_mouse_dev.name, m_devName.toLocal8Bit().data(), m_devName.length());
35+ strncpy(m_uinput_mouse_dev.name, m_devName.constData(), m_devName.length());
3636}
3737
3838UInput::~UInput()
plugins/UInput/uinput.h+1−1
@@ -53,7 +53,7 @@ private:
5353private:
5454 QFile m_uinput;
5555 uinput_user_dev m_uinput_mouse_dev;
56− QString m_devName;
56+ QByteArray m_devName;
5757
5858 bool m_mouseCreated = false;
5959};
tests/mocks/UInput/qmldir−1
@@ -1,3 +1,2 @@
11module UInput
22plugin FakeUInput-qml
3−typeinfo UInput.qmltypes