Merge lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Stefano Verzegnassi
Approved revision: 192
Merged at revision: 193
Proposed branch: lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 146 lines (+35/-38)
5 files modified
debian/control (+1/-0)
src/app/qml/SettingsPage.qml (+0/-32)
src/app/qml/TerminalPage.qml (+2/-2)
src/app/qml/TerminalSettings.qml (+0/-4)
src/app/qml/ubuntu-terminal-app.qml (+32/-0)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Ubuntu Terminal Developers Pending
Review via email: mp+287985@code.launchpad.net

Commit message

Added a context property which allows terminal-app to know whether a keyboard or a mouse is attached to the device.

This is required to workaround a gap in the Ubuntu UI Toolkit, which makes impossible to use some of the new convergence features (e.g. bottom edge) in desktop mode.
This also allows us to automatically hide some components which are only useful in a context where only a touchscreen is available as input device.

Hopefully, this patch shouldn't be required anymore with OTA-11, when the support for devices detection will be available through UITK.

Description of the change

*** REQUIRES OTA-10 ***

Added a context property which allows terminal-app to know whether a keyboard or a mouse is attached to the device.

This is required to workaround a gap in the Ubuntu UI Toolkit, which makes impossible to use some of the new convergence features (e.g. bottom edge) in desktop mode.
This also allows us to automatically hide some components which are only useful in a context where only a touchscreen is available as input device.

Hopefully, this patch shouldn't be required anymore with OTA-11, when the support for devices detection will be available through UITK.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Code all looks reasonable to me, unfortunately, I can't test this as my Ubuntu is a tad messed up, and I don't have time to fix it before I leave for a trip.

192. By Stefano Verzegnassi

Removed keyboard bar setting. Automatically hide the bar by binding to QuickUtils.keyboardAttached instead.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

I hope managers will decide to fix these problems with unmaintained projects. For now, let's suppose there has been a tacit approval.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-07-04 08:43:12 +0000
3+++ debian/control 2016-04-05 13:26:21 +0000
4@@ -24,6 +24,7 @@
5 qtdeclarative5-pamauthentication0.1,
6 qtdeclarative5-qtquick2-plugin,
7 qtdeclarative5-ubuntu-ui-toolkit-plugin,
8+ qml-module-qtsysteminfo (>= 5.0~),
9 Description: Terminal application
10 Core Terminal application
11
12
13=== modified file 'src/app/qml/SettingsPage.qml'
14--- src/app/qml/SettingsPage.qml 2016-02-07 18:30:11 +0000
15+++ src/app/qml/SettingsPage.qml 2016-04-05 13:26:21 +0000
16@@ -52,38 +52,6 @@
17 }
18
19 ListItem {
20- ListItemLayout {
21- anchors.fill: parent
22- title.text: i18n.tr("Show Keyboard Bar")
23-
24- Switch {
25- id: keybBarSwitch
26- SlotsLayout.position: SlotsLayout.Trailing
27- onCheckedChanged: settings.showKeyboardBar = checked;
28- Component.onCompleted: checked = settings.showKeyboardBar;
29- }
30- }
31-
32- onClicked: keybBarSwitch.trigger()
33- }
34-
35- ListItem {
36- ListItemLayout {
37- anchors.fill: parent
38- title.text: i18n.tr("Show Keyboard Button")
39-
40- Switch {
41- id: keybButtonSwitch
42- SlotsLayout.position: SlotsLayout.Trailing
43- onCheckedChanged: settings.showKeyboardButton = checked;
44- Component.onCompleted: checked = settings.showKeyboardButton;
45- }
46- }
47-
48- onClicked: keybButtonSwitch.trigger()
49- }
50-
51- ListItem {
52 height: units.gu(13)
53
54 Label {
55
56=== modified file 'src/app/qml/TerminalPage.qml'
57--- src/app/qml/TerminalPage.qml 2016-03-03 23:14:40 +0000
58+++ src/app/qml/TerminalPage.qml 2016-04-05 13:26:21 +0000
59@@ -146,7 +146,7 @@
60 id: keyboardBarLoader
61 height: active ? units.gu(5) : 0
62 anchors {left: parent.left; right: parent.right}
63- active: settings.showKeyboardBar
64+ active: !QuickUtils.keyboardAttached
65
66 y: parent.height - height - Qt.inputMethod.keyboardRectangle.height
67 z: parent.z + 0.1
68@@ -227,7 +227,7 @@
69
70 Loader {
71 id: keyboardButton
72- active: settings.showKeyboardButton
73+ active: !QuickUtils.keyboardAttached
74 anchors {right: parent.right; margins: units.gu(1)}
75
76 y: parent.height - height - units.gu(1) - keyboardBarLoader.height
77
78=== modified file 'src/app/qml/TerminalSettings.qml'
79--- src/app/qml/TerminalSettings.qml 2016-02-06 18:09:05 +0000
80+++ src/app/qml/TerminalSettings.qml 2016-04-05 13:26:21 +0000
81@@ -8,8 +8,6 @@
82 property alias fontSize: innerSettings.fontSize
83 property alias fontStyle: innerSettings.fontStyle
84 property alias colorScheme: innerSettings.colorScheme
85- property alias showKeyboardBar: innerSettings.showKeyboardBar
86- property alias showKeyboardButton: innerSettings.showKeyboardButton
87
88 readonly property int defaultFontSize: 10
89 readonly property int minFontSize: 4
90@@ -39,8 +37,6 @@
91 property int fontSize: defaultFontSize
92 property string fontStyle: "Ubuntu Mono"
93 property string colorScheme: "Ubuntu"
94- property bool showKeyboardBar: true
95- property bool showKeyboardButton: true
96 property string jsonVisibleProfiles: "[]"
97 }
98
99
100=== modified file 'src/app/qml/ubuntu-terminal-app.qml'
101--- src/app/qml/ubuntu-terminal-app.qml 2016-03-06 00:27:33 +0000
102+++ src/app/qml/ubuntu-terminal-app.qml 2016-04-05 13:26:21 +0000
103@@ -5,6 +5,9 @@
104
105 import QMLTermWidget 1.0
106
107+// Mouse/Touchpad and keyboard support
108+import QtSystemInfo 5.5
109+
110 MainView {
111 // objectName for functional testing purposes (autopilot-qt5)
112 id: mview
113@@ -135,4 +138,33 @@
114 width = 80 * terminalPage.terminal.fontMetrics.width + 2
115 height = 24 * terminalPage.terminal.fontMetrics.height + 2
116 }
117+
118+ InputDeviceManager {
119+ id: keyboardsModel
120+ filter: InputInfo.Keyboard
121+ }
122+
123+ InputDeviceManager {
124+ id: miceModel
125+ filter: InputInfo.Mouse
126+ }
127+
128+ InputDeviceManager {
129+ id: touchpadsModel
130+ filter: InputInfo.TouchPad
131+ }
132+
133+ // WORKAROUND: Not yet implemented in the SDK
134+ Binding {
135+ target: QuickUtils
136+ property: "mouseAttached"
137+ value: miceModel.count > 0 || touchpadsModel.count > 0
138+ }
139+
140+ // WORKAROUND: Not yet implemented in the SDK
141+ Binding {
142+ target: QuickUtils
143+ property: "keyboardAttached"
144+ value: keyboardsModel.count > 0
145+ }
146 }

Subscribers

People subscribed via source and target branches