Merge lp:~osomon/webbrowser-app/bottom-edge-mouse into lp:webbrowser-app
- bottom-edge-mouse
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Olivier Tilloy | ||||
Approved revision: | 1340 | ||||
Merged at revision: | 1339 | ||||
Proposed branch: | lp:~osomon/webbrowser-app/bottom-edge-mouse | ||||
Merge into: | lp:webbrowser-app | ||||
Diff against target: |
1518 lines (+1284/-27) 19 files modified
debian/control (+3/-0) debian/rules (+3/-1) debian/webbrowser-app-apparmor.manifest (+2/-1) src/app/CMakeLists.txt (+1/-0) src/app/browserapplication.cpp (+5/-0) src/app/unity8/README (+11/-3) src/app/unity8/plugins/CMakeLists.txt (+1/-0) src/app/unity8/plugins/Unity/CMakeLists.txt (+1/-0) src/app/unity8/plugins/Unity/InputInfo/CMakeLists.txt (+40/-0) src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp (+291/-0) src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h (+98/-0) src/app/unity8/plugins/Unity/InputInfo/plugin.cpp (+32/-0) src/app/unity8/plugins/Unity/InputInfo/plugin.h (+30/-0) src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel.cpp (+196/-0) src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel_p.h (+102/-0) src/app/unity8/plugins/Unity/InputInfo/qinputinfo.cpp (+270/-0) src/app/unity8/plugins/Unity/InputInfo/qinputinfo.h (+143/-0) src/app/unity8/plugins/Unity/InputInfo/qmldir (+3/-0) src/app/webbrowser/Browser.qml (+52/-22) |
||||
To merge this branch: | bzr merge lp:~osomon/webbrowser-app/bottom-edge-mouse | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Jamie Strandboge | Approve | ||
Review via email:
|
Commit message
In narrow mode, when a mouse is connected, turn the bottom edge hint into a clickable bottom edge bar.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1332. By Olivier Tilloy
-
Add missing build dependency.
- 1333. By Olivier Tilloy
-
In narrow mode, when a mouse is connected, turn the bottom edge hint into a clickable bottom edge bar.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1332
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1334. By Olivier Tilloy
-
Merge the latest changes from trunk, and resolve a minor conflict.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1333
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olivier Tilloy (osomon) wrote : | # |
Testing on device, I’m getting apparmor denials which prevent the Unity.InputInfo plugin from working. Disabling the apparmor profile makes it work.
The following additional rules appear to be needed:
/sys/class/ r,
/sys/class/input/ r,
/sys/
/sys/
- 1335. By Olivier Tilloy
-
Remove the "Open tabs" and "New tab" actions from the drawer menu.
- In wide mode, they are useless because there is a visible tab bar.
- In narrow mode, if there is a mouse connected the bottom edge bar opens the tabs view, and if there is no mouse the bottom edge hint opens it. - 1336. By Olivier Tilloy
-
Also detect touchpads.
- 1337. By Olivier Tilloy
-
Add apparmor rules to allow InputInfo to work.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jamie Strandboge (jdstrand) wrote : | # |
With the "/sys/devices/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1334
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1338. By Olivier Tilloy
-
Simpler sed rule.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jamie Strandboge (jdstrand) wrote : | # |
The apparmor changes look fine. Thanks!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jamie Strandboge (jdstrand) wrote : | # |
FYI, the other changes to debian/ look good too.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1337
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1338
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1339. By Olivier Tilloy
-
Escape $ in debian/rules.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1339
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1340. By Olivier Tilloy
-
Also allow read access to /run/udev/data/**, so that input device capabilities can be discovered.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1340
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2015-12-15 15:38:35 +0000 | |||
3 | +++ debian/control 2016-01-29 09:32:29 +0000 | |||
4 | @@ -10,8 +10,11 @@ | |||
5 | 10 | dh-apparmor, | 10 | dh-apparmor, |
6 | 11 | dh-translations, | 11 | dh-translations, |
7 | 12 | hardening-wrapper, | 12 | hardening-wrapper, |
8 | 13 | libevdev-dev, | ||
9 | 13 | liboxideqt-qmlplugin (>= 1.9), | 14 | liboxideqt-qmlplugin (>= 1.9), |
10 | 14 | libqt5sql5-sqlite, | 15 | libqt5sql5-sqlite, |
11 | 16 | libudev-dev, | ||
12 | 17 | pkg-config, | ||
13 | 15 | python3-all, | 18 | python3-all, |
14 | 16 | python3-flake8, | 19 | python3-flake8, |
15 | 17 | qml-module-qt-labs-folderlistmodel, | 20 | qml-module-qt-labs-folderlistmodel, |
16 | 18 | 21 | ||
17 | === modified file 'debian/rules' | |||
18 | --- debian/rules 2015-10-22 15:07:44 +0000 | |||
19 | +++ debian/rules 2016-01-29 09:32:29 +0000 | |||
20 | @@ -14,7 +14,9 @@ | |||
21 | 14 | aa-easyprof -m ./debian/webbrowser-app-apparmor.manifest --no-verify | \ | 14 | aa-easyprof -m ./debian/webbrowser-app-apparmor.manifest --no-verify | \ |
22 | 15 | egrep -v '(# Click packages|CLICK_DIR)' | \ | 15 | egrep -v '(# Click packages|CLICK_DIR)' | \ |
23 | 16 | sed 's/@{APP_PKGNAME}_@{APP_APPNAME}_@{APP_VERSION}/@{APP_PKGNAME}/g' | \ | 16 | sed 's/@{APP_PKGNAME}_@{APP_APPNAME}_@{APP_VERSION}/@{APP_PKGNAME}/g' | \ |
25 | 17 | sed 's#/run/shm/\.org\.chromium\.Chromium\.\*#/{dev,run}/shm/.org.chromium.Chromium.*#g' \ | 17 | sed 's#/run/shm/\.org\.chromium\.Chromium\.\*#/{dev,run}/shm/.org.chromium.Chromium.*#g' | \ |
26 | 18 | egrep -v 'deny /run/udev/data/\*\* r,' | \ | ||
27 | 19 | sed 's#^}$$#\n /sys/class/ r,\n /sys/class/input/ r,\n /run/udev/data/** r,\n}#g' \ | ||
28 | 18 | > ./debian/usr.bin.webbrowser-app | 20 | > ./debian/usr.bin.webbrowser-app |
29 | 19 | apparmor_parser -QTK ./debian/usr.bin.webbrowser-app | 21 | apparmor_parser -QTK ./debian/usr.bin.webbrowser-app |
30 | 20 | 22 | ||
31 | 21 | 23 | ||
32 | === modified file 'debian/webbrowser-app-apparmor.manifest' | |||
33 | --- debian/webbrowser-app-apparmor.manifest 2015-10-26 11:28:31 +0000 | |||
34 | +++ debian/webbrowser-app-apparmor.manifest 2016-01-29 09:32:29 +0000 | |||
35 | @@ -32,7 +32,8 @@ | |||
36 | 32 | "/usr/share/applications/", | 32 | "/usr/share/applications/", |
37 | 33 | "/custom/vendor/here/location-provider/consent/*.html", | 33 | "/custom/vendor/here/location-provider/consent/*.html", |
38 | 34 | "@{HOME}/.local/share/applications/", | 34 | "@{HOME}/.local/share/applications/", |
40 | 35 | "@{HOME}/Downloads/" | 35 | "@{HOME}/Downloads/", |
41 | 36 | "/sys/devices/**/input*/" | ||
42 | 36 | ], | 37 | ], |
43 | 37 | "write_path": [ | 38 | "write_path": [ |
44 | 38 | "@{HOME}/Downloads/" | 39 | "@{HOME}/Downloads/" |
45 | 39 | 40 | ||
46 | === modified file 'src/app/CMakeLists.txt' | |||
47 | --- src/app/CMakeLists.txt 2016-01-13 16:23:16 +0000 | |||
48 | +++ src/app/CMakeLists.txt 2016-01-29 09:32:29 +0000 | |||
49 | @@ -37,6 +37,7 @@ | |||
50 | 37 | Qt5::Quick | 37 | Qt5::Quick |
51 | 38 | Qt5::Widgets | 38 | Qt5::Widgets |
52 | 39 | UbuntuGesturesQml | 39 | UbuntuGesturesQml |
53 | 40 | InputInfo | ||
54 | 40 | ) | 41 | ) |
55 | 41 | 42 | ||
56 | 42 | file(GLOB QML_FILES *.qml) | 43 | file(GLOB QML_FILES *.qml) |
57 | 43 | 44 | ||
58 | === modified file 'src/app/browserapplication.cpp' | |||
59 | --- src/app/browserapplication.cpp 2016-01-15 10:06:31 +0000 | |||
60 | +++ src/app/browserapplication.cpp 2016-01-29 09:32:29 +0000 | |||
61 | @@ -37,6 +37,7 @@ | |||
62 | 37 | #include "TouchRegistry.h" | 37 | #include "TouchRegistry.h" |
63 | 38 | #include "Ubuntu/Gestures/Direction.h" | 38 | #include "Ubuntu/Gestures/Direction.h" |
64 | 39 | #include "Ubuntu/Gestures/DirectionalDragArea.h" | 39 | #include "Ubuntu/Gestures/DirectionalDragArea.h" |
65 | 40 | #include "Unity/InputInfo/qdeclarativeinputdevicemodel_p.h" | ||
66 | 40 | 41 | ||
67 | 41 | BrowserApplication::BrowserApplication(int& argc, char** argv) | 42 | BrowserApplication::BrowserApplication(int& argc, char** argv) |
68 | 42 | : QApplication(argc, argv) | 43 | : QApplication(argc, argv) |
69 | @@ -165,6 +166,10 @@ | |||
70 | 165 | qmlRegisterSingletonType<Direction>(gesturesUri, 0, 1, "Direction", Direction_singleton_factory); | 166 | qmlRegisterSingletonType<Direction>(gesturesUri, 0, 1, "Direction", Direction_singleton_factory); |
71 | 166 | qmlRegisterType<DirectionalDragArea>(gesturesUri, 0, 1, "DirectionalDragArea"); | 167 | qmlRegisterType<DirectionalDragArea>(gesturesUri, 0, 1, "DirectionalDragArea"); |
72 | 167 | 168 | ||
73 | 169 | const char* inputInfoUri = "Unity.InputInfo"; | ||
74 | 170 | qmlRegisterType<QDeclarativeInputDeviceModel>(inputInfoUri, 0, 1, "InputDeviceModel"); | ||
75 | 171 | qmlRegisterType<QInputDevice>(inputInfoUri, 0, 1, "InputInfo"); | ||
76 | 172 | |||
77 | 168 | m_engine = new QQmlEngine; | 173 | m_engine = new QQmlEngine; |
78 | 169 | connect(m_engine, SIGNAL(quit()), SLOT(quit())); | 174 | connect(m_engine, SIGNAL(quit()), SLOT(quit())); |
79 | 170 | if (!isRunningInstalled()) { | 175 | if (!isRunningInstalled()) { |
80 | 171 | 176 | ||
81 | === modified file 'src/app/unity8/README' | |||
82 | --- src/app/unity8/README 2015-03-17 15:14:11 +0000 | |||
83 | +++ src/app/unity8/README 2016-01-29 09:32:29 +0000 | |||
84 | @@ -1,11 +1,19 @@ | |||
85 | 1 | Code in this directory was copied over from unity8. | 1 | Code in this directory was copied over from unity8. |
86 | 2 | |||
87 | 3 | Ubuntu.Gestures: | ||
88 | 2 | - first import: 2015-02-04, at revision 1583 of lp:unity8 | 4 | - first import: 2015-02-04, at revision 1583 of lp:unity8 |
89 | 3 | - last sync: 2015-03-17, at revision 1663 of lp:unity8 | 5 | - last sync: 2015-03-17, at revision 1663 of lp:unity8 |
90 | 4 | 6 | ||
91 | 7 | Unity.InputInfo: | ||
92 | 8 | - first import: 2016-01-28, at revision 2143 of lp:unity8 | ||
93 | 9 | |||
94 | 5 | The structure of the directories has been kept identical, to ease syncing the | 10 | The structure of the directories has been kept identical, to ease syncing the |
95 | 6 | code in the future. Minor changes were made to the build system to integrate it | 11 | code in the future. Minor changes were made to the build system to integrate it |
96 | 7 | with the existing webbrowser-app code base. | 12 | with the existing webbrowser-app code base. |
97 | 8 | 13 | ||
101 | 9 | The goal is to eventually have those components moved over to the UITK, thus | 14 | As of 2015-12-09, the SwipeArea component is available in the UITK, so we should |
102 | 10 | removing the need for a copy here. See | 15 | start using it instead of building a local copy of Ubuntu.Gestures. This is |
103 | 11 | https://docs.google.com/a/canonical.com/document/d/1_ljZunMXWqJfrBGEkCp0peVD8gq6-E4ZMFpuH0PVKRc. | 16 | currently blocked on https://launchpad.net/bugs/1459362. |
104 | 17 | |||
105 | 18 | The Unity.InputInfo plugin should be replaced by an upstream Qt API in the near | ||
106 | 19 | future. | ||
107 | 12 | 20 | ||
108 | === modified file 'src/app/unity8/plugins/CMakeLists.txt' | |||
109 | --- src/app/unity8/plugins/CMakeLists.txt 2015-02-04 10:56:38 +0000 | |||
110 | +++ src/app/unity8/plugins/CMakeLists.txt 2016-01-29 09:32:29 +0000 | |||
111 | @@ -1,1 +1,2 @@ | |||
112 | 1 | add_subdirectory(Ubuntu) | 1 | add_subdirectory(Ubuntu) |
113 | 2 | add_subdirectory(Unity) | ||
114 | 2 | 3 | ||
115 | === added directory 'src/app/unity8/plugins/Unity' | |||
116 | === added file 'src/app/unity8/plugins/Unity/CMakeLists.txt' | |||
117 | --- src/app/unity8/plugins/Unity/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
118 | +++ src/app/unity8/plugins/Unity/CMakeLists.txt 2016-01-29 09:32:29 +0000 | |||
119 | @@ -0,0 +1,1 @@ | |||
120 | 1 | add_subdirectory(InputInfo) | ||
121 | 0 | 2 | ||
122 | === added directory 'src/app/unity8/plugins/Unity/InputInfo' | |||
123 | === added file 'src/app/unity8/plugins/Unity/InputInfo/CMakeLists.txt' | |||
124 | --- src/app/unity8/plugins/Unity/InputInfo/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
125 | +++ src/app/unity8/plugins/Unity/InputInfo/CMakeLists.txt 2016-01-29 09:32:29 +0000 | |||
126 | @@ -0,0 +1,40 @@ | |||
127 | 1 | # This is a temporary snapshot of the WIP QInputInfo API as we | ||
128 | 2 | # require this in unity now but upstream isn't finished yet. | ||
129 | 3 | # Eventually this should be dropped in favor of the upstream | ||
130 | 4 | # QInputInfo API. | ||
131 | 5 | |||
132 | 6 | project(InputInfo) | ||
133 | 7 | |||
134 | 8 | find_package(Qt5Core REQUIRED) | ||
135 | 9 | find_package(Qt5Quick REQUIRED) | ||
136 | 10 | |||
137 | 11 | include(FindPkgConfig) | ||
138 | 12 | pkg_check_modules(LIBUDEV REQUIRED libudev) | ||
139 | 13 | pkg_check_modules(LIBEVDEV REQUIRED libevdev) | ||
140 | 14 | |||
141 | 15 | include_directories( | ||
142 | 16 | ${CMAKE_CURRENT_SOURCE_DIR} | ||
143 | 17 | ${CMAKE_CURRENT_BINARY_DIR} | ||
144 | 18 | ${LIBUDEV_INCLUDE_DIRS} | ||
145 | 19 | ${LIBEVDEV_INCLUDE_DIRS} | ||
146 | 20 | ) | ||
147 | 21 | |||
148 | 22 | set(InputInfo_SOURCES | ||
149 | 23 | plugin.cpp | ||
150 | 24 | qinputinfo.cpp | ||
151 | 25 | qdeclarativeinputdevicemodel.cpp | ||
152 | 26 | linux/qinputdeviceinfo_linux.cpp | ||
153 | 27 | ) | ||
154 | 28 | |||
155 | 29 | add_library(InputInfo STATIC | ||
156 | 30 | ${InputInfo_SOURCES} | ||
157 | 31 | ) | ||
158 | 32 | |||
159 | 33 | target_link_libraries(InputInfo | ||
160 | 34 | ${LIBUDEV_LDFLAGS} | ||
161 | 35 | ${LIBEVDEV_LDFLAGS} | ||
162 | 36 | ) | ||
163 | 37 | |||
164 | 38 | qt5_use_modules(InputInfo Core Qml Quick) | ||
165 | 39 | |||
166 | 40 | #add_unity8_plugin(Unity.InputInfo 0.1 Unity/InputInfo TARGETS InputInfo) | ||
167 | 0 | 41 | ||
168 | === added directory 'src/app/unity8/plugins/Unity/InputInfo/linux' | |||
169 | === added file 'src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp' | |||
170 | --- src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 1970-01-01 00:00:00 +0000 | |||
171 | +++ src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2016-01-29 09:32:29 +0000 | |||
172 | @@ -0,0 +1,291 @@ | |||
173 | 1 | /**************************************************************************** | ||
174 | 2 | ** | ||
175 | 3 | ** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). | ||
176 | 4 | ** Contact: http://www.qt-project.org/legal | ||
177 | 5 | ** | ||
178 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
179 | 7 | ** | ||
180 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
181 | 9 | ** Commercial License Usage | ||
182 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
183 | 11 | ** accordance with the commercial license agreement provided with the | ||
184 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
185 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
186 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
187 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
188 | 16 | ** | ||
189 | 17 | ** GNU Lesser General Public License Usage | ||
190 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
191 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
192 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
193 | 21 | ** packaging of this file. Please review the following information to | ||
194 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
195 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
196 | 24 | ** | ||
197 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
198 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
199 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
200 | 28 | ** | ||
201 | 29 | ** GNU General Public License Usage | ||
202 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
203 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
204 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
205 | 33 | ** packaging of this file. Please review the following information to | ||
206 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
207 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
208 | 36 | ** | ||
209 | 37 | ** | ||
210 | 38 | ** $QT_END_LICENSE$ | ||
211 | 39 | ** | ||
212 | 40 | ****************************************************************************/ | ||
213 | 41 | |||
214 | 42 | #include "qinputdeviceinfo_linux_p.h" | ||
215 | 43 | |||
216 | 44 | #include <libudev.h> | ||
217 | 45 | #include <libevdev/libevdev.h> | ||
218 | 46 | #include <fcntl.h> | ||
219 | 47 | #include <QDebug> | ||
220 | 48 | #include <QSocketNotifier> | ||
221 | 49 | #include <QTimer> | ||
222 | 50 | #include <QDir> | ||
223 | 51 | |||
224 | 52 | QInputDeviceManagerPrivate::QInputDeviceManagerPrivate(QObject *parent) : | ||
225 | 53 | QObject(parent), | ||
226 | 54 | currentFilter(QInputDevice::Unknown), | ||
227 | 55 | udevice(0) | ||
228 | 56 | { | ||
229 | 57 | QTimer::singleShot(250,this,SLOT(init())); | ||
230 | 58 | } | ||
231 | 59 | |||
232 | 60 | QInputDeviceManagerPrivate::~QInputDeviceManagerPrivate() | ||
233 | 61 | { | ||
234 | 62 | udev_unref(udevice); | ||
235 | 63 | udev_monitor_unref(udevMonitor); | ||
236 | 64 | } | ||
237 | 65 | |||
238 | 66 | void QInputDeviceManagerPrivate::init() | ||
239 | 67 | { | ||
240 | 68 | if (!udevice) | ||
241 | 69 | udevice = udev_new(); | ||
242 | 70 | |||
243 | 71 | udev_list_entry *devices; | ||
244 | 72 | udev_list_entry *dev_list_entry; | ||
245 | 73 | udev_device *dev; | ||
246 | 74 | |||
247 | 75 | QString subsystem = QStringLiteral("input"); | ||
248 | 76 | struct udev_enumerate *enumerate = 0; | ||
249 | 77 | |||
250 | 78 | if (udevice) { | ||
251 | 79 | |||
252 | 80 | udevMonitor = udev_monitor_new_from_netlink(udevice, "udev"); | ||
253 | 81 | udev_monitor_filter_add_match_subsystem_devtype(udevMonitor, subsystem.toLatin1(), NULL); | ||
254 | 82 | enumerate = udev_enumerate_new(udevice); | ||
255 | 83 | udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1()); | ||
256 | 84 | |||
257 | 85 | udev_monitor_enable_receiving(udevMonitor); | ||
258 | 86 | notifierFd = udev_monitor_get_fd(udevMonitor); | ||
259 | 87 | |||
260 | 88 | notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this); | ||
261 | 89 | connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges())); | ||
262 | 90 | |||
263 | 91 | udev_enumerate_scan_devices(enumerate); | ||
264 | 92 | devices = udev_enumerate_get_list_entry(enumerate); | ||
265 | 93 | |||
266 | 94 | udev_list_entry_foreach(dev_list_entry, devices) { | ||
267 | 95 | const char *path; | ||
268 | 96 | path = udev_list_entry_get_name(dev_list_entry); | ||
269 | 97 | |||
270 | 98 | dev = udev_device_new_from_syspath(udevice, path); | ||
271 | 99 | if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { | ||
272 | 100 | QInputDevice *iDevice = addDevice(dev); | ||
273 | 101 | if (iDevice && !iDevice->devicePath().isEmpty()) { | ||
274 | 102 | deviceMap.insert(iDevice->devicePath(),iDevice); | ||
275 | 103 | } | ||
276 | 104 | } | ||
277 | 105 | udev_device_unref(dev); | ||
278 | 106 | } | ||
279 | 107 | udev_enumerate_unref(enumerate); | ||
280 | 108 | } | ||
281 | 109 | // udev_unref(udevice); | ||
282 | 110 | Q_FOREACH (const QString &devicePath, deviceMap.keys()) { | ||
283 | 111 | Q_EMIT deviceAdded(devicePath); | ||
284 | 112 | } | ||
285 | 113 | Q_EMIT ready(); | ||
286 | 114 | } | ||
287 | 115 | |||
288 | 116 | QInputDevice::InputTypeFlags QInputDeviceManagerPrivate::getInputTypeFlags(struct udev_device *dev) | ||
289 | 117 | { | ||
290 | 118 | QInputDevice::InputTypeFlags flags = QInputDevice::Unknown; | ||
291 | 119 | if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEY"), "1") == 0 ) { | ||
292 | 120 | flags |= QInputDevice::Button; | ||
293 | 121 | } | ||
294 | 122 | if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0) { | ||
295 | 123 | flags |= QInputDevice::Mouse; | ||
296 | 124 | } | ||
297 | 125 | if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0) { | ||
298 | 126 | flags |= QInputDevice::TouchPad; | ||
299 | 127 | } | ||
300 | 128 | if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0 | ||
301 | 129 | || qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0) { | ||
302 | 130 | flags |= QInputDevice::TouchScreen; | ||
303 | 131 | } | ||
304 | 132 | if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 ) { | ||
305 | 133 | flags |= QInputDevice::Keyboard; | ||
306 | 134 | } | ||
307 | 135 | if (!QString::fromLatin1(udev_device_get_property_value(dev, "SW")).isEmpty()) { | ||
308 | 136 | flags |= QInputDevice::Switch; | ||
309 | 137 | } | ||
310 | 138 | |||
311 | 139 | return flags; | ||
312 | 140 | } | ||
313 | 141 | |||
314 | 142 | QInputDevice *QInputDeviceManagerPrivate::addDevice(struct udev_device *udev) | ||
315 | 143 | { | ||
316 | 144 | QString eventPath = QString::fromLatin1(udev_device_get_sysname(udev)); | ||
317 | 145 | |||
318 | 146 | if (eventPath.contains(QStringLiteral("event"))) | ||
319 | 147 | eventPath.prepend(QStringLiteral("/dev/input/")); | ||
320 | 148 | |||
321 | 149 | if (deviceMap.contains(eventPath)) { | ||
322 | 150 | return Q_NULLPTR; | ||
323 | 151 | } | ||
324 | 152 | struct libevdev *dev = NULL; | ||
325 | 153 | int fd; | ||
326 | 154 | int rc = 1; | ||
327 | 155 | QInputDevice *inputDevice; | ||
328 | 156 | inputDevice = addUdevDevice(udev); | ||
329 | 157 | if (!inputDevice) { | ||
330 | 158 | return Q_NULLPTR; | ||
331 | 159 | } | ||
332 | 160 | eventPath = inputDevice->devicePath(); | ||
333 | 161 | |||
334 | 162 | qDebug() << "Input device added:" << inputDevice->name() << inputDevice->devicePath() << inputDevice->type(); | ||
335 | 163 | |||
336 | 164 | fd = open(eventPath.toLatin1(), O_RDONLY|O_NONBLOCK); | ||
337 | 165 | if (fd == -1) { | ||
338 | 166 | return inputDevice; | ||
339 | 167 | } | ||
340 | 168 | rc = libevdev_new_from_fd(fd, &dev); | ||
341 | 169 | if (rc < 0) { | ||
342 | 170 | qWarning() << "Failed to init libevdev ("<< strerror(-rc) << ")"; | ||
343 | 171 | return Q_NULLPTR; | ||
344 | 172 | } | ||
345 | 173 | |||
346 | 174 | for (int i = 0; i < EV_MAX; i++) { | ||
347 | 175 | if (i == EV_KEY || i == EV_SW || i == EV_REL | ||
348 | 176 | || i == EV_REL || i == EV_ABS) { | ||
349 | 177 | for (int j = 0; j < libevdev_event_type_get_max(i); j++) { | ||
350 | 178 | if (libevdev_has_event_code(dev, i, j)) { | ||
351 | 179 | switch (i) { | ||
352 | 180 | case EV_KEY: | ||
353 | 181 | inputDevice->addButton(j); | ||
354 | 182 | break; | ||
355 | 183 | case EV_SW: | ||
356 | 184 | inputDevice->addSwitch(j); | ||
357 | 185 | break; | ||
358 | 186 | case EV_REL: | ||
359 | 187 | inputDevice->addRelativeAxis(j); | ||
360 | 188 | break; | ||
361 | 189 | case EV_ABS: | ||
362 | 190 | inputDevice->addAbsoluteAxis(j); | ||
363 | 191 | break; | ||
364 | 192 | }; | ||
365 | 193 | } | ||
366 | 194 | } | ||
367 | 195 | } | ||
368 | 196 | } | ||
369 | 197 | |||
370 | 198 | return inputDevice; | ||
371 | 199 | } | ||
372 | 200 | |||
373 | 201 | void QInputDeviceManagerPrivate::addDetails(struct udev_device *) | ||
374 | 202 | { | ||
375 | 203 | } | ||
376 | 204 | |||
377 | 205 | void QInputDeviceManagerPrivate::removeDevice(const QString &path) | ||
378 | 206 | { | ||
379 | 207 | // this path is not a full evdev path | ||
380 | 208 | Q_FOREACH (const QString devicePath, deviceMap.keys()) { | ||
381 | 209 | if (devicePath.contains(path)) { | ||
382 | 210 | qDebug() << "Input device removed:" << deviceMap.value(devicePath)->name() << devicePath << deviceMap.value(devicePath)->type(); | ||
383 | 211 | deviceMap.remove(devicePath); | ||
384 | 212 | Q_EMIT deviceRemoved(devicePath); | ||
385 | 213 | } | ||
386 | 214 | } | ||
387 | 215 | } | ||
388 | 216 | |||
389 | 217 | QInputDevice *QInputDeviceManagerPrivate::addUdevDevice(struct udev_device *udev) | ||
390 | 218 | { | ||
391 | 219 | QInputDevice *iDevice; | ||
392 | 220 | |||
393 | 221 | struct udev_list_entry *list; | ||
394 | 222 | struct udev_list_entry *node; | ||
395 | 223 | |||
396 | 224 | list = udev_device_get_properties_list_entry (udev); | ||
397 | 225 | QString syspath = QString::fromLatin1(udev_device_get_syspath(udev)); | ||
398 | 226 | QDir sysdir(syspath); | ||
399 | 227 | |||
400 | 228 | QStringList infoList = sysdir.entryList(QStringList() << QStringLiteral("event*"),QDir::Dirs); | ||
401 | 229 | |||
402 | 230 | if (infoList.count() > 0) { | ||
403 | 231 | QString token = infoList.at(0); | ||
404 | 232 | |||
405 | 233 | token.prepend(QStringLiteral("/dev/input/")); | ||
406 | 234 | iDevice = new QInputDevice(this); | ||
407 | 235 | iDevice->setDevicePath(token); | ||
408 | 236 | } else { | ||
409 | 237 | return Q_NULLPTR; | ||
410 | 238 | } | ||
411 | 239 | udev_list_entry_foreach (node, list) { | ||
412 | 240 | |||
413 | 241 | QString key = QString::fromLatin1(udev_list_entry_get_name(node)); | ||
414 | 242 | QString value = QString::fromLatin1(udev_list_entry_get_value(node)); | ||
415 | 243 | |||
416 | 244 | if (key == QStringLiteral("NAME")) { | ||
417 | 245 | iDevice->setName(value.remove(QStringLiteral("\""))); | ||
418 | 246 | } | ||
419 | 247 | } | ||
420 | 248 | iDevice->setType(getInputTypeFlags(udev)); | ||
421 | 249 | return iDevice; | ||
422 | 250 | } | ||
423 | 251 | |||
424 | 252 | void QInputDeviceManagerPrivate::onUDevChanges() | ||
425 | 253 | { | ||
426 | 254 | if (!udevMonitor) | ||
427 | 255 | return; | ||
428 | 256 | |||
429 | 257 | udev_device *dev = udev_monitor_receive_device(udevMonitor); | ||
430 | 258 | |||
431 | 259 | if (dev) { | ||
432 | 260 | if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { | ||
433 | 261 | QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); | ||
434 | 262 | |||
435 | 263 | QString action = QString::fromStdString(udev_device_get_action(dev)); | ||
436 | 264 | |||
437 | 265 | if (!eventPath.contains(QStringLiteral("/dev/input/"))) | ||
438 | 266 | eventPath.prepend(QStringLiteral("/dev/input/")); | ||
439 | 267 | |||
440 | 268 | if (action == QStringLiteral("add")) { | ||
441 | 269 | if (deviceMap.contains(eventPath)){ | ||
442 | 270 | udev_device_unref(dev); | ||
443 | 271 | return; | ||
444 | 272 | } | ||
445 | 273 | |||
446 | 274 | QInputDevice *iDevice = addDevice(dev); | ||
447 | 275 | if (!iDevice) { | ||
448 | 276 | delete iDevice; | ||
449 | 277 | return; | ||
450 | 278 | } | ||
451 | 279 | iDevice->setType(getInputTypeFlags(dev)); | ||
452 | 280 | udev_device_unref(dev); | ||
453 | 281 | |||
454 | 282 | deviceMap.insert(eventPath,iDevice); | ||
455 | 283 | |||
456 | 284 | Q_EMIT deviceAdded(eventPath); | ||
457 | 285 | |||
458 | 286 | } else if (action == QStringLiteral("remove")) { | ||
459 | 287 | removeDevice(eventPath); | ||
460 | 288 | } | ||
461 | 289 | } | ||
462 | 290 | } | ||
463 | 291 | } | ||
464 | 0 | 292 | ||
465 | === added file 'src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h' | |||
466 | --- src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 1970-01-01 00:00:00 +0000 | |||
467 | +++ src/app/unity8/plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 2016-01-29 09:32:29 +0000 | |||
468 | @@ -0,0 +1,98 @@ | |||
469 | 1 | /**************************************************************************** | ||
470 | 2 | ** | ||
471 | 3 | ** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). | ||
472 | 4 | ** Contact: http://www.qt-project.org/legal | ||
473 | 5 | ** | ||
474 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
475 | 7 | ** | ||
476 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
477 | 9 | ** Commercial License Usage | ||
478 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
479 | 11 | ** accordance with the commercial license agreement provided with the | ||
480 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
481 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
482 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
483 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
484 | 16 | ** | ||
485 | 17 | ** GNU Lesser General Public License Usage | ||
486 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
487 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
488 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
489 | 21 | ** packaging of this file. Please review the following information to | ||
490 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
491 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
492 | 24 | ** | ||
493 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
494 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
495 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
496 | 28 | ** | ||
497 | 29 | ** GNU General Public License Usage | ||
498 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
499 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
500 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
501 | 33 | ** packaging of this file. Please review the following information to | ||
502 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
503 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
504 | 36 | ** | ||
505 | 37 | ** | ||
506 | 38 | ** $QT_END_LICENSE$ | ||
507 | 39 | ** | ||
508 | 40 | ****************************************************************************/ | ||
509 | 41 | |||
510 | 42 | #ifndef QINPUTDEVICEINFO_LINUX_P_H | ||
511 | 43 | #define QINPUTDEVICEINFO_LINUX_P_H | ||
512 | 44 | |||
513 | 45 | #include <QObject> | ||
514 | 46 | #include "qinputinfo.h" | ||
515 | 47 | #include <libudev.h> | ||
516 | 48 | |||
517 | 49 | class QInputDevicePrivate : public QObject | ||
518 | 50 | { | ||
519 | 51 | Q_OBJECT | ||
520 | 52 | public: | ||
521 | 53 | explicit QInputDevicePrivate(QObject *parent = 0); | ||
522 | 54 | |||
523 | 55 | QString name; | ||
524 | 56 | QString devicePath; | ||
525 | 57 | QList <int> buttons; //keys | ||
526 | 58 | QList <int> switches; | ||
527 | 59 | QList <int> relativeAxis; | ||
528 | 60 | QList <int> absoluteAxis; | ||
529 | 61 | QInputDevice::InputTypeFlags type; | ||
530 | 62 | }; | ||
531 | 63 | |||
532 | 64 | class QInputDeviceManagerPrivate : public QObject | ||
533 | 65 | { | ||
534 | 66 | Q_OBJECT | ||
535 | 67 | public: | ||
536 | 68 | explicit QInputDeviceManagerPrivate(QObject *parent = 0); | ||
537 | 69 | ~QInputDeviceManagerPrivate(); | ||
538 | 70 | QVector <QInputDevice *> deviceList; | ||
539 | 71 | QMap <QString, QInputDevice *> deviceMap; | ||
540 | 72 | static QInputDeviceManagerPrivate * instance(); | ||
541 | 73 | QInputDevice::InputType currentFilter; | ||
542 | 74 | |||
543 | 75 | Q_SIGNALS: | ||
544 | 76 | void deviceAdded(const QString &); | ||
545 | 77 | void deviceRemoved(const QString &); | ||
546 | 78 | void ready(); | ||
547 | 79 | |||
548 | 80 | private: | ||
549 | 81 | QInputDevice *addDevice(struct udev_device *udev); | ||
550 | 82 | QInputDevice *addUdevDevice(struct udev_device *); | ||
551 | 83 | |||
552 | 84 | QInputDevice *addDevice(const QString &path); | ||
553 | 85 | void removeDevice(const QString &path); | ||
554 | 86 | QSocketNotifier *notifier; | ||
555 | 87 | int notifierFd; | ||
556 | 88 | struct udev_monitor *udevMonitor; | ||
557 | 89 | QInputDevice::InputTypeFlags getInputTypeFlags(struct udev_device *); | ||
558 | 90 | struct udev *udevice; | ||
559 | 91 | void addDetails(struct udev_device *); | ||
560 | 92 | |||
561 | 93 | private Q_SLOTS: | ||
562 | 94 | void onUDevChanges(); | ||
563 | 95 | void init(); | ||
564 | 96 | }; | ||
565 | 97 | |||
566 | 98 | #endif // QINPUTDEVICEINFO_LINUX_P_H | ||
567 | 0 | 99 | ||
568 | === added file 'src/app/unity8/plugins/Unity/InputInfo/plugin.cpp' | |||
569 | --- src/app/unity8/plugins/Unity/InputInfo/plugin.cpp 1970-01-01 00:00:00 +0000 | |||
570 | +++ src/app/unity8/plugins/Unity/InputInfo/plugin.cpp 2016-01-29 09:32:29 +0000 | |||
571 | @@ -0,0 +1,32 @@ | |||
572 | 1 | /* | ||
573 | 2 | * Copyright 2015 Canonical Ltd. | ||
574 | 3 | * | ||
575 | 4 | * This program is free software; you can redistribute it and/or modify | ||
576 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
577 | 6 | * the Free Software Foundation; version 3. | ||
578 | 7 | * | ||
579 | 8 | * This program is distributed in the hope that it will be useful, | ||
580 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
581 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
582 | 11 | * GNU Lesser General Public License for more details. | ||
583 | 12 | * | ||
584 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
585 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
586 | 15 | */ | ||
587 | 16 | |||
588 | 17 | // Qt | ||
589 | 18 | #include <QtQml/qqml.h> | ||
590 | 19 | |||
591 | 20 | // self | ||
592 | 21 | #include "plugin.h" | ||
593 | 22 | |||
594 | 23 | // local | ||
595 | 24 | #include "qdeclarativeinputdevicemodel_p.h" | ||
596 | 25 | |||
597 | 26 | void InputInfoPlugin::registerTypes(const char *uri) | ||
598 | 27 | { | ||
599 | 28 | int major = 0; | ||
600 | 29 | int minor = 1; | ||
601 | 30 | qmlRegisterType<QDeclarativeInputDeviceModel>(uri, major, minor, "InputDeviceModel"); | ||
602 | 31 | qmlRegisterType<QInputDevice>(uri, major, minor, "InputInfo"); | ||
603 | 32 | } | ||
604 | 0 | 33 | ||
605 | === added file 'src/app/unity8/plugins/Unity/InputInfo/plugin.h' | |||
606 | --- src/app/unity8/plugins/Unity/InputInfo/plugin.h 1970-01-01 00:00:00 +0000 | |||
607 | +++ src/app/unity8/plugins/Unity/InputInfo/plugin.h 2016-01-29 09:32:29 +0000 | |||
608 | @@ -0,0 +1,30 @@ | |||
609 | 1 | /* | ||
610 | 2 | * Copyright 2015 Canonical Ltd. | ||
611 | 3 | * | ||
612 | 4 | * This program is free software; you can redistribute it and/or modify | ||
613 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
614 | 6 | * the Free Software Foundation; version 3. | ||
615 | 7 | * | ||
616 | 8 | * This program is distributed in the hope that it will be useful, | ||
617 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
618 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
619 | 11 | * GNU Lesser General Public License for more details. | ||
620 | 12 | * | ||
621 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
622 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
623 | 15 | */ | ||
624 | 16 | |||
625 | 17 | #ifndef INPUTINFO_PLUGIN_H | ||
626 | 18 | #define INPUTINFO_PLUGIN_H | ||
627 | 19 | |||
628 | 20 | #include <QtQml/QQmlExtensionPlugin> | ||
629 | 21 | |||
630 | 22 | class InputInfoPlugin : public QQmlExtensionPlugin | ||
631 | 23 | { | ||
632 | 24 | Q_OBJECT | ||
633 | 25 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
634 | 26 | public: | ||
635 | 27 | void registerTypes(const char *uri); | ||
636 | 28 | }; | ||
637 | 29 | |||
638 | 30 | #endif // INPUTINFO_PLUGIN_H | ||
639 | 0 | 31 | ||
640 | === added file 'src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel.cpp' | |||
641 | --- src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel.cpp 1970-01-01 00:00:00 +0000 | |||
642 | +++ src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel.cpp 2016-01-29 09:32:29 +0000 | |||
643 | @@ -0,0 +1,196 @@ | |||
644 | 1 | /**************************************************************************** | ||
645 | 2 | ** | ||
646 | 3 | ** Copyright (C) 2015 Jolla. | ||
647 | 4 | ** Contact: http://www.qt-project.org/legal | ||
648 | 5 | ** | ||
649 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
650 | 7 | ** | ||
651 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
652 | 9 | ** Commercial License Usage | ||
653 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
654 | 11 | ** accordance with the commercial license agreement provided with the | ||
655 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
656 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
657 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
658 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
659 | 16 | ** | ||
660 | 17 | ** GNU Lesser General Public License Usage | ||
661 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
662 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
663 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
664 | 21 | ** packaging of this file. Please review the following information to | ||
665 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
666 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
667 | 24 | ** | ||
668 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
669 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
670 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
671 | 28 | ** | ||
672 | 29 | ** GNU General Public License Usage | ||
673 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
674 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
675 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
676 | 33 | ** packaging of this file. Please review the following information to | ||
677 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
678 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
679 | 36 | ** | ||
680 | 37 | ** | ||
681 | 38 | ** $QT_END_LICENSE$ | ||
682 | 39 | ** | ||
683 | 40 | ****************************************************************************/ | ||
684 | 41 | #include "qdeclarativeinputdevicemodel_p.h" | ||
685 | 42 | #include "qinputinfo.h" | ||
686 | 43 | |||
687 | 44 | QDeclarativeInputDeviceModel::QDeclarativeInputDeviceModel(QObject *parent) : | ||
688 | 45 | QAbstractListModel(parent), | ||
689 | 46 | deviceInfo(new QInputDeviceManager), | ||
690 | 47 | currentFilter(QInputDevice::Unknown) | ||
691 | 48 | { | ||
692 | 49 | connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList())); | ||
693 | 50 | connect(deviceInfo, &QInputDeviceManager::deviceAdded,this,&QDeclarativeInputDeviceModel::addedDevice); | ||
694 | 51 | connect(deviceInfo, &QInputDeviceManager::deviceRemoved,this,&QDeclarativeInputDeviceModel::removedDevice); | ||
695 | 52 | } | ||
696 | 53 | |||
697 | 54 | QDeclarativeInputDeviceModel::~QDeclarativeInputDeviceModel() | ||
698 | 55 | { | ||
699 | 56 | delete deviceInfo; | ||
700 | 57 | } | ||
701 | 58 | |||
702 | 59 | QVariant QDeclarativeInputDeviceModel::data(const QModelIndex &index, int role) const | ||
703 | 60 | { | ||
704 | 61 | switch (role) { | ||
705 | 62 | case ServiceRole: | ||
706 | 63 | return QVariant::fromValue(static_cast<QObject *>(inputDevices.value(index.row()))); | ||
707 | 64 | break; | ||
708 | 65 | case NameRole: | ||
709 | 66 | return QVariant::fromValue(static_cast<QString>(inputDevices.value(index.row())->name())); | ||
710 | 67 | break; | ||
711 | 68 | case DevicePathRole: | ||
712 | 69 | return QVariant::fromValue(static_cast<QString>(inputDevices.value(index.row())->devicePath())); | ||
713 | 70 | break; | ||
714 | 71 | case ButtonsRole: | ||
715 | 72 | return QVariant::fromValue(static_cast<QList <int> >(inputDevices.value(index.row())->buttons())); | ||
716 | 73 | break; | ||
717 | 74 | case SwitchesRole: | ||
718 | 75 | return QVariant::fromValue(static_cast<QList <int> >(inputDevices.value(index.row())->switches())); | ||
719 | 76 | break; | ||
720 | 77 | case RelativeAxisRole: | ||
721 | 78 | return QVariant::fromValue(static_cast<QList <int> >(inputDevices.value(index.row())->relativeAxis())); | ||
722 | 79 | break; | ||
723 | 80 | case AbsoluteAxisRole: | ||
724 | 81 | return QVariant::fromValue(static_cast<QList <int> >(inputDevices.value(index.row())->absoluteAxis())); | ||
725 | 82 | break; | ||
726 | 83 | case TypesRole: | ||
727 | 84 | return QVariant::fromValue(static_cast<int>(inputDevices.value(index.row())->type())); | ||
728 | 85 | break; | ||
729 | 86 | }; | ||
730 | 87 | |||
731 | 88 | return QVariant(); | ||
732 | 89 | } | ||
733 | 90 | |||
734 | 91 | int QDeclarativeInputDeviceModel::rowCount(const QModelIndex &parent) const | ||
735 | 92 | { | ||
736 | 93 | Q_UNUSED(parent); | ||
737 | 94 | |||
738 | 95 | return inputDevices.count(); | ||
739 | 96 | } | ||
740 | 97 | |||
741 | 98 | int QDeclarativeInputDeviceModel::indexOf(const QString &devicePath) const | ||
742 | 99 | { | ||
743 | 100 | int idx(-1); | ||
744 | 101 | Q_FOREACH (QInputDevice *device, inputDevices) { | ||
745 | 102 | idx++; | ||
746 | 103 | if (device->devicePath() == devicePath) return idx; | ||
747 | 104 | } | ||
748 | 105 | |||
749 | 106 | return -1; | ||
750 | 107 | } | ||
751 | 108 | |||
752 | 109 | QInputDevice *QDeclarativeInputDeviceModel::get(int index) const | ||
753 | 110 | { | ||
754 | 111 | if (index < 0 || index > inputDevices.count()) | ||
755 | 112 | return 0; | ||
756 | 113 | return inputDevices.value(index); | ||
757 | 114 | } | ||
758 | 115 | |||
759 | 116 | void QDeclarativeInputDeviceModel::updateDeviceList() | ||
760 | 117 | { | ||
761 | 118 | QVector <QInputDevice *> newDevices = deviceInfo->deviceListOfType(currentFilter); | ||
762 | 119 | |||
763 | 120 | int numNew = newDevices.count(); | ||
764 | 121 | |||
765 | 122 | for (int i = 0; i < numNew; i++) { | ||
766 | 123 | int j = inputDevices.indexOf(newDevices.value(i)); | ||
767 | 124 | |||
768 | 125 | if (j == -1) { | ||
769 | 126 | beginInsertRows(QModelIndex(), i, i); | ||
770 | 127 | inputDevices.insert(i, newDevices.value(i)); | ||
771 | 128 | endInsertRows(); | ||
772 | 129 | Q_EMIT countChanged(); | ||
773 | 130 | } else if (i != j) { | ||
774 | 131 | // changed its position -> move it | ||
775 | 132 | QInputDevice* device = inputDevices.value(j); | ||
776 | 133 | beginMoveRows(QModelIndex(), j, j, QModelIndex(), i); | ||
777 | 134 | inputDevices.remove(j); | ||
778 | 135 | inputDevices.insert(i, device); | ||
779 | 136 | endMoveRows(); | ||
780 | 137 | Q_EMIT countChanged(); | ||
781 | 138 | } //else { | ||
782 | 139 | QModelIndex changedIndex(this->index(j, 0, QModelIndex())); | ||
783 | 140 | Q_EMIT dataChanged(changedIndex, changedIndex); | ||
784 | 141 | } | ||
785 | 142 | |||
786 | 143 | int numOld = inputDevices.count(); | ||
787 | 144 | if (numOld > numNew) { | ||
788 | 145 | beginRemoveRows(QModelIndex(), numNew, numOld - 1); | ||
789 | 146 | inputDevices.remove(numNew, numOld - numNew); | ||
790 | 147 | endRemoveRows(); | ||
791 | 148 | Q_EMIT countChanged(); | ||
792 | 149 | } | ||
793 | 150 | } | ||
794 | 151 | |||
795 | 152 | void QDeclarativeInputDeviceModel::addedDevice(const QString &devicePath) | ||
796 | 153 | { | ||
797 | 154 | updateDeviceList(); | ||
798 | 155 | Q_EMIT deviceAdded(devicePath); | ||
799 | 156 | } | ||
800 | 157 | |||
801 | 158 | void QDeclarativeInputDeviceModel::removedDevice(const QString &devicePath) | ||
802 | 159 | { | ||
803 | 160 | updateDeviceList(); | ||
804 | 161 | Q_EMIT deviceRemoved(devicePath); | ||
805 | 162 | } | ||
806 | 163 | |||
807 | 164 | QHash<int,QByteArray> QDeclarativeInputDeviceModel::roleNames() const | ||
808 | 165 | { | ||
809 | 166 | QHash<int, QByteArray> roles; | ||
810 | 167 | roles[NameRole] = "name"; | ||
811 | 168 | roles[DevicePathRole] = "devicePath"; | ||
812 | 169 | roles[ButtonsRole] = "buttons"; | ||
813 | 170 | roles[SwitchesRole] = "switches"; | ||
814 | 171 | roles[RelativeAxisRole] = "rAxis"; | ||
815 | 172 | roles[AbsoluteAxisRole] = "aAxis"; | ||
816 | 173 | roles[TypesRole] = "types"; | ||
817 | 174 | return roles; | ||
818 | 175 | } | ||
819 | 176 | |||
820 | 177 | /* | ||
821 | 178 | * Returns the currently set device filter. | ||
822 | 179 | * */ | ||
823 | 180 | QInputDevice::InputType QDeclarativeInputDeviceModel::deviceFilter() | ||
824 | 181 | { | ||
825 | 182 | return currentFilter; | ||
826 | 183 | } | ||
827 | 184 | |||
828 | 185 | /* | ||
829 | 186 | * Sets the current input device filter to filter. | ||
830 | 187 | * */ | ||
831 | 188 | void QDeclarativeInputDeviceModel::setDeviceFilter(QInputDevice::InputType filter) | ||
832 | 189 | { | ||
833 | 190 | if (filter != currentFilter) { | ||
834 | 191 | deviceInfo->setDeviceFilter(filter); | ||
835 | 192 | currentFilter = filter; | ||
836 | 193 | updateDeviceList(); | ||
837 | 194 | Q_EMIT deviceFilterChanged(filter); | ||
838 | 195 | } | ||
839 | 196 | } | ||
840 | 0 | 197 | ||
841 | === added file 'src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel_p.h' | |||
842 | --- src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel_p.h 1970-01-01 00:00:00 +0000 | |||
843 | +++ src/app/unity8/plugins/Unity/InputInfo/qdeclarativeinputdevicemodel_p.h 2016-01-29 09:32:29 +0000 | |||
844 | @@ -0,0 +1,102 @@ | |||
845 | 1 | /**************************************************************************** | ||
846 | 2 | ** | ||
847 | 3 | ** Copyright (C) 2015 Jolla. | ||
848 | 4 | ** Contact: http://www.qt-project.org/legal | ||
849 | 5 | ** | ||
850 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
851 | 7 | ** | ||
852 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
853 | 9 | ** Commercial License Usage | ||
854 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
855 | 11 | ** accordance with the commercial license agreement provided with the | ||
856 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
857 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
858 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
859 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
860 | 16 | ** | ||
861 | 17 | ** GNU Lesser General Public License Usage | ||
862 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
863 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
864 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
865 | 21 | ** packaging of this file. Please review the following information to | ||
866 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
867 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
868 | 24 | ** | ||
869 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
870 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
871 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
872 | 28 | ** | ||
873 | 29 | ** GNU General Public License Usage | ||
874 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
875 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
876 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
877 | 33 | ** packaging of this file. Please review the following information to | ||
878 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
879 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
880 | 36 | ** | ||
881 | 37 | ** | ||
882 | 38 | ** $QT_END_LICENSE$ | ||
883 | 39 | ** | ||
884 | 40 | ****************************************************************************/ | ||
885 | 41 | |||
886 | 42 | #ifndef QDECLARATIVEINPUTDEVICEMODEL_H | ||
887 | 43 | #define QDECLARATIVEINPUTDEVICEMODEL_H | ||
888 | 44 | |||
889 | 45 | #include <QObject> | ||
890 | 46 | #include <QAbstractListModel> | ||
891 | 47 | #include "qinputinfo.h" | ||
892 | 48 | |||
893 | 49 | class QDeclarativeInputDeviceModel : public QAbstractListModel | ||
894 | 50 | { | ||
895 | 51 | Q_OBJECT | ||
896 | 52 | Q_DISABLE_COPY(QDeclarativeInputDeviceModel) | ||
897 | 53 | Q_PROPERTY(QInputDevice::InputType deviceFilter READ deviceFilter WRITE setDeviceFilter NOTIFY deviceFilterChanged) | ||
898 | 54 | |||
899 | 55 | Q_PROPERTY(int count READ rowCount NOTIFY countChanged) | ||
900 | 56 | |||
901 | 57 | public: | ||
902 | 58 | enum ItemRoles { | ||
903 | 59 | ServiceRole = Qt::UserRole + 1, | ||
904 | 60 | NameRole, | ||
905 | 61 | DevicePathRole, | ||
906 | 62 | ButtonsRole, | ||
907 | 63 | SwitchesRole, | ||
908 | 64 | RelativeAxisRole, | ||
909 | 65 | AbsoluteAxisRole, | ||
910 | 66 | TypesRole | ||
911 | 67 | }; | ||
912 | 68 | |||
913 | 69 | explicit QDeclarativeInputDeviceModel(QObject *parent = 0); | ||
914 | 70 | virtual ~QDeclarativeInputDeviceModel(); | ||
915 | 71 | |||
916 | 72 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | ||
917 | 73 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | ||
918 | 74 | |||
919 | 75 | void setDeviceFilter(QInputDevice::InputType filter); | ||
920 | 76 | QInputDevice::InputType deviceFilter(); | ||
921 | 77 | |||
922 | 78 | Q_INVOKABLE int indexOf(const QString &devicePath) const; | ||
923 | 79 | |||
924 | 80 | Q_INVOKABLE QInputDevice *get(int index) const; | ||
925 | 81 | QHash<int, QByteArray> roleNames() const; | ||
926 | 82 | |||
927 | 83 | Q_SIGNALS: | ||
928 | 84 | void deviceAdded(const QString &devicePath); | ||
929 | 85 | void deviceRemoved(const QString &devicePath); | ||
930 | 86 | void deviceFilterChanged(const QInputDevice::InputType filter); | ||
931 | 87 | void countChanged(); | ||
932 | 88 | |||
933 | 89 | public Q_SLOTS: | ||
934 | 90 | void updateDeviceList(); | ||
935 | 91 | private: | ||
936 | 92 | QInputDeviceManager *deviceInfo; | ||
937 | 93 | QVector<QInputDevice *> inputDevices; | ||
938 | 94 | QInputDevice::InputType currentFilter; | ||
939 | 95 | |||
940 | 96 | private Q_SLOTS: | ||
941 | 97 | void addedDevice(const QString &); | ||
942 | 98 | void removedDevice(const QString &path); | ||
943 | 99 | |||
944 | 100 | }; | ||
945 | 101 | |||
946 | 102 | #endif // QDECLARATIVEINPUTDEVICEMODEL_H | ||
947 | 0 | 103 | ||
948 | === added file 'src/app/unity8/plugins/Unity/InputInfo/qinputinfo.cpp' | |||
949 | --- src/app/unity8/plugins/Unity/InputInfo/qinputinfo.cpp 1970-01-01 00:00:00 +0000 | |||
950 | +++ src/app/unity8/plugins/Unity/InputInfo/qinputinfo.cpp 2016-01-29 09:32:29 +0000 | |||
951 | @@ -0,0 +1,270 @@ | |||
952 | 1 | /**************************************************************************** | ||
953 | 2 | ** | ||
954 | 3 | ** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). | ||
955 | 4 | ** Contact: http://www.qt-project.org/legal | ||
956 | 5 | ** | ||
957 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
958 | 7 | ** | ||
959 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
960 | 9 | ** Commercial License Usage | ||
961 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
962 | 11 | ** accordance with the commercial license agreement provided with the | ||
963 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
964 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
965 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
966 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
967 | 16 | ** | ||
968 | 17 | ** GNU Lesser General Public License Usage | ||
969 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
970 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
971 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
972 | 21 | ** packaging of this file. Please review the following information to | ||
973 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
974 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
975 | 24 | ** | ||
976 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
977 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
978 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
979 | 28 | ** | ||
980 | 29 | ** GNU General Public License Usage | ||
981 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
982 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
983 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
984 | 33 | ** packaging of this file. Please review the following information to | ||
985 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
986 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
987 | 36 | ** | ||
988 | 37 | ** | ||
989 | 38 | ** $QT_END_LICENSE$ | ||
990 | 39 | ** | ||
991 | 40 | ****************************************************************************/ | ||
992 | 41 | |||
993 | 42 | #include "qinputinfo.h" | ||
994 | 43 | |||
995 | 44 | #if defined(UNITY_MOCKS) | ||
996 | 45 | #include "qinputdeviceinfo_mock_p.h" | ||
997 | 46 | #elif defined(Q_OS_LINUX) | ||
998 | 47 | #include "linux/qinputdeviceinfo_linux_p.h" | ||
999 | 48 | #endif | ||
1000 | 49 | |||
1001 | 50 | Q_GLOBAL_STATIC(QInputDeviceManagerPrivate, inputDeviceManagerPrivate) | ||
1002 | 51 | |||
1003 | 52 | QT_BEGIN_NAMESPACE | ||
1004 | 53 | |||
1005 | 54 | QInputDeviceManagerPrivate * QInputDeviceManagerPrivate::instance() | ||
1006 | 55 | { | ||
1007 | 56 | QInputDeviceManagerPrivate *priv = inputDeviceManagerPrivate(); | ||
1008 | 57 | return priv; | ||
1009 | 58 | } | ||
1010 | 59 | |||
1011 | 60 | QInputDevicePrivate::QInputDevicePrivate(QObject *parent) : | ||
1012 | 61 | QObject(parent), | ||
1013 | 62 | type(QInputDevice::Unknown) | ||
1014 | 63 | { | ||
1015 | 64 | } | ||
1016 | 65 | |||
1017 | 66 | QInputDevice::QInputDevice(QObject *parent) : | ||
1018 | 67 | QObject(parent), | ||
1019 | 68 | d_ptr(new QInputDevicePrivate(this)) | ||
1020 | 69 | { | ||
1021 | 70 | } | ||
1022 | 71 | |||
1023 | 72 | /* | ||
1024 | 73 | * Returns the name of this input device. | ||
1025 | 74 | */ | ||
1026 | 75 | QString QInputDevice::name() const | ||
1027 | 76 | { | ||
1028 | 77 | return d_ptr->name; | ||
1029 | 78 | } | ||
1030 | 79 | |||
1031 | 80 | /* | ||
1032 | 81 | * Sets the name of this input device to \b name. | ||
1033 | 82 | */ | ||
1034 | 83 | void QInputDevice::setName(const QString &name) | ||
1035 | 84 | { | ||
1036 | 85 | d_ptr->name = name; | ||
1037 | 86 | } | ||
1038 | 87 | |||
1039 | 88 | /* | ||
1040 | 89 | * Returns the device path of this device. | ||
1041 | 90 | */ | ||
1042 | 91 | QString QInputDevice::devicePath() const | ||
1043 | 92 | { | ||
1044 | 93 | return d_ptr->devicePath; | ||
1045 | 94 | } | ||
1046 | 95 | |||
1047 | 96 | /* | ||
1048 | 97 | * Sets the device ppath of this device to /b path. | ||
1049 | 98 | */ | ||
1050 | 99 | void QInputDevice::setDevicePath(const QString &path) | ||
1051 | 100 | { | ||
1052 | 101 | d_ptr->devicePath = path; | ||
1053 | 102 | } | ||
1054 | 103 | |||
1055 | 104 | /* | ||
1056 | 105 | * Returns the number of buttons this device has. | ||
1057 | 106 | */ | ||
1058 | 107 | QList <int> QInputDevice::buttons() const | ||
1059 | 108 | { | ||
1060 | 109 | return d_ptr->buttons; | ||
1061 | 110 | } | ||
1062 | 111 | |||
1063 | 112 | /* | ||
1064 | 113 | * Adds a button | ||
1065 | 114 | */ | ||
1066 | 115 | void QInputDevice::addButton(int buttonCode) | ||
1067 | 116 | { | ||
1068 | 117 | d_ptr->buttons.append(buttonCode); | ||
1069 | 118 | } | ||
1070 | 119 | |||
1071 | 120 | /* | ||
1072 | 121 | * Returns the number of switch of this device. | ||
1073 | 122 | */ | ||
1074 | 123 | QList <int> QInputDevice::switches() const | ||
1075 | 124 | { | ||
1076 | 125 | return d_ptr->switches; | ||
1077 | 126 | } | ||
1078 | 127 | |||
1079 | 128 | /* | ||
1080 | 129 | * Adds a switch | ||
1081 | 130 | */ | ||
1082 | 131 | void QInputDevice::addSwitch(int switchCode) | ||
1083 | 132 | { | ||
1084 | 133 | d_ptr->switches.append(switchCode); | ||
1085 | 134 | } | ||
1086 | 135 | |||
1087 | 136 | /* | ||
1088 | 137 | * Returns a list of the relative axis of this device | ||
1089 | 138 | */ | ||
1090 | 139 | QList <int> QInputDevice::relativeAxis() const | ||
1091 | 140 | { | ||
1092 | 141 | return d_ptr->relativeAxis; | ||
1093 | 142 | } | ||
1094 | 143 | |||
1095 | 144 | /* | ||
1096 | 145 | */ | ||
1097 | 146 | void QInputDevice::addRelativeAxis(int axisCode) | ||
1098 | 147 | { | ||
1099 | 148 | d_ptr->relativeAxis.append(axisCode); | ||
1100 | 149 | } | ||
1101 | 150 | |||
1102 | 151 | /* | ||
1103 | 152 | * Returns a list of the absolute axis of this device | ||
1104 | 153 | */ | ||
1105 | 154 | QList <int> QInputDevice::absoluteAxis() const | ||
1106 | 155 | { | ||
1107 | 156 | return d_ptr->absoluteAxis; | ||
1108 | 157 | } | ||
1109 | 158 | |||
1110 | 159 | /* | ||
1111 | 160 | */ | ||
1112 | 161 | void QInputDevice::addAbsoluteAxis(int axisCode) | ||
1113 | 162 | { | ||
1114 | 163 | d_ptr->absoluteAxis.append(axisCode); | ||
1115 | 164 | } | ||
1116 | 165 | |||
1117 | 166 | /* | ||
1118 | 167 | * Returns a QInputDevice::InputTypeFlags of all the types of types. | ||
1119 | 168 | */ | ||
1120 | 169 | QInputDevice::InputTypeFlags QInputDevice::type() const | ||
1121 | 170 | { | ||
1122 | 171 | return d_ptr->type; | ||
1123 | 172 | } | ||
1124 | 173 | |||
1125 | 174 | /* | ||
1126 | 175 | */ | ||
1127 | 176 | void QInputDevice::setType(QInputDevice::InputTypeFlags type) //? setTypes? | ||
1128 | 177 | { | ||
1129 | 178 | d_ptr->type = type; | ||
1130 | 179 | } | ||
1131 | 180 | |||
1132 | 181 | QInputDeviceManager::QInputDeviceManager(QObject *parent) : | ||
1133 | 182 | QObject(parent), | ||
1134 | 183 | d_ptr(inputDeviceManagerPrivate) | ||
1135 | 184 | { | ||
1136 | 185 | connect(d_ptr, &QInputDeviceManagerPrivate::deviceAdded,this,&QInputDeviceManager::addedDevice); | ||
1137 | 186 | connect(d_ptr, &QInputDeviceManagerPrivate::deviceRemoved,this,&QInputDeviceManager::deviceRemoved); | ||
1138 | 187 | |||
1139 | 188 | connect(d_ptr,SIGNAL(ready()),this,SIGNAL(ready())); | ||
1140 | 189 | } | ||
1141 | 190 | |||
1142 | 191 | /* | ||
1143 | 192 | * Returns a QMap of known input devices. | ||
1144 | 193 | */ | ||
1145 | 194 | QMap <QString, QInputDevice *> QInputDeviceManager::deviceMap() | ||
1146 | 195 | { | ||
1147 | 196 | return d_ptr->deviceMap; | ||
1148 | 197 | } | ||
1149 | 198 | |||
1150 | 199 | /* | ||
1151 | 200 | */ | ||
1152 | 201 | void QInputDeviceManager::addedDevice(const QString & devicePath) | ||
1153 | 202 | { | ||
1154 | 203 | Q_EMIT deviceAdded(devicePath); | ||
1155 | 204 | } | ||
1156 | 205 | |||
1157 | 206 | /* | ||
1158 | 207 | * Returns a QVector of InputDevices of type filter | ||
1159 | 208 | * */ | ||
1160 | 209 | QVector <QInputDevice *> QInputDeviceManager::deviceListOfType(QInputDevice::InputType filter) | ||
1161 | 210 | { | ||
1162 | 211 | QVector <QInputDevice *> dList; | ||
1163 | 212 | QMapIterator<QString, QInputDevice *> i(d_ptr->deviceMap); | ||
1164 | 213 | while (i.hasNext()) { | ||
1165 | 214 | i.next(); | ||
1166 | 215 | if (i.value()->type().testFlag(filter) || filter == QInputDevice::Unknown) { | ||
1167 | 216 | dList.append(i.value()); | ||
1168 | 217 | } | ||
1169 | 218 | } | ||
1170 | 219 | return dList; | ||
1171 | 220 | } | ||
1172 | 221 | |||
1173 | 222 | /* | ||
1174 | 223 | * Returns the number of input devices with the currently set QInputDevice::InputType filter. | ||
1175 | 224 | * If no device filter has been set, returns number of all available input devices. | ||
1176 | 225 | * If filter has not been set, returns all available input devices | ||
1177 | 226 | */ | ||
1178 | 227 | int QInputDeviceManager::deviceCount() const | ||
1179 | 228 | { | ||
1180 | 229 | return deviceCount(static_cast< QInputDevice::InputType >(d_ptr->currentFilter)); | ||
1181 | 230 | } | ||
1182 | 231 | |||
1183 | 232 | /* | ||
1184 | 233 | * Returns the number of input devices of the type filter. | ||
1185 | 234 | */ | ||
1186 | 235 | int QInputDeviceManager::deviceCount(const QInputDevice::InputType filter) const | ||
1187 | 236 | { | ||
1188 | 237 | int dList = 0; | ||
1189 | 238 | QMapIterator<QString, QInputDevice *> i(d_ptr->deviceMap); | ||
1190 | 239 | while (i.hasNext()) { | ||
1191 | 240 | i.next(); | ||
1192 | 241 | // qDebug() << i.value()->name() << i.value()->devicePath(); | ||
1193 | 242 | // qDebug() << i.value()->type() << i.value()->type().testFlag(filter); | ||
1194 | 243 | |||
1195 | 244 | if (i.value()->type().testFlag(filter)) { | ||
1196 | 245 | dList++; | ||
1197 | 246 | } | ||
1198 | 247 | } | ||
1199 | 248 | return dList; | ||
1200 | 249 | } | ||
1201 | 250 | |||
1202 | 251 | /* | ||
1203 | 252 | * Returns the currently set device filter. | ||
1204 | 253 | * */ | ||
1205 | 254 | QInputDevice::InputType QInputDeviceManager::deviceFilter() | ||
1206 | 255 | { | ||
1207 | 256 | return d_ptr->currentFilter; | ||
1208 | 257 | } | ||
1209 | 258 | |||
1210 | 259 | /* | ||
1211 | 260 | * Sets the current input device filter to filter. | ||
1212 | 261 | * */ | ||
1213 | 262 | void QInputDeviceManager::setDeviceFilter(QInputDevice::InputType filter) | ||
1214 | 263 | { | ||
1215 | 264 | if (filter != d_ptr->currentFilter) { | ||
1216 | 265 | d_ptr->currentFilter = filter; | ||
1217 | 266 | Q_EMIT deviceFilterChanged(filter); | ||
1218 | 267 | } | ||
1219 | 268 | } | ||
1220 | 269 | |||
1221 | 270 | QT_END_NAMESPACE | ||
1222 | 0 | 271 | ||
1223 | === added file 'src/app/unity8/plugins/Unity/InputInfo/qinputinfo.h' | |||
1224 | --- src/app/unity8/plugins/Unity/InputInfo/qinputinfo.h 1970-01-01 00:00:00 +0000 | |||
1225 | +++ src/app/unity8/plugins/Unity/InputInfo/qinputinfo.h 2016-01-29 09:32:29 +0000 | |||
1226 | @@ -0,0 +1,143 @@ | |||
1227 | 1 | /**************************************************************************** | ||
1228 | 2 | ** | ||
1229 | 3 | ** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). | ||
1230 | 4 | ** Contact: http://www.qt-project.org/legal | ||
1231 | 5 | ** | ||
1232 | 6 | ** This file is part of the QtSystems module of the Qt Toolkit. | ||
1233 | 7 | ** | ||
1234 | 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||
1235 | 9 | ** Commercial License Usage | ||
1236 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||
1237 | 11 | ** accordance with the commercial license agreement provided with the | ||
1238 | 12 | ** Software or, alternatively, in accordance with the terms contained in | ||
1239 | 13 | ** a written agreement between you and Digia. For licensing terms and | ||
1240 | 14 | ** conditions see http://qt.digia.com/licensing. For further information | ||
1241 | 15 | ** use the contact form at http://qt.digia.com/contact-us. | ||
1242 | 16 | ** | ||
1243 | 17 | ** GNU Lesser General Public License Usage | ||
1244 | 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||
1245 | 19 | ** General Public License version 2.1 as published by the Free Software | ||
1246 | 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | ||
1247 | 21 | ** packaging of this file. Please review the following information to | ||
1248 | 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | ||
1249 | 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | ||
1250 | 24 | ** | ||
1251 | 25 | ** In addition, as a special exception, Digia gives you certain additional | ||
1252 | 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | ||
1253 | 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | ||
1254 | 28 | ** | ||
1255 | 29 | ** GNU General Public License Usage | ||
1256 | 30 | ** Alternatively, this file may be used under the terms of the GNU | ||
1257 | 31 | ** General Public License version 3.0 as published by the Free Software | ||
1258 | 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
1259 | 33 | ** packaging of this file. Please review the following information to | ||
1260 | 34 | ** ensure the GNU General Public License version 3.0 requirements will be | ||
1261 | 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | ||
1262 | 36 | ** | ||
1263 | 37 | ** | ||
1264 | 38 | ** $QT_END_LICENSE$ | ||
1265 | 39 | ** | ||
1266 | 40 | ****************************************************************************/ | ||
1267 | 41 | |||
1268 | 42 | #ifndef QINPUTINFO_H | ||
1269 | 43 | #define QINPUTINFO_H | ||
1270 | 44 | |||
1271 | 45 | #include <QObject> | ||
1272 | 46 | #include <QVector> | ||
1273 | 47 | #include <QMap> | ||
1274 | 48 | #include <QSocketNotifier> | ||
1275 | 49 | #include <QDebug> | ||
1276 | 50 | |||
1277 | 51 | class QInputDeviceManagerPrivate; | ||
1278 | 52 | class QInputDevicePrivate; | ||
1279 | 53 | class QInputDevice; | ||
1280 | 54 | |||
1281 | 55 | class QInputDeviceManager; | ||
1282 | 56 | |||
1283 | 57 | class QInputDevice : public QObject | ||
1284 | 58 | { | ||
1285 | 59 | Q_OBJECT | ||
1286 | 60 | Q_ENUMS(InputType) | ||
1287 | 61 | Q_FLAGS(InputType InputTypeFlags) | ||
1288 | 62 | friend class QInputDeviceManagerPrivate; | ||
1289 | 63 | |||
1290 | 64 | public: | ||
1291 | 65 | |||
1292 | 66 | enum InputType { | ||
1293 | 67 | Unknown = 0, | ||
1294 | 68 | Button = 1, | ||
1295 | 69 | Mouse = 2, | ||
1296 | 70 | TouchPad = 4, | ||
1297 | 71 | TouchScreen = 8, | ||
1298 | 72 | Keyboard = 16, | ||
1299 | 73 | Switch = 32 | ||
1300 | 74 | }; | ||
1301 | 75 | Q_ENUMS(InputType) | ||
1302 | 76 | Q_DECLARE_FLAGS(InputTypeFlags, InputType) | ||
1303 | 77 | |||
1304 | 78 | explicit QInputDevice(QObject *parent = 0); | ||
1305 | 79 | QString name() const; | ||
1306 | 80 | QString devicePath() const; | ||
1307 | 81 | QList <int> buttons() const; //keys event code | ||
1308 | 82 | QList <int> switches() const; | ||
1309 | 83 | QList <int> relativeAxis() const; | ||
1310 | 84 | QList <int> absoluteAxis() const; | ||
1311 | 85 | QInputDevice::InputTypeFlags type() const; | ||
1312 | 86 | |||
1313 | 87 | private: | ||
1314 | 88 | |||
1315 | 89 | QInputDevicePrivate *d_ptr; | ||
1316 | 90 | void setName(const QString &); | ||
1317 | 91 | void setDevicePath(const QString &); | ||
1318 | 92 | void addButton(int); | ||
1319 | 93 | void addSwitch(int); | ||
1320 | 94 | void addRelativeAxis(int); | ||
1321 | 95 | void addAbsoluteAxis(int); | ||
1322 | 96 | void setType(QInputDevice::InputTypeFlags flags); | ||
1323 | 97 | |||
1324 | 98 | }; | ||
1325 | 99 | |||
1326 | 100 | Q_DECLARE_METATYPE(QInputDevice::InputType) | ||
1327 | 101 | Q_DECLARE_METATYPE(QInputDevice::InputTypeFlags) | ||
1328 | 102 | |||
1329 | 103 | class QInputDeviceManagerPrivate; | ||
1330 | 104 | |||
1331 | 105 | class QInputDeviceManager : public QObject | ||
1332 | 106 | { | ||
1333 | 107 | Q_OBJECT | ||
1334 | 108 | Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged) | ||
1335 | 109 | Q_PROPERTY(QInputDevice::InputType deviceFilter READ deviceFilter WRITE setDeviceFilter NOTIFY deviceFilterChanged) | ||
1336 | 110 | public: | ||
1337 | 111 | |||
1338 | 112 | explicit QInputDeviceManager(QObject *parent = 0); | ||
1339 | 113 | |||
1340 | 114 | int deviceCount() const; | ||
1341 | 115 | int deviceCount(const QInputDevice::InputType filter) const; | ||
1342 | 116 | |||
1343 | 117 | void setDeviceFilter(QInputDevice::InputType filter); | ||
1344 | 118 | QInputDevice::InputType deviceFilter(); | ||
1345 | 119 | |||
1346 | 120 | QMap <QString, QInputDevice *> deviceMap(); | ||
1347 | 121 | Q_INVOKABLE QVector <QInputDevice *> deviceListOfType(QInputDevice::InputType filter); | ||
1348 | 122 | |||
1349 | 123 | Q_SIGNALS: | ||
1350 | 124 | |||
1351 | 125 | void deviceAdded(const QString & devicePath); | ||
1352 | 126 | void deviceRemoved(const QString & devicePath); | ||
1353 | 127 | |||
1354 | 128 | void ready(); | ||
1355 | 129 | void deviceCountChanged(int count); | ||
1356 | 130 | void deviceFilterChanged(const QInputDevice::InputType filter); | ||
1357 | 131 | |||
1358 | 132 | public Q_SLOTS: | ||
1359 | 133 | void addedDevice(const QString & devicePath); | ||
1360 | 134 | |||
1361 | 135 | private: | ||
1362 | 136 | Q_DISABLE_COPY(QInputDeviceManager) | ||
1363 | 137 | #if !defined(QT_SIMULATOR) | ||
1364 | 138 | QInputDeviceManagerPrivate *const d_ptr; | ||
1365 | 139 | Q_DECLARE_PRIVATE(QInputDeviceManager) | ||
1366 | 140 | #endif | ||
1367 | 141 | }; | ||
1368 | 142 | |||
1369 | 143 | #endif // QINPUTINFO_H | ||
1370 | 0 | 144 | ||
1371 | === added file 'src/app/unity8/plugins/Unity/InputInfo/qmldir' | |||
1372 | --- src/app/unity8/plugins/Unity/InputInfo/qmldir 1970-01-01 00:00:00 +0000 | |||
1373 | +++ src/app/unity8/plugins/Unity/InputInfo/qmldir 2016-01-29 09:32:29 +0000 | |||
1374 | @@ -0,0 +1,3 @@ | |||
1375 | 1 | module Unity.InputInfo | ||
1376 | 2 | plugin InputInfo | ||
1377 | 3 | typeinfo InputInfo.qmltypes | ||
1378 | 0 | 4 | ||
1379 | === modified file 'src/app/webbrowser/Browser.qml' | |||
1380 | --- src/app/webbrowser/Browser.qml 2016-01-22 10:23:17 +0000 | |||
1381 | +++ src/app/webbrowser/Browser.qml 2016-01-29 09:32:29 +0000 | |||
1382 | @@ -22,6 +22,7 @@ | |||
1383 | 22 | import com.canonical.Oxide 1.8 as Oxide | 22 | import com.canonical.Oxide 1.8 as Oxide |
1384 | 23 | import Ubuntu.Components 1.3 | 23 | import Ubuntu.Components 1.3 |
1385 | 24 | import Ubuntu.Components.Popups 1.3 | 24 | import Ubuntu.Components.Popups 1.3 |
1386 | 25 | import Unity.InputInfo 0.1 | ||
1387 | 25 | import webbrowserapp.private 0.1 | 26 | import webbrowserapp.private 0.1 |
1388 | 26 | import webbrowsercommon.private 0.1 | 27 | import webbrowsercommon.private 0.1 |
1389 | 27 | import "../actions" as Actions | 28 | import "../actions" as Actions |
1390 | @@ -95,6 +96,16 @@ | |||
1391 | 95 | onMediaAccessPermissionRequested: PopupUtils.open(mediaAccessDialogComponent, null, { request: request }) | 96 | onMediaAccessPermissionRequested: PopupUtils.open(mediaAccessDialogComponent, null, { request: request }) |
1392 | 96 | } | 97 | } |
1393 | 97 | 98 | ||
1394 | 99 | InputDeviceModel { | ||
1395 | 100 | id: miceModel | ||
1396 | 101 | deviceFilter: InputInfo.Mouse | ||
1397 | 102 | } | ||
1398 | 103 | |||
1399 | 104 | InputDeviceModel { | ||
1400 | 105 | id: touchPadModel | ||
1401 | 106 | deviceFilter: InputInfo.TouchPad | ||
1402 | 107 | } | ||
1403 | 108 | |||
1404 | 98 | Component { | 109 | Component { |
1405 | 99 | id: mediaAccessDialogComponent | 110 | id: mediaAccessDialogComponent |
1406 | 100 | MediaAccessDialog { } | 111 | MediaAccessDialog { } |
1407 | @@ -181,7 +192,7 @@ | |||
1408 | 181 | right: parent.right | 192 | right: parent.right |
1409 | 182 | top: parent.top | 193 | top: parent.top |
1410 | 183 | } | 194 | } |
1412 | 184 | height: parent.height - osk.height | 195 | height: parent.height - osk.height - bottomEdgeBar.height |
1413 | 185 | 196 | ||
1414 | 186 | focus: !errorSheetLoader.focus && | 197 | focus: !errorSheetLoader.focus && |
1415 | 187 | !invalidCertificateErrorSheetLoader.focus && | 198 | !invalidCertificateErrorSheetLoader.focus && |
1416 | @@ -531,23 +542,6 @@ | |||
1417 | 531 | onTriggered: historyViewLoader.active = true | 542 | onTriggered: historyViewLoader.active = true |
1418 | 532 | }, | 543 | }, |
1419 | 533 | Action { | 544 | Action { |
1420 | 534 | objectName: "tabs" | ||
1421 | 535 | text: i18n.tr("Open tabs") | ||
1422 | 536 | iconName: "browser-tabs" | ||
1423 | 537 | enabled: (formFactor != "mobile") && !browser.wide | ||
1424 | 538 | onTriggered: { | ||
1425 | 539 | recentView.state = "shown" | ||
1426 | 540 | recentToolbar.state = "shown" | ||
1427 | 541 | } | ||
1428 | 542 | }, | ||
1429 | 543 | Action { | ||
1430 | 544 | objectName: "newtab" | ||
1431 | 545 | text: i18n.tr("New tab") | ||
1432 | 546 | iconName: browser.incognito ? "private-tab-new" : "tab-new" | ||
1433 | 547 | enabled: (formFactor != "mobile") && !browser.wide | ||
1434 | 548 | onTriggered: browser.openUrlInNewTab("", true) | ||
1435 | 549 | }, | ||
1436 | 550 | Action { | ||
1437 | 551 | objectName: "findinpage" | 545 | objectName: "findinpage" |
1438 | 552 | text: i18n.tr("Find in page") | 546 | text: i18n.tr("Find in page") |
1439 | 553 | iconName: "search" | 547 | iconName: "search" |
1440 | @@ -697,8 +691,8 @@ | |||
1441 | 697 | } | 691 | } |
1442 | 698 | height: units.gu(2) | 692 | height: units.gu(2) |
1443 | 699 | 693 | ||
1446 | 700 | enabled: (formFactor == "mobile") && !browser.wide && | 694 | enabled: !browser.wide && (recentView.state == "") && |
1447 | 701 | (recentView.state == "") && browser.currentWebview && | 695 | browser.currentWebview && |
1448 | 702 | (Screen.orientation == Screen.primaryOrientation) | 696 | (Screen.orientation == Screen.primaryOrientation) |
1449 | 703 | 697 | ||
1450 | 704 | onDraggingChanged: { | 698 | onDraggingChanged: { |
1451 | @@ -728,7 +722,7 @@ | |||
1452 | 728 | Image { | 722 | Image { |
1453 | 729 | id: bottomEdgeHint | 723 | id: bottomEdgeHint |
1454 | 730 | objectName: "bottomEdgeHint" | 724 | objectName: "bottomEdgeHint" |
1456 | 731 | source: (formFactor == "mobile") ? "assets/bottom_edge_hint.png" : "" | 725 | source: "assets/bottom_edge_hint.png" |
1457 | 732 | property bool forceShow: false | 726 | property bool forceShow: false |
1458 | 733 | anchors { | 727 | anchors { |
1459 | 734 | horizontalCenter: parent.horizontalCenter | 728 | horizontalCenter: parent.horizontalCenter |
1460 | @@ -738,7 +732,7 @@ | |||
1461 | 738 | UbuntuNumberAnimation {} | 732 | UbuntuNumberAnimation {} |
1462 | 739 | } | 733 | } |
1463 | 740 | } | 734 | } |
1465 | 741 | visible: bottomEdgeHandle.enabled | 735 | visible: bottomEdgeHandle.enabled && !internal.hasMouse |
1466 | 742 | opacity: recentView.visible ? 0 : 1 | 736 | opacity: recentView.visible ? 0 : 1 |
1467 | 743 | Behavior on opacity { | 737 | Behavior on opacity { |
1468 | 744 | UbuntuNumberAnimation {} | 738 | UbuntuNumberAnimation {} |
1469 | @@ -757,6 +751,40 @@ | |||
1470 | 757 | } | 751 | } |
1471 | 758 | } | 752 | } |
1472 | 759 | 753 | ||
1473 | 754 | MouseArea { | ||
1474 | 755 | id: bottomEdgeBar | ||
1475 | 756 | anchors { | ||
1476 | 757 | left: parent.left | ||
1477 | 758 | right: parent.right | ||
1478 | 759 | bottom: parent.bottom | ||
1479 | 760 | } | ||
1480 | 761 | enabled: !browser.wide && internal.hasMouse && | ||
1481 | 762 | (osk.state == "hidden") && (recentView.state == "") | ||
1482 | 763 | visible: enabled | ||
1483 | 764 | height: visible ? units.gu(4) : 0 | ||
1484 | 765 | |||
1485 | 766 | onClicked: { | ||
1486 | 767 | recentView.state = "shown" | ||
1487 | 768 | recentToolbar.state = "shown" | ||
1488 | 769 | } | ||
1489 | 770 | |||
1490 | 771 | Rectangle { | ||
1491 | 772 | anchors.fill: parent | ||
1492 | 773 | color: "#f7f7f7" | ||
1493 | 774 | border { | ||
1494 | 775 | width: units.dp(1) | ||
1495 | 776 | color: "#cdcdcd" | ||
1496 | 777 | } | ||
1497 | 778 | } | ||
1498 | 779 | |||
1499 | 780 | Label { | ||
1500 | 781 | anchors.centerIn: parent | ||
1501 | 782 | color: "#5d5d5d" | ||
1502 | 783 | // TRANSLATORS: %1 refers to the current number of tabs opened | ||
1503 | 784 | text: i18n.tr("(%1)").arg(tabsModel ? tabsModel.count : 0) | ||
1504 | 785 | } | ||
1505 | 786 | } | ||
1506 | 787 | |||
1507 | 760 | Loader { | 788 | Loader { |
1508 | 761 | id: bookmarksViewLoader | 789 | id: bookmarksViewLoader |
1509 | 762 | 790 | ||
1510 | @@ -1403,6 +1431,8 @@ | |||
1511 | 1403 | } | 1431 | } |
1512 | 1404 | } | 1432 | } |
1513 | 1405 | 1433 | ||
1514 | 1434 | readonly property bool hasMouse: (miceModel.count + touchPadModel.count) > 0 | ||
1515 | 1435 | |||
1516 | 1406 | function getOpenPages() { | 1436 | function getOpenPages() { |
1517 | 1407 | var urls = [] | 1437 | var urls = [] |
1518 | 1408 | for (var i = 0; i < tabsModel.count; i++) { | 1438 | for (var i = 0; i < tabsModel.count; i++) { |
FAILED: Continuous integration, rev:1331 jenkins. qa.ubuntu. com/job/ webbrowser- app-ci/ 2584/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 6239/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- amd64-ci/ 1337/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- armhf-ci/ 1337/console jenkins. qa.ubuntu. com/job/ webbrowser- app-vivid- i386-ci/ 1337/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 6250/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/webbrowser- app-ci/ 2584/rebuild
http://