← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection into lp:ubuntu-terminal-app

 

Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection into lp:ubuntu-terminal-app.

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.

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
  Bug #1465975 in Ubuntu Terminal App: "Do not show the keyboard button if running on the desktop"
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1465975

For more details, see:
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-terminal-app/device-detection/+merge/287985

*** REQUIRES OTA-10 ***

QUESTION: Should we hide keyboardBar too, if a physical keyboard is connected?

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.
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-terminal-app/device-detection into lp:ubuntu-terminal-app.
=== modified file 'debian/control'
--- debian/control	2015-07-04 08:43:12 +0000
+++ debian/control	2016-03-15 14:20:39 +0000
@@ -24,6 +24,7 @@
          qtdeclarative5-pamauthentication0.1,
          qtdeclarative5-qtquick2-plugin,
          qtdeclarative5-ubuntu-ui-toolkit-plugin,
+         qml-module-qtsysteminfo (>= 5.0~),
 Description: Terminal application
  Core Terminal application
 

=== modified file 'src/app/qml/SettingsPage.qml'
--- src/app/qml/SettingsPage.qml	2016-02-07 18:30:11 +0000
+++ src/app/qml/SettingsPage.qml	2016-03-15 14:20:39 +0000
@@ -68,22 +68,6 @@
             }
 
             ListItem {
-                ListItemLayout {
-                    anchors.fill: parent
-                    title.text: i18n.tr("Show Keyboard Button")
-
-                    Switch {
-                        id: keybButtonSwitch
-                        SlotsLayout.position: SlotsLayout.Trailing
-                        onCheckedChanged: settings.showKeyboardButton = checked;
-                        Component.onCompleted: checked = settings.showKeyboardButton;
-                    }
-                }
-
-                onClicked: keybButtonSwitch.trigger()
-            }
-
-            ListItem {
                 height: units.gu(13)
 
                 Label {

=== modified file 'src/app/qml/TerminalPage.qml'
--- src/app/qml/TerminalPage.qml	2016-03-03 23:14:40 +0000
+++ src/app/qml/TerminalPage.qml	2016-03-15 14:20:39 +0000
@@ -227,7 +227,7 @@
 
     Loader {
         id: keyboardButton
-        active: settings.showKeyboardButton
+        active: !QuickUtils.keyboardAttached
         anchors {right: parent.right; margins: units.gu(1)}
 
         y: parent.height - height - units.gu(1) - keyboardBarLoader.height

=== modified file 'src/app/qml/TerminalSettings.qml'
--- src/app/qml/TerminalSettings.qml	2016-02-06 18:09:05 +0000
+++ src/app/qml/TerminalSettings.qml	2016-03-15 14:20:39 +0000
@@ -9,7 +9,6 @@
     property alias fontStyle: innerSettings.fontStyle
     property alias colorScheme: innerSettings.colorScheme
     property alias showKeyboardBar: innerSettings.showKeyboardBar
-    property alias showKeyboardButton: innerSettings.showKeyboardButton
 
     readonly property int defaultFontSize: 10
     readonly property int minFontSize: 4
@@ -40,7 +39,6 @@
         property string fontStyle: "Ubuntu Mono"
         property string colorScheme: "Ubuntu"
         property bool showKeyboardBar: true
-        property bool showKeyboardButton: true
         property string jsonVisibleProfiles: "[]"
     }
 

=== modified file 'src/app/qml/ubuntu-terminal-app.qml'
--- src/app/qml/ubuntu-terminal-app.qml	2016-03-06 00:27:33 +0000
+++ src/app/qml/ubuntu-terminal-app.qml	2016-03-15 14:20:39 +0000
@@ -5,6 +5,9 @@
 
 import QMLTermWidget 1.0
 
+// Mouse/Touchpad and keyboard support
+import QtSystemInfo 5.5
+
 MainView {
     // objectName for functional testing purposes (autopilot-qt5)
     id: mview
@@ -135,4 +138,33 @@
         width = 80 * terminalPage.terminal.fontMetrics.width + 2
         height = 24 * terminalPage.terminal.fontMetrics.height + 2
     }
+
+    InputDeviceManager {
+        id: keyboardsModel
+        filter: InputInfo.Keyboard
+    }
+
+    InputDeviceManager {
+        id: miceModel
+        filter: InputInfo.Mouse
+    }
+
+    InputDeviceManager {
+        id: touchpadsModel
+        filter: InputInfo.TouchPad
+    }
+
+    // WORKAROUND: Not yet implemented in the SDK
+    Binding {
+        target: QuickUtils
+        property: "mouseAttached"
+        value: miceModel.count > 0 || touchpadsModel.count > 0
+    }
+
+    // WORKAROUND: Not yet implemented in the SDK
+    Binding {
+        target: QuickUtils
+        property: "keyboardAttached"
+        value: keyboardsModel.count > 0
+    }
 }


Follow ups