Merge lp:~thomas-moenicke/ubuntu-keyboard/ubuntu-keyboard-qml-port into lp:ubuntu-keyboard
- ubuntu-keyboard-qml-port
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Bill Filler |
Approved revision: | 59 |
Merged at revision: | 33 |
Proposed branch: | lp:~thomas-moenicke/ubuntu-keyboard/ubuntu-keyboard-qml-port |
Merge into: | lp:ubuntu-keyboard |
Diff against target: |
3574 lines (+1960/-1171) 38 files modified
buildOnDevice.sh (+7/-3) qml/Keyboard.qml (+107/-272) qml/KeyboardContainer.qml (+90/-0) qml/images/keybg@18.sci (+5/-0) qml/images/keybg_action@18.sci (+5/-0) qml/keys/ActionKey.qml (+51/-0) qml/keys/BackspaceKey.qml (+24/-0) qml/keys/CharKey.qml (+160/-0) qml/keys/ExtendedKeysSelector.qml (+72/-0) qml/keys/KeyPad.qml (+83/-0) qml/keys/OneTwoKey.qml (+38/-0) qml/keys/Popper.qml (+13/-12) qml/keys/ReturnKey.qml (+23/-0) qml/keys/ShiftKey.qml (+43/-0) qml/keys/SpaceKey.qml (+24/-0) qml/keys/Spacer.qml (+26/-0) qml/keys/SymbolShiftKey.qml (+37/-0) qml/keys/key_constants.js (+47/-0) qml/languages/Keyboard_en_email.qml (+92/-0) qml/languages/Keyboard_en_url.qml (+94/-0) qml/languages/Keyboard_en_url_search.qml (+94/-0) qml/languages/Keyboard_en_us.qml (+90/-0) qml/languages/Keyboard_numbers.qml (+73/-0) qml/languages/Keyboard_symbols.qml (+95/-0) qml/languages/Keyboard_telephone.qml (+73/-0) qml/maliit-keyboard-extended.qml (+0/-49) qml/maliit-keyboard.qml (+0/-37) qml/maliit-magnifier.qml (+0/-36) qml/prototype.qmlproject (+21/-0) qml/qml.pro (+33/-2) src/lib/logic/eventhandler.cpp (+33/-0) src/lib/logic/eventhandler.h (+3/-0) src/plugin/inputmethod.cpp (+14/-564) src/plugin/inputmethod.h (+0/-18) src/plugin/inputmethod_p.h (+390/-0) src/plugin/maliitcontext.cpp (+0/-109) src/plugin/maliitcontext.h (+0/-67) src/plugin/plugin.pro (+0/-2) |
To merge this branch: | bzr merge lp:~thomas-moenicke/ubuntu-keyboard/ubuntu-keyboard-qml-port |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bill Filler (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Thomas Moenicke (community) | Abstain | ||
Review via email:
|
Commit message
language-layouts in QML
Description of the change
language-layouts in QML
Get rid of XML based language files and SW stack designed for QGraphicsView/Qt4. Languages can be described in QML like this:
Row {
CharKey { label: "q"; shifted: "Q"; }
CharKey { label: "w"; shifted: "W"; }
CharKey { label: "e"; shifted: "E"; extended: ["È","€"] }
CharKey { label: "r"; shifted: "R"; }
CharKey { label: "t"; shifted: "T"; }
CharKey { label: "y"; shifted: "Y"; }
CharKey { label: "u"; shifted: "U"; }
CharKey { label: "i"; shifted: "I"; }
CharKey { label: "o"; shifted: "O"; }
CharKey { label: "p"; shifted: "P"; }
}
- 22. By Thomas Moenicke
-
[ Gerry Boland ]
* Fix crash on Mir, actually disable broken functions when using Mir
(i.e. typo false -> true).
[ Ubuntu daily release ]
* Automatic snapshot from revision 31
[ Gerry Boland ]
* Fix platform detection, corrects OSK surface management with
platform-api. Fixes bug: 1217501. (LP: #1217501)
[ Ubuntu daily release ]
* Automatic snapshot from revision 29
[ Thomas Moenicke ]
* fixing size of magnifier to not being cut when shown in first row .
[ Ubuntu daily release ]
* Automatic snapshot from revision 27
[ Bill Filler ]
* adding autopilot test, and re-merge from trunk.
[ Gerry Boland ]
* Create UbuntuApplicationApiWrapper to consolidate the differences
between the ubuntu-application- api on SurfaceFlinger and Mir (some
portions of the API are deprecated, so not implemented on Mir).
Fixes crash on Mir-only platform.
[ Christopher Lee ]
* adding autopilot test, and re-merge from trunk.
[ Łukasz 'sil2100' Zemczak ]
* As pointed out by Sebastian, the package:any stanza is not really
valid - we already had to revert a similar change in the past.
[ Ubuntu daily release ]
* Automatic snapshot from revision 25
[ Gerry Boland ]
* Revert accidentally approved MR for revno 19, code needs review.
[ Ubuntu daily release ]
* Automatic snapshot from revision 21
[ Gerry Boland ]
* Create UbuntuApplicationApiWrapper to consolidate the differences
between SurfaceFlinger and Mir operations. Fixes crash on Mir-only
platform.
[ Ubuntu daily release ]
* Automatic snapshot from revision 19
[ Bill Filler ]
* revert code committed in rev 11 as it's causing regressions with
orientation (lp:1214575 and lp:1214578). (LP: #1214578, #1214575)
* Install server.conf file to replace the default keyboard, until the
config system is better handled later on.
* Removing unused styles.
[ Ubuntu daily release ]
* Automatic snapshot from revision 17
[ Gerry Boland ]
* Set name and role on OSK Window, helps unity8 shell identify the
window.
[ Ubuntu daily release ]
* Automatic snapshot from revision 13
[ Michael Terry ]
[ Thomas Moenicke ]
* added language directory path to coreutils. Maliit-Plugins stores
all languages in /usr/share/maliit/ plugins/ languages/ , but we
changed the language xml files as well, so they should be in a
plugin-related directory:
/usr/share/maliit/ plugins/ languages/ com/ubuntu/
* added qml unittests added .bzrignore file
* more work on buildsystem
* sync with latest trunk phablet maliit-plugins
* fixes in buildsystem
* fixed language directory fixed build script
* new style for magnifier.
* tracking contentOrientation of app, fixes bug.
[ root ]
* fixed tests to build with the new plugin cleanup bazaar repo
[ Ubuntu daily release ]
* Automatic snapshot from revision 11
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:22
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 23. By Thomas Moenicke
-
getting action keys working: return, backspace.
Typing a URL in browser now possible.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:23
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 24. By Thomas Moenicke
-
removed old qml which rendered xml keyboards
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:24
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 25. By Thomas Moenicke
-
removing obsolete code
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:25
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 26. By Thomas Moenicke
-
removed unused code: maliitcontext.cpp|h
moved inputmethod pimpl class to private header
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:26
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 27. By Thomas Moenicke
-
moved code for registering settings to private class
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:27
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 28. By Thomas Moenicke
-
added number layout
- 29. By Thomas Moenicke
-
adding url layout
- 30. By Thomas Moenicke
-
adding Telephone layout keyboard
- 31. By Thomas Moenicke
-
added url-search keyboard layout
- 32. By Thomas Moenicke
-
adding email keyboard layout
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:30
http://
Executed test runs:
FAILURE: 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 : | # |
PASSED: Continuous integration, rev:32
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 33. By Thomas Moenicke
-
adding loader to load different layouts according to activeView ids
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:33
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 34. By Thomas Moenicke
-
implemented extended keys using popover component from Ubuntu Components
added extended keys to layouts - 35. By Thomas Moenicke
-
fixed popper to work with new keyboard layouts
- 36. By Thomas Moenicke
-
action keys are a bit bigger, so they get a bit of extra padding
- 37. By Thomas Moenicke
-
fixed size of popper, using gu as it is independent of the layout
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:37
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Bill Filler (bfiller) wrote : | # |
General problems:
1) swiping within the keyboard should not make it move, only swiping from above. just like we fixed maliit keyboard to do.
2) key magnification is displayed partially behind the keys, press the "y" key to see what I mean. Should always be on top.
3) key magnifier shouldn't be displayed on special keys. we made this fix for maliit keyboard. spacebar, backspace, return, shift, other special keys..
4) key magnifier is cutoff on edges, try pressing "q" and "p" to see what I mean.
5) extended key popover should only be displayed if in fact the layout has extended keys. currently it's always displayed with an empty list if the key has no extended keys.
6) extended key popover not getting drawn correctly - even for keys that have extended characters (like a and e) I always see a transparent popover with no characters. just once I saw characters in it. It shouldn't be transparent either, should be solid.
7) extended key: when displaying the popover the key magnifier is still visible until you release your finger. key magnifier should be hidden as soon as popover is displayed. don't wait till key release.
US layout problems:
1) ?123 key graphic is too small
2) ABC key (after pressing ?123 key) graphic too small
3) when press ?123 key, the shift key shows both "up" arrow and "1/2" graphic. Should only show "1/2" graphic. Same with "2/2" key.
4) Can't type capital letters. Pressing the shift shows uppercase in the layout but lower case keys entered in input field
5) Caps lock doesn't work. I believe it use to be double clicking shift key would get you in caps-lock mode.
Url layout:
1) .com key graphic too big in landscape mode, it bleeds outside of key
2) the .com key is suppose to replace the spacebar key (see section 3.2 in https:/
3) the .com key is supposed to have extended key popovers for .co.uk, .net, .org, .edu, .gov, .ac.uk (see section 3.2)
4) the browser url field should use the url+search layout and the <input type="url"> should use url layout. What different input method hints are needed to support both of these?
Telephone number layout:
1) layout issues:
- need more space around left and right edges
- bottom row is not aligned with other rows (backspace key too big)
2) label for "+" key should be "+*#"
3) extended keys for "+*#" should show + * # ( )
Number layout:
1) Same issues as above 1) and 2)
2) . and - should be shown in extended keys
Email layout:
1) .com key too big and number key too small
- 38. By Thomas Moenicke
-
fixed submitting uppercase values when keypad is shifted
- 39. By Thomas Moenicke
-
fixed size of magnifier. this also fixes the issues of magnifier seen at the edges of the keyboard. magnifier does not draw outside the osk anymore
- 40. By Thomas Moenicke
-
keypad is not sensitive to swiping down gesture
- 41. By Thomas Moenicke
-
implemented CAPSLOCK state
- 42. By Thomas Moenicke
-
no magnifier for action keys and space bar
- 43. By Thomas Moenicke
-
when extended keys are shown, magnifier goes invisible
showing extended keys panel only when list not empty
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Günter Schwann (schwann) wrote : | # |
I'm entirely through, but here some minor issues
54 + //readonly property var layoutState: layout.
55 + //readonly property string activeView: layout.activeView
Dead code to be removed
359 + top: wordRibbon.bottom
360 + fill: parent
fill: parent should be enough
450 + width: 720
451 + height: 486
Hardcoded values look wrong to me - at least use the constants.js
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:43
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 44. By Thomas Moenicke
-
using url_search layout for url bar
action key icon only visible when no label
fixed font sizes for symbolshift and .com keys
added more tld extensions to .com key
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:44
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 45. By Thomas Moenicke
-
action key padding overwriteable (e.g. for number layouts it should be equally sized)
- 46. By Thomas Moenicke
-
using grid units for popover content
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:46
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Günter Schwann (schwann) wrote : | # |
868 + anchors.fill: parent
I thought the Popover adapts to the size of it's content, so I wonder this works here
- 47. By Thomas Moenicke
-
capslock only when double-tapping the shift key
- 48. By Thomas Moenicke
-
white rectangle anchored to content
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Thomas Moenicke (thomas-moenicke) wrote : | # |
fixed, thx!
On Thu, Sep 5, 2013 at 6:32 PM, Günter Schwann <
<email address hidden>> wrote:
> 868 + anchors.fill: parent
> I thought the Popover adapts to the size of it's content, so I wonder this
> works here
> --
>
> https:/
> You are the owner of
> lp:~thomas-moenicke/ubuntu-keyboard/ubuntu-keyboard-qml-port.
>
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:47
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 49. By Thomas Moenicke
-
removed unused margins
- 50. By Thomas Moenicke
-
added OneTwoKey, as ShiftKey behavor is not correct for symbols keypad
- 51. By Thomas Moenicke
-
when in 2/2 mode, dont shift back to 1/2 mode automatically
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:48
http://
Executed test runs:
SUCCESS: 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 : | # |
PASSED: Continuous integration, rev:51
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 52. By Thomas Moenicke
-
fixed predictive text: space bar has to submit an action like an action key to get predictive text working correctly
- 53. By Thomas Moenicke
-
added action for shift key, to make predictive text working correctly (it shows prediction in capital letters otherwise)
- 54. By Thomas Moenicke
-
merged onKeyReleased and onActionKeyReleased functions into one single method
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:54
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:54
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 55. By Thomas Moenicke
-
bottom margin a bit smaller (1gu)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:55
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 56. By Thomas Moenicke
-
improved url and url_search layouts to match design spec:
- added empty space to the left side of the bottom row
- .com key replaces space bar on url layout
- font size for .com key fixed - 57. By Thomas Moenicke
-
made the entire keypad background non-swipable. Swipe-down gesture is only triggered at the top of the upper edge of osk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:56
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 58. By Thomas Moenicke
-
fine tuning noswipe area: adding top margin to have a bit more space above the keys for swiping down
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:58
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 59. By Thomas Moenicke
-
adjusted size of magnifier as agreed with bfiller. better visibility
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:59
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Bill Filler (bfiller) wrote : | # |
approved, some issues still need to be fixed per notes
Preview Diff
1 | === modified file 'buildOnDevice.sh' |
2 | --- buildOnDevice.sh 2013-08-12 10:32:38 +0000 |
3 | +++ buildOnDevice.sh 2013-09-07 09:02:58 +0000 |
4 | @@ -77,14 +77,18 @@ |
5 | |
6 | build() { |
7 | exec_with_ssh "cd $CODE_DIR/ && qmake && make -j 4" |
8 | + echo "Installing" |
9 | + exec_with_ssh "cd $CODE_DIR/ && " $SUDO " make install" |
10 | # exec_with_ssh "cd $CODE_DIR/ && dpkg-buildpackage -j4" |
11 | } |
12 | |
13 | run() { |
14 | -# exec_with_ssh $SUDO "make install" |
15 | exec_with_ssh $SUDO "/sbin/initctl stop maliit-server" |
16 | -# adb shell pkill $BINARY |
17 | -# exec_with_ssh "$BINARY $RUN_OPTIONS" |
18 | + adb shell pkill $BINARY |
19 | + adb shell pkill "webbrowser-app" |
20 | + adb shell pkill "qmlscene" |
21 | + |
22 | + exec_with_ssh "$BINARY $RUN_OPTIONS" |
23 | } |
24 | |
25 | set -- `getopt -n$0 -u -a --longoptions="setup,help" "sh" "$@"` |
26 | |
27 | === modified file 'qml/Keyboard.qml' |
28 | --- qml/Keyboard.qml 2013-08-27 15:59:20 +0000 |
29 | +++ qml/Keyboard.qml 2013-09-07 09:02:58 +0000 |
30 | @@ -32,19 +32,22 @@ |
31 | import QtQuick 2.0 |
32 | import "constants.js" as Const |
33 | |
34 | +import "keys/key_constants.js" as UI |
35 | + |
36 | Item { |
37 | id: canvas |
38 | objectName: "ubuntuKeyboard" // Allow us to specify a specific keyboard within autopilot. |
39 | - property alias layout: keyRepeater.model |
40 | - property variant event_handler |
41 | - property bool area_enabled // MouseArea has no id property so we cannot alias its enabled property. |
42 | - property alias title: keyboard_title.text |
43 | + property variant layout: maliit_layout |
44 | + property variant event_handler: maliit_event_handler |
45 | + |
46 | + property string layoutId: "en_us" |
47 | + onLayoutIdChanged: keypad.loadLayout(layoutId); |
48 | |
49 | visible: layout.visible |
50 | |
51 | // Expose details for use with Autopilot. |
52 | - readonly property var layoutState: layout.keyboard_state |
53 | - readonly property string activeView: layout.activeView |
54 | + //readonly property var layoutState: layout.keyboard_state |
55 | + //readonly property string activeView: layout.activeView |
56 | |
57 | property int contentOrientation: Qt.PrimaryOrientation |
58 | |
59 | @@ -57,272 +60,104 @@ |
60 | |
61 | RotationHelper { |
62 | |
63 | - Connections { |
64 | - target: layout |
65 | - onTitleChanged: { |
66 | - console.debug("title:" + layout.title) |
67 | - title_timeout.start() |
68 | - } |
69 | - } |
70 | - |
71 | - MouseArea { |
72 | - id: keyboardSurface |
73 | - property int jumpBackThreshold: 170 |
74 | - |
75 | - drag.target: keyboardSurface |
76 | - drag.axis: Drag.YAxis; |
77 | - drag.minimumY: 0 |
78 | - drag.maximumY: height |
79 | - drag.filterChildren: true |
80 | - |
81 | - x:0 |
82 | - y:0 |
83 | - width: parent.width |
84 | - height: parent.height |
85 | - |
86 | - |
87 | - WordRibbon { |
88 | - id: wordRibbon |
89 | - objectName: "wordRibbon" |
90 | - |
91 | - anchors.bottom: keypadMouseArea.top |
92 | - width: parent.width; |
93 | - |
94 | - height: wordribbon_visible ? layout.wordribbon_height : 0 |
95 | - } |
96 | - |
97 | - MouseArea { |
98 | - id: keypadMouseArea |
99 | - preventStealing: true |
100 | - |
101 | - anchors { |
102 | - top: wordRibbon.bottom |
103 | - fill: parent |
104 | - topMargin: layout.invisible_toucharea_height + (wordribbon_visible ? layout.wordribbon_height : 0); |
105 | - } |
106 | - |
107 | - Item { |
108 | - id: keyboardContainer |
109 | - |
110 | - anchors.fill: parent |
111 | - |
112 | - Rectangle { |
113 | - id: background |
114 | - |
115 | - anchors.fill: parent |
116 | - |
117 | - gradient: Gradient { |
118 | - GradientStop { position: 0.0; color: "#f1f1f1" } |
119 | - GradientStop { position: 1.0; color: "#e4e4e4" } |
120 | - } |
121 | - } |
122 | - |
123 | - Image { |
124 | - id: borderTop |
125 | - source: "styles/ubuntu/images/border_top.png" |
126 | - width: parent.width |
127 | - anchors.top: parent.top.bottom |
128 | - } |
129 | - |
130 | - Image { |
131 | - id: borderBottom |
132 | - source: "styles/ubuntu/images/border_bottom.png" |
133 | - width: parent.width |
134 | - anchors.bottom: background.bottom |
135 | - } |
136 | - |
137 | - Item { |
138 | - objectName: "keyboardKeypad" |
139 | - id: keyPad |
140 | - |
141 | - anchors.top: borderTop.bottom |
142 | - anchors.bottom: borderBottom.top |
143 | - width: parent.width |
144 | - |
145 | - Repeater { |
146 | - id: keyRepeater |
147 | - model: layout |
148 | - anchors.fill: parent |
149 | - |
150 | - Item { |
151 | - property alias text: key_text_item.text; |
152 | - |
153 | - x: key_reactive_area.x |
154 | - y: key_reactive_area.y |
155 | - width: key_reactive_area.width |
156 | - height: key_reactive_area.height |
157 | - |
158 | - BorderImage { |
159 | - x: key_rectangle.x |
160 | - y: key_rectangle.y |
161 | - width: key_rectangle.width |
162 | - height: key_rectangle.height |
163 | - |
164 | - border.left: key_background_borders.x |
165 | - border.top: key_background_borders.y |
166 | - border.right: key_background_borders.width |
167 | - border.bottom: key_background_borders.height |
168 | - |
169 | - source: key_background |
170 | - |
171 | - Text { |
172 | - id: key_text_item |
173 | - |
174 | - // Expose detail for use within Autopilot |
175 | - property var action_type: key_action_type |
176 | - |
177 | - anchors.fill: parent |
178 | - text: key_text |
179 | - font.family: key_font |
180 | - font.pixelSize: key_font_size |
181 | - color: key_font_color |
182 | - font.bold: true |
183 | - horizontalAlignment: Text.AlignHCenter |
184 | - verticalAlignment: Text.AlignVCenter |
185 | - visible: (key_text.length != 0) |
186 | - } |
187 | - |
188 | - Image { |
189 | - anchors.centerIn: parent |
190 | - source: key_icon |
191 | - visible: (key_icon.length != 0) |
192 | - } |
193 | - } |
194 | - |
195 | - MouseArea { |
196 | - enabled: area_enabled |
197 | - anchors.fill: parent |
198 | - hoverEnabled: true |
199 | - |
200 | - onEntered: event_handler.onEntered(index) |
201 | - onExited: event_handler.onExited(index) |
202 | - |
203 | - onPressed: { |
204 | - if(!drag.active) { |
205 | - pressedKeyIndex = index; |
206 | - event_handler.onEntered(index) |
207 | - } |
208 | - |
209 | - if (key_action_insert) |
210 | - pressedKey = parent |
211 | - else |
212 | - pressedKey = null |
213 | - |
214 | - event_handler.onPressed(index) |
215 | - mouse.accepted = false; |
216 | - } |
217 | - |
218 | - onReleased: { |
219 | - console.error("ON_RELEASED") |
220 | - if (pressedKeyIndex == -1) |
221 | - return; |
222 | - |
223 | - if (!drag.active) |
224 | - event_handler.onReleased(pressedKeyIndex); |
225 | - |
226 | - event_handler.onExited(pressedKeyIndex) |
227 | - pressedKeyIndex = -1; |
228 | - |
229 | - } |
230 | - |
231 | - onPressAndHold: event_handler.onPressAndHold(index) |
232 | - } |
233 | - |
234 | - } // Item |
235 | - } // Repeater |
236 | - |
237 | - } // keyPad |
238 | - |
239 | - Popper { |
240 | - id: popper |
241 | - target: pressedKey |
242 | - width: units.gu(Const.magnifierWidth); |
243 | - height: units.gu(Const.magnifierHeight); |
244 | - } |
245 | - |
246 | - // Keyboard title rendering |
247 | - // TODO: Make separate component? |
248 | - Item { |
249 | - anchors.centerIn: parent |
250 | - opacity: title_timeout.running ? 1.0 : 0.0 |
251 | - |
252 | - Behavior on opacity { |
253 | - PropertyAnimation { |
254 | - duration: 300 |
255 | - easing.type: Easing.InOutQuad |
256 | - } |
257 | - } |
258 | - |
259 | - Timer { |
260 | - id: title_timeout |
261 | - interval: 1000 |
262 | - } |
263 | - |
264 | - // TODO: Make title background part of styling profile. |
265 | - BorderImage { |
266 | - anchors.centerIn: parent |
267 | - |
268 | - // Manual padding of text: |
269 | - width: keyboard_title.width * 1.2 |
270 | - height: keyboard_title.height * 1.2 |
271 | - |
272 | - //anchors.fill: keyboard_title |
273 | - source: layout.background |
274 | - z: 1000 // Move behind Text element but in front of rest. |
275 | - |
276 | - border.left: layout.background_borders.x |
277 | - border.top: layout.background_borders.y |
278 | - border.right: layout.background_borders.width |
279 | - border.bottom: layout.background_borders.height |
280 | - } |
281 | - |
282 | - Text { |
283 | - id: keyboard_title |
284 | - anchors.centerIn: parent |
285 | - |
286 | - text: title; |
287 | - z: 1001 |
288 | - |
289 | - // TODO: Make title font part of styling profile. |
290 | - font.pointSize: 48 |
291 | - color: "white" |
292 | - } |
293 | - } |
294 | - } // keyboardContainer |
295 | - |
296 | - onReleased: { |
297 | - if (pressedKeyIndex == -1) |
298 | - return; |
299 | - |
300 | - if (!drag.active) |
301 | - event_handler.onReleased(pressedKeyIndex); |
302 | - |
303 | - event_handler.onExited(pressedKeyIndex) |
304 | - pressedKeyIndex = -1; |
305 | - pressedKey = null; |
306 | - |
307 | - } |
308 | - } // keypadMouseArea |
309 | - |
310 | - onReleased: { |
311 | - if (y > jumpBackThreshold) { |
312 | - canvas.shown = false; |
313 | - } else { |
314 | - bounceBackAnimation.from = y |
315 | - bounceBackAnimation.start(); |
316 | - } |
317 | - } |
318 | - |
319 | - PropertyAnimation { |
320 | - id: bounceBackAnimation |
321 | - target: keyboardSurface |
322 | - properties: "y" |
323 | - easing.type: Easing.OutBounce; |
324 | - easing.overshoot: 2.0 |
325 | - to: 0 |
326 | - } |
327 | - |
328 | - } // big mousearea |
329 | + MouseArea { |
330 | + id: keyboardSurface |
331 | + property int jumpBackThreshold: 170 |
332 | + |
333 | + drag.target: keyboardSurface |
334 | + drag.axis: Drag.YAxis; |
335 | + drag.minimumY: 0 |
336 | + drag.maximumY: height |
337 | + drag.filterChildren: true |
338 | + |
339 | + x:0 |
340 | + y:0 |
341 | + width: parent.width |
342 | + height: parent.height |
343 | + |
344 | + |
345 | + WordRibbon { |
346 | + id: wordRibbon |
347 | + objectName: "wordRibbon" |
348 | + |
349 | + anchors.bottom: keyboardComp.top |
350 | + width: parent.width; |
351 | + |
352 | + height: wordribbon_visible ? layout.wordribbon_height : 0 |
353 | + } |
354 | + |
355 | + Item { |
356 | + id: keyboardComp |
357 | + |
358 | + anchors { |
359 | + top: wordRibbon.bottom |
360 | + fill: parent |
361 | + topMargin: layout.invisible_toucharea_height + (wordribbon_visible ? layout.wordribbon_height : 0); |
362 | + } |
363 | + |
364 | + Rectangle { |
365 | + id: background |
366 | + |
367 | + anchors.fill: parent |
368 | + |
369 | + gradient: Gradient { |
370 | + GradientStop { position: 0.0; color: "#f1f1f1" } |
371 | + GradientStop { position: 1.0; color: "#e4e4e4" } |
372 | + } |
373 | + } |
374 | + |
375 | + MouseArea { |
376 | + id: noSwipeDown |
377 | + anchors.fill: parent |
378 | + preventStealing: true |
379 | + anchors.top: borderTop.bottom |
380 | + anchors.topMargin: units.gu( UI.top_margin ) |
381 | + } |
382 | + |
383 | + Image { |
384 | + id: borderTop |
385 | + source: "styles/ubuntu/images/border_top.png" |
386 | + width: parent.width |
387 | + anchors.top: parent.top.bottom |
388 | + } |
389 | + |
390 | + Image { |
391 | + id: borderBottom |
392 | + source: "styles/ubuntu/images/border_bottom.png" |
393 | + width: parent.width |
394 | + anchors.bottom: background.bottom |
395 | + } |
396 | + |
397 | + KeyboardContainer { |
398 | + id: keypad |
399 | + |
400 | + anchors.top: borderTop.bottom |
401 | + anchors.bottom: borderBottom.top |
402 | + anchors.topMargin: units.gu( UI.top_margin ) |
403 | + anchors.bottomMargin: units.gu( UI.bottom_margin ) |
404 | + width: parent.width |
405 | + } |
406 | + } // keyboardComp |
407 | + |
408 | + onReleased: { |
409 | + if (y > jumpBackThreshold) { |
410 | + canvas.shown = false; |
411 | + } else { |
412 | + bounceBackAnimation.from = y |
413 | + bounceBackAnimation.start(); |
414 | + } |
415 | + } |
416 | + |
417 | + PropertyAnimation { |
418 | + id: bounceBackAnimation |
419 | + target: keyboardSurface |
420 | + properties: "y" |
421 | + easing.type: Easing.OutBounce; |
422 | + easing.overshoot: 2.0 |
423 | + to: 0 |
424 | + } |
425 | + |
426 | + } // big mousearea |
427 | } // rotation helper |
428 | |
429 | state: "HIDDEN" |
430 | |
431 | === added file 'qml/KeyboardContainer.qml' |
432 | --- qml/KeyboardContainer.qml 1970-01-01 00:00:00 +0000 |
433 | +++ qml/KeyboardContainer.qml 2013-09-07 09:02:58 +0000 |
434 | @@ -0,0 +1,90 @@ |
435 | +/* |
436 | + * Copyright 2013 Canonical Ltd. |
437 | + * |
438 | + * This program is free software; you can redistribute it and/or modify |
439 | + * it under the terms of the GNU Lesser General Public License as published by |
440 | + * the Free Software Foundation; version 3. |
441 | + * |
442 | + * This program is distributed in the hope that it will be useful, |
443 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
444 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
445 | + * GNU Lesser General Public License for more details. |
446 | + * |
447 | + * You should have received a copy of the GNU Lesser General Public License |
448 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
449 | + */ |
450 | + |
451 | +import QtQuick 2.0 |
452 | +import QtQuick.Window 2.0 |
453 | +import "languages/" |
454 | + |
455 | +Item { |
456 | + id: panel |
457 | + |
458 | + property int keyWidth: 0 |
459 | + property int keyHeight: 0 |
460 | + |
461 | + property var activeKeypad: characterKeypad.item |
462 | + |
463 | + state: "CHARACTERS" |
464 | + |
465 | + function loadLayout(layoutId) |
466 | + { |
467 | + if (layoutId === "number") |
468 | + characterKeypad.source = "languages/Keyboard_numbers.qml" |
469 | + if (layoutId === "phonenumber") |
470 | + characterKeypad.source = "languages/Keyboard_telephone.qml" |
471 | + if (layoutId === "email") |
472 | + characterKeypad.source = "languages/Keyboard_en_email.qml" |
473 | + if (layoutId === "url") |
474 | + characterKeypad.source = "languages/Keyboard_en_url_search.qml" |
475 | + if (layoutId === "en_us") |
476 | + characterKeypad.source = "languages/Keyboard_en_us.qml" |
477 | + } |
478 | + |
479 | + Loader { |
480 | + id: characterKeypad |
481 | + anchors.fill: parent |
482 | + |
483 | + source: "languages/Keyboard_en_us.qml" |
484 | + } |
485 | + |
486 | + Keyboard_symbols { |
487 | + id: symbolKeypad |
488 | + } |
489 | + |
490 | + states: [ |
491 | + State { |
492 | + name: "CHARACTERS" |
493 | + PropertyChanges { |
494 | + target: panel |
495 | + activeKeypad: characterKeypad.item |
496 | + } |
497 | + PropertyChanges { |
498 | + target: characterKeypad |
499 | + visible: true |
500 | + } |
501 | + PropertyChanges { |
502 | + target: symbolKeypad |
503 | + visible: false |
504 | + } |
505 | + }, |
506 | + State { |
507 | + name: "SYMBOLS" |
508 | + PropertyChanges { |
509 | + target: panel |
510 | + activeKeypad: symbolKeypad |
511 | + } |
512 | + PropertyChanges { |
513 | + target: characterKeypad |
514 | + visible: false |
515 | + } |
516 | + PropertyChanges { |
517 | + target: symbolKeypad |
518 | + visible: true |
519 | + } |
520 | + } |
521 | + ] |
522 | + |
523 | +} |
524 | + |
525 | |
526 | === added directory 'qml/images' |
527 | === added file 'qml/images/b2.png' |
528 | Binary files qml/images/b2.png 1970-01-01 00:00:00 +0000 and qml/images/b2.png 2013-09-07 09:02:58 +0000 differ |
529 | === added file 'qml/images/border_bottom.png' |
530 | Binary files qml/images/border_bottom.png 1970-01-01 00:00:00 +0000 and qml/images/border_bottom.png 2013-09-07 09:02:58 +0000 differ |
531 | === added file 'qml/images/border_top.png' |
532 | Binary files qml/images/border_top.png 1970-01-01 00:00:00 +0000 and qml/images/border_top.png 2013-09-07 09:02:58 +0000 differ |
533 | === added file 'qml/images/icon_backspace@18.png' |
534 | Binary files qml/images/icon_backspace@18.png 1970-01-01 00:00:00 +0000 and qml/images/icon_backspace@18.png 2013-09-07 09:02:58 +0000 differ |
535 | === added file 'qml/images/icon_enter@18.png' |
536 | Binary files qml/images/icon_enter@18.png 1970-01-01 00:00:00 +0000 and qml/images/icon_enter@18.png 2013-09-07 09:02:58 +0000 differ |
537 | === added file 'qml/images/icon_shift@18.png' |
538 | Binary files qml/images/icon_shift@18.png 1970-01-01 00:00:00 +0000 and qml/images/icon_shift@18.png 2013-09-07 09:02:58 +0000 differ |
539 | === added file 'qml/images/icon_shift_upsidedown@18.png' |
540 | Binary files qml/images/icon_shift_upsidedown@18.png 1970-01-01 00:00:00 +0000 and qml/images/icon_shift_upsidedown@18.png 2013-09-07 09:02:58 +0000 differ |
541 | === added file 'qml/images/icon_shift_white@18.png' |
542 | Binary files qml/images/icon_shift_white@18.png 1970-01-01 00:00:00 +0000 and qml/images/icon_shift_white@18.png 2013-09-07 09:02:58 +0000 differ |
543 | === added file 'qml/images/keybg.png' |
544 | Binary files qml/images/keybg.png 1970-01-01 00:00:00 +0000 and qml/images/keybg.png 2013-09-07 09:02:58 +0000 differ |
545 | === added file 'qml/images/keybg@18.png' |
546 | Binary files qml/images/keybg@18.png 1970-01-01 00:00:00 +0000 and qml/images/keybg@18.png 2013-09-07 09:02:58 +0000 differ |
547 | === added file 'qml/images/keybg@18.sci' |
548 | --- qml/images/keybg@18.sci 1970-01-01 00:00:00 +0000 |
549 | +++ qml/images/keybg@18.sci 2013-09-07 09:02:58 +0000 |
550 | @@ -0,0 +1,5 @@ |
551 | +border.left: 22 |
552 | +border.top: 22 |
553 | +border.bottom: 22 |
554 | +border.right: 22 |
555 | +source: keybg@18.png |
556 | \ No newline at end of file |
557 | |
558 | === added file 'qml/images/keybg_action@18.png' |
559 | Binary files qml/images/keybg_action@18.png 1970-01-01 00:00:00 +0000 and qml/images/keybg_action@18.png 2013-09-07 09:02:58 +0000 differ |
560 | === added file 'qml/images/keybg_action@18.sci' |
561 | --- qml/images/keybg_action@18.sci 1970-01-01 00:00:00 +0000 |
562 | +++ qml/images/keybg_action@18.sci 2013-09-07 09:02:58 +0000 |
563 | @@ -0,0 +1,5 @@ |
564 | +border.left: 22 |
565 | +border.top: 22 |
566 | +border.bottom: 22 |
567 | +border.right: 22 |
568 | +source: keybg_action@18.png |
569 | \ No newline at end of file |
570 | |
571 | === added file 'qml/images/keybg_action_active@18.png' |
572 | Binary files qml/images/keybg_action_active@18.png 1970-01-01 00:00:00 +0000 and qml/images/keybg_action_active@18.png 2013-09-07 09:02:58 +0000 differ |
573 | === added file 'qml/images/keybg_capslock_bg@18.png' |
574 | Binary files qml/images/keybg_capslock_bg@18.png 1970-01-01 00:00:00 +0000 and qml/images/keybg_capslock_bg@18.png 2013-09-07 09:02:58 +0000 differ |
575 | === added file 'qml/images/keyboard_popover.png' |
576 | Binary files qml/images/keyboard_popover.png 1970-01-01 00:00:00 +0000 and qml/images/keyboard_popover.png 2013-09-07 09:02:58 +0000 differ |
577 | === added file 'qml/images/rect3846.png' |
578 | Binary files qml/images/rect3846.png 1970-01-01 00:00:00 +0000 and qml/images/rect3846.png 2013-09-07 09:02:58 +0000 differ |
579 | === added file 'qml/images/tablet_icon_backspace@20.png' |
580 | Binary files qml/images/tablet_icon_backspace@20.png 1970-01-01 00:00:00 +0000 and qml/images/tablet_icon_backspace@20.png 2013-09-07 09:02:58 +0000 differ |
581 | === added file 'qml/images/tablet_icon_return@20.png' |
582 | Binary files qml/images/tablet_icon_return@20.png 1970-01-01 00:00:00 +0000 and qml/images/tablet_icon_return@20.png 2013-09-07 09:02:58 +0000 differ |
583 | === added file 'qml/images/tablet_icon_shift@20.png' |
584 | Binary files qml/images/tablet_icon_shift@20.png 1970-01-01 00:00:00 +0000 and qml/images/tablet_icon_shift@20.png 2013-09-07 09:02:58 +0000 differ |
585 | === added file 'qml/images/tablet_icon_shift_white@20.png' |
586 | Binary files qml/images/tablet_icon_shift_white@20.png 1970-01-01 00:00:00 +0000 and qml/images/tablet_icon_shift_white@20.png 2013-09-07 09:02:58 +0000 differ |
587 | === added directory 'qml/keys' |
588 | === added file 'qml/keys/ActionKey.qml' |
589 | --- qml/keys/ActionKey.qml 1970-01-01 00:00:00 +0000 |
590 | +++ qml/keys/ActionKey.qml 2013-09-07 09:02:58 +0000 |
591 | @@ -0,0 +1,51 @@ |
592 | +/* |
593 | + * Copyright 2013 Canonical Ltd. |
594 | + * |
595 | + * This program is free software; you can redistribute it and/or modify |
596 | + * it under the terms of the GNU Lesser General Public License as published by |
597 | + * the Free Software Foundation; version 3. |
598 | + * |
599 | + * This program is distributed in the hope that it will be useful, |
600 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
601 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
602 | + * GNU Lesser General Public License for more details. |
603 | + * |
604 | + * You should have received a copy of the GNU Lesser General Public License |
605 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
606 | + */ |
607 | + |
608 | +import QtQuick 2.0 |
609 | + |
610 | +import "key_constants.js" as UI |
611 | + |
612 | +CharKey { |
613 | + id: actionKeyRoot |
614 | + property string iconNormal: "" |
615 | + property string iconShifted: "" |
616 | + property string iconCapsLock: "" |
617 | + |
618 | + noMagnifier: true |
619 | + property int padding: UI.actionKeyPadding |
620 | + |
621 | + // action keys are a bit wider |
622 | + width: panel.keyWidth + units.gu( padding ) |
623 | + |
624 | + imgNormal: UI.imageActionKey |
625 | + imgPressed: UI.imageActionKeyPressed |
626 | + |
627 | + Image { |
628 | + id: iconImage |
629 | + source: iconNormal |
630 | + anchors.centerIn: parent |
631 | + visible: (label == "") |
632 | + } |
633 | + |
634 | + onOskStateChanged: { |
635 | + if (panel.activeKeypad.state == "NORMAL") |
636 | + iconImage.source = iconNormal; |
637 | + if (panel.activeKeypad.state == "SHIFTED") |
638 | + iconImage.source = iconShifted; |
639 | + if (panel.activeKeypad.state == "CAPSLOCK") |
640 | + iconImage.source = iconCapsLock |
641 | + } |
642 | +} |
643 | |
644 | === added file 'qml/keys/BackspaceKey.qml' |
645 | --- qml/keys/BackspaceKey.qml 1970-01-01 00:00:00 +0000 |
646 | +++ qml/keys/BackspaceKey.qml 2013-09-07 09:02:58 +0000 |
647 | @@ -0,0 +1,24 @@ |
648 | +/* |
649 | + * Copyright 2013 Canonical Ltd. |
650 | + * |
651 | + * This program is free software; you can redistribute it and/or modify |
652 | + * it under the terms of the GNU Lesser General Public License as published by |
653 | + * the Free Software Foundation; version 3. |
654 | + * |
655 | + * This program is distributed in the hope that it will be useful, |
656 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
657 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
658 | + * GNU Lesser General Public License for more details. |
659 | + * |
660 | + * You should have received a copy of the GNU Lesser General Public License |
661 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
662 | + */ |
663 | + |
664 | +import QtQuick 2.0 |
665 | + |
666 | +ActionKey { |
667 | + iconNormal: "../images/icon_backspace@18.png"; |
668 | + iconShifted: "../images/icon_backspace@18.png"; |
669 | + iconCapsLock: "../images/icon_backspace@18.png"; |
670 | + action: "backspace"; |
671 | +} |
672 | |
673 | === added file 'qml/keys/CharKey.qml' |
674 | --- qml/keys/CharKey.qml 1970-01-01 00:00:00 +0000 |
675 | +++ qml/keys/CharKey.qml 2013-09-07 09:02:58 +0000 |
676 | @@ -0,0 +1,160 @@ |
677 | +/* |
678 | + * Copyright 2013 Canonical Ltd. |
679 | + * |
680 | + * This program is free software; you can redistribute it and/or modify |
681 | + * it under the terms of the GNU Lesser General Public License as published by |
682 | + * the Free Software Foundation; version 3. |
683 | + * |
684 | + * This program is distributed in the hope that it will be useful, |
685 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
686 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
687 | + * GNU Lesser General Public License for more details. |
688 | + * |
689 | + * You should have received a copy of the GNU Lesser General Public License |
690 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
691 | + */ |
692 | + |
693 | +import QtQuick 2.0 |
694 | +import Ubuntu.Components 0.1 |
695 | +import Ubuntu.Components.Popups 0.1 |
696 | + |
697 | +import "key_constants.js" as UI |
698 | + |
699 | +Item { |
700 | + id: key |
701 | + |
702 | + property int padding: 0 |
703 | + |
704 | + width: panel.keyWidth |
705 | + height: panel.keyHeight |
706 | + |
707 | + /* to be set in keyboard layouts */ |
708 | + property string label: "" |
709 | + property string shifted: "" |
710 | + property var extended; // list of extended keys |
711 | + property var extendedShifted; // list of extended keys in shifted state |
712 | + |
713 | + property alias valueToSubmit: keyLabel.text |
714 | + |
715 | + property string action |
716 | + property bool noMagnifier: false |
717 | + |
718 | + /* design */ |
719 | + property string imgNormal: UI.imageCharKey |
720 | + property string imgPressed: UI.imageCharKeyPressed |
721 | + // fontSize can be overwritten when using the component, e.g. SymbolShiftKey uses smaller fontSize |
722 | + property int fontSize: units.gu( UI.fontSize ); |
723 | + |
724 | + state: "NORMAL" |
725 | + |
726 | + /** |
727 | + * this property specifies if the key can submit its value or not (e.g. when the popover is shown, it does not commit its value) |
728 | + */ |
729 | + |
730 | + property bool popoverHasFocus: false |
731 | + |
732 | + /* |
733 | + * label changes when keyboard is in shifted mode |
734 | + * extended keys change as well when shifting keyboard, typically lower-uppercase: ê vs Ê |
735 | + */ |
736 | + property string oskState: panel.activeKeypad.state |
737 | + property var activeExtendedModel: extended |
738 | + |
739 | + onOskStateChanged: { |
740 | + if (panel.activeKeypad.state == "NORMAL") { |
741 | + keyLabel.text = label; |
742 | + activeExtendedModel = extended; |
743 | + } else if (panel.activeKeypad.state == "SHIFTED") { |
744 | + keyLabel.text = shifted; |
745 | + activeExtendedModel = extendedShifted |
746 | + } |
747 | + // CAPSLOCK keeps everything as in SHIFTED, nothing to do |
748 | + } |
749 | + |
750 | + BorderImage { |
751 | + id: buttonImage |
752 | + border { left: 22; top: 22; right: 22; bottom: 22 } |
753 | + anchors.centerIn: parent |
754 | + anchors.fill: key |
755 | + anchors.margins: units.dp( UI.keyMargins ); |
756 | + } |
757 | + |
758 | + Text { |
759 | + id: keyLabel |
760 | + text: "" |
761 | + anchors.centerIn: parent |
762 | + font.family: UI.fontFamily |
763 | + font.pixelSize: fontSize |
764 | + font.bold: UI.fontBold |
765 | + color: UI.fontColor |
766 | + } |
767 | + |
768 | + MouseArea { |
769 | + id: keyMouseArea |
770 | + anchors.fill: key |
771 | + |
772 | + hoverEnabled: true |
773 | + preventStealing: true |
774 | + |
775 | + onPressAndHold: { |
776 | + if (activeExtendedModel != undefined) |
777 | + PopupUtils.open(popoverComponent, keyMouseArea) |
778 | + } |
779 | + |
780 | + onReleased: { |
781 | + key.state = "NORMAL" |
782 | + |
783 | + if (!popoverHasFocus) { |
784 | + event_handler.onKeyReleased(valueToSubmit, action); |
785 | + |
786 | + if (panel.activeKeypad.state === "SHIFTED" && panel.state === "CHARACTERS") |
787 | + panel.activeKeypad.state = "NORMAL" |
788 | + } |
789 | + } |
790 | + onPressed: { |
791 | + key.state = "PRESSED" |
792 | + event_handler.onKeyPressed(valueToSubmit); |
793 | + } |
794 | + } |
795 | + |
796 | + Component { |
797 | + id: popoverComponent |
798 | + ExtendedKeysSelector { |
799 | + id: extendedKeysSelector |
800 | + extendedKeysModel: activeExtendedModel |
801 | + onVisibleChanged: popoverHasFocus = visible; |
802 | + } |
803 | + } |
804 | + |
805 | + Popper { |
806 | + id: popper |
807 | + visible: !noMagnifier && !popoverHasFocus |
808 | + width: panel.keyWidth + units.gu(UI.magnifierHorizontalPadding) |
809 | + height: panel.keyHeight + units.gu(UI.magnifierVerticalPadding) |
810 | + } |
811 | + |
812 | + states: [ |
813 | + State { |
814 | + name: "NORMAL" |
815 | + PropertyChanges { |
816 | + target: buttonImage |
817 | + source: imgNormal |
818 | + } |
819 | + PropertyChanges { |
820 | + target: popper |
821 | + popTarget: null |
822 | + } |
823 | + }, |
824 | + State { |
825 | + name: "PRESSED" |
826 | + PropertyChanges { |
827 | + target: buttonImage |
828 | + source: imgPressed |
829 | + } |
830 | + PropertyChanges { |
831 | + target: popper |
832 | + popTarget: keyLabel |
833 | + } |
834 | + } |
835 | + ] |
836 | +} |
837 | |
838 | === added file 'qml/keys/ExtendedKeysSelector.qml' |
839 | --- qml/keys/ExtendedKeysSelector.qml 1970-01-01 00:00:00 +0000 |
840 | +++ qml/keys/ExtendedKeysSelector.qml 2013-09-07 09:02:58 +0000 |
841 | @@ -0,0 +1,72 @@ |
842 | +/* |
843 | + * Copyright 2013 Canonical Ltd. |
844 | + * |
845 | + * This program is free software; you can redistribute it and/or modify |
846 | + * it under the terms of the GNU Lesser General Public License as published by |
847 | + * the Free Software Foundation; version 3. |
848 | + * |
849 | + * This program is distributed in the hope that it will be useful, |
850 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
851 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
852 | + * GNU Lesser General Public License for more details. |
853 | + * |
854 | + * You should have received a copy of the GNU Lesser General Public License |
855 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
856 | + */ |
857 | + |
858 | +import QtQuick 2.0 |
859 | + |
860 | +import Ubuntu.Components 0.1 |
861 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
862 | +import Ubuntu.Components.Popups 0.1 |
863 | + |
864 | +import "key_constants.js" as UI |
865 | + |
866 | +Popover { |
867 | + |
868 | + id: popover |
869 | + |
870 | + property variant extendedKeysModel |
871 | + |
872 | + Rectangle { |
873 | + anchors.fill: containerLayout |
874 | + color: "white" |
875 | + } |
876 | + |
877 | + Row { |
878 | + id: containerLayout |
879 | + anchors { |
880 | + left: parent.left |
881 | + top: parent.top |
882 | + right: parent.right |
883 | + } |
884 | + |
885 | + Repeater { |
886 | + model: extendedKeysModel |
887 | + |
888 | + Item { |
889 | + width: units.gu( UI.popoverCellSize ); |
890 | + height: panel.keyHeight; |
891 | + |
892 | + Text { |
893 | + anchors.centerIn: parent; |
894 | + text: modelData |
895 | + font.family: UI.fontFamily |
896 | + font.pixelSize: fontSize |
897 | + font.bold: UI.fontBold |
898 | + color: UI.fontColor |
899 | + } |
900 | + |
901 | + MouseArea { |
902 | + anchors.fill: parent |
903 | + onReleased: { |
904 | + event_handler.onKeyReleased(modelData); |
905 | + popover.hide(); |
906 | + } |
907 | + } |
908 | + } |
909 | + } |
910 | + } |
911 | +} |
912 | + |
913 | + |
914 | |
915 | === added file 'qml/keys/KeyPad.qml' |
916 | --- qml/keys/KeyPad.qml 1970-01-01 00:00:00 +0000 |
917 | +++ qml/keys/KeyPad.qml 2013-09-07 09:02:58 +0000 |
918 | @@ -0,0 +1,83 @@ |
919 | +/* |
920 | + * Copyright 2013 Canonical Ltd. |
921 | + * |
922 | + * This program is free software; you can redistribute it and/or modify |
923 | + * it under the terms of the GNU Lesser General Public License as published by |
924 | + * the Free Software Foundation; version 3. |
925 | + * |
926 | + * This program is distributed in the hope that it will be useful, |
927 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
928 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
929 | + * GNU Lesser General Public License for more details. |
930 | + * |
931 | + * You should have received a copy of the GNU Lesser General Public License |
932 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
933 | + */ |
934 | + |
935 | +import QtQuick 2.0 |
936 | + |
937 | +Item { |
938 | + id: keyPadRoot |
939 | + |
940 | + state: "NORMAL" |
941 | + |
942 | + property var content: c1 |
943 | + property bool capsLock: false |
944 | + |
945 | + Column { |
946 | + id: c1 |
947 | + } |
948 | + |
949 | + Component.onCompleted: |
950 | + { |
951 | + calculateKeyWidth(); |
952 | + calculateKeyHeight(); |
953 | + } |
954 | + |
955 | + onWidthChanged: calculateKeyWidth() |
956 | + onHeightChanged: calculateKeyHeight(); |
957 | + |
958 | + function numberOfRows() { |
959 | + return content.children.length; |
960 | + } |
961 | + |
962 | + // we don´t use a QML layout, because we want all keys to be equally sized |
963 | + function calculateKeyWidth() { |
964 | + var width = panel.width; |
965 | + |
966 | + var maxNrOfKeys = 0; |
967 | + for (var i = 0; i < numberOfRows(); ++i) { |
968 | + if (content.children[i].children.length > maxNrOfKeys) |
969 | + maxNrOfKeys = content.children[i].children.length; |
970 | + } |
971 | + |
972 | + var maxSpaceForKeys = panel.width / maxNrOfKeys; |
973 | + |
974 | + panel.keyWidth = maxSpaceForKeys; |
975 | + } |
976 | + |
977 | + function calculateKeyHeight() { |
978 | + panel.keyHeight = panel.height / numberOfRows(); |
979 | + } |
980 | + |
981 | + states: [ |
982 | + State { |
983 | + name: "NORMAL" |
984 | + PropertyChanges { |
985 | + target: panel |
986 | + } |
987 | + }, |
988 | + State { |
989 | + name: "SHIFTED" |
990 | + PropertyChanges { |
991 | + target: panel |
992 | + } |
993 | + }, |
994 | + State { |
995 | + name: "CAPSLOCK" |
996 | + PropertyChanges { |
997 | + target: panel |
998 | + } |
999 | + } |
1000 | + ] |
1001 | +} |
1002 | |
1003 | === added file 'qml/keys/OneTwoKey.qml' |
1004 | --- qml/keys/OneTwoKey.qml 1970-01-01 00:00:00 +0000 |
1005 | +++ qml/keys/OneTwoKey.qml 2013-09-07 09:02:58 +0000 |
1006 | @@ -0,0 +1,38 @@ |
1007 | +/* |
1008 | + * Copyright 2013 Canonical Ltd. |
1009 | + * |
1010 | + * This program is free software; you can redistribute it and/or modify |
1011 | + * it under the terms of the GNU Lesser General Public License as published by |
1012 | + * the Free Software Foundation; version 3. |
1013 | + * |
1014 | + * This program is distributed in the hope that it will be useful, |
1015 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1016 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1017 | + * GNU Lesser General Public License for more details. |
1018 | + * |
1019 | + * You should have received a copy of the GNU Lesser General Public License |
1020 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1021 | + */ |
1022 | + |
1023 | +import QtQuick 2.0 |
1024 | + |
1025 | +ActionKey { |
1026 | + iconNormal: "../images/icon_shift@18.png"; |
1027 | + iconShifted: "../images/icon_shift_upsidedown@18.png"; |
1028 | + iconCapsLock: "../images/icon_shift_white@18.png"; |
1029 | + action: "shift" |
1030 | + |
1031 | + MouseArea { |
1032 | + anchors.fill: parent |
1033 | + onClicked: { |
1034 | + if (panel.activeKeypad.state == "NORMAL") |
1035 | + panel.activeKeypad.state = "SHIFTED"; |
1036 | + |
1037 | + else if (panel.activeKeypad.state == "SHIFTED") |
1038 | + panel.activeKeypad.state = "NORMAL" |
1039 | + |
1040 | + else if (panel.activeKeypad.state == "CAPSLOCK") |
1041 | + panel.activeKeypad.state = "NORMAL" |
1042 | + } |
1043 | + } |
1044 | +} |
1045 | |
1046 | === renamed file 'qml/Popper.qml' => 'qml/keys/Popper.qml' |
1047 | --- qml/Popper.qml 2013-08-15 20:33:21 +0000 |
1048 | +++ qml/keys/Popper.qml 2013-09-07 09:02:58 +0000 |
1049 | @@ -29,40 +29,41 @@ |
1050 | |
1051 | import QtQuick 2.0 |
1052 | |
1053 | +import "key_constants.js" as UI |
1054 | + |
1055 | Image { |
1056 | id: popper |
1057 | - source: "styles/ubuntu/images/keyboard_popover.png" |
1058 | + source: "/usr/share/maliit/plugins/com/ubuntu/styles/ubuntu/images/keyboard_popover.png" |
1059 | opacity: 0 |
1060 | |
1061 | - property Item target: null |
1062 | + property Item popTarget: null |
1063 | |
1064 | Text { |
1065 | id: popperText |
1066 | text: "" |
1067 | anchors.centerIn: parent |
1068 | - horizontalAlignment: Text.AlignHCenter |
1069 | - verticalAlignment: Text.AlignVCenter |
1070 | - font.family: "Ubuntu Medium" |
1071 | - font.pixelSize: 45 |
1072 | - font.bold: true |
1073 | - color: "black" |
1074 | + |
1075 | + font.family: UI.fontFamily |
1076 | + font.pixelSize: units.gu( UI.fontSize ) |
1077 | + font.bold: UI.fontBold |
1078 | + color: UI.fontColor |
1079 | } |
1080 | |
1081 | states: State { |
1082 | name: "active" |
1083 | - when: target !== null |
1084 | + when: popTarget !== null |
1085 | |
1086 | PropertyChanges { |
1087 | target: popperText |
1088 | - text: target.text |
1089 | + text: popTarget.text |
1090 | } |
1091 | |
1092 | PropertyChanges { |
1093 | target: popper |
1094 | opacity: 1 |
1095 | |
1096 | - x: popper.parent.mapFromItem(target, 0, 0).x + (target.width - popper.width) / 2 |
1097 | - y: popper.parent.mapFromItem(target, 0, 0).y - popper.height |
1098 | + x: popper.parent.mapFromItem(popTarget, 0, 0).x + (popTarget.width - popper.width) / 2 |
1099 | + y: popper.parent.mapFromItem(popTarget, 0, 0).y - popper.height |
1100 | } |
1101 | } |
1102 | |
1103 | |
1104 | === added file 'qml/keys/ReturnKey.qml' |
1105 | --- qml/keys/ReturnKey.qml 1970-01-01 00:00:00 +0000 |
1106 | +++ qml/keys/ReturnKey.qml 2013-09-07 09:02:58 +0000 |
1107 | @@ -0,0 +1,23 @@ |
1108 | +/* |
1109 | + * Copyright 2013 Canonical Ltd. |
1110 | + * |
1111 | + * This program is free software; you can redistribute it and/or modify |
1112 | + * it under the terms of the GNU Lesser General Public License as published by |
1113 | + * the Free Software Foundation; version 3. |
1114 | + * |
1115 | + * This program is distributed in the hope that it will be useful, |
1116 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1117 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1118 | + * GNU Lesser General Public License for more details. |
1119 | + * |
1120 | + * You should have received a copy of the GNU Lesser General Public License |
1121 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1122 | + */ |
1123 | + |
1124 | +import QtQuick 2.0 |
1125 | + |
1126 | +ActionKey { |
1127 | + iconNormal: "../images/icon_enter@18.png"; |
1128 | + iconShifted: "../images/icon_enter@18.png"; |
1129 | + action: "return" |
1130 | +} |
1131 | |
1132 | === added file 'qml/keys/ShiftKey.qml' |
1133 | --- qml/keys/ShiftKey.qml 1970-01-01 00:00:00 +0000 |
1134 | +++ qml/keys/ShiftKey.qml 2013-09-07 09:02:58 +0000 |
1135 | @@ -0,0 +1,43 @@ |
1136 | +/* |
1137 | + * Copyright 2013 Canonical Ltd. |
1138 | + * |
1139 | + * This program is free software; you can redistribute it and/or modify |
1140 | + * it under the terms of the GNU Lesser General Public License as published by |
1141 | + * the Free Software Foundation; version 3. |
1142 | + * |
1143 | + * This program is distributed in the hope that it will be useful, |
1144 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1145 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1146 | + * GNU Lesser General Public License for more details. |
1147 | + * |
1148 | + * You should have received a copy of the GNU Lesser General Public License |
1149 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1150 | + */ |
1151 | + |
1152 | +import QtQuick 2.0 |
1153 | + |
1154 | +ActionKey { |
1155 | + iconNormal: "../images/icon_shift@18.png"; |
1156 | + iconShifted: "../images/icon_shift_upsidedown@18.png"; |
1157 | + iconCapsLock: "../images/icon_shift_white@18.png"; |
1158 | + action: "shift" |
1159 | + |
1160 | + MouseArea { |
1161 | + anchors.fill: parent |
1162 | + onClicked: { |
1163 | + if (panel.activeKeypad.state == "NORMAL") |
1164 | + panel.activeKeypad.state = "SHIFTED"; |
1165 | + |
1166 | + else if (panel.activeKeypad.state == "SHIFTED") |
1167 | + panel.activeKeypad.state = "NORMAL" |
1168 | + |
1169 | + else if (panel.activeKeypad.state == "CAPSLOCK") |
1170 | + panel.activeKeypad.state = "NORMAL" |
1171 | + } |
1172 | + |
1173 | + onDoubleClicked: { |
1174 | + if (panel.activeKeypad.state == "SHIFTED") |
1175 | + panel.activeKeypad.state = "CAPSLOCK" |
1176 | + } |
1177 | + } |
1178 | +} |
1179 | |
1180 | === added file 'qml/keys/SpaceKey.qml' |
1181 | --- qml/keys/SpaceKey.qml 1970-01-01 00:00:00 +0000 |
1182 | +++ qml/keys/SpaceKey.qml 2013-09-07 09:02:58 +0000 |
1183 | @@ -0,0 +1,24 @@ |
1184 | +/* |
1185 | + * Copyright 2013 Canonical Ltd. |
1186 | + * |
1187 | + * This program is free software; you can redistribute it and/or modify |
1188 | + * it under the terms of the GNU Lesser General Public License as published by |
1189 | + * the Free Software Foundation; version 3. |
1190 | + * |
1191 | + * This program is distributed in the hope that it will be useful, |
1192 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1193 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1194 | + * GNU Lesser General Public License for more details. |
1195 | + * |
1196 | + * You should have received a copy of the GNU Lesser General Public License |
1197 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1198 | + */ |
1199 | + |
1200 | +import QtQuick 2.0 |
1201 | + |
1202 | +ActionKey { |
1203 | + label: " "; |
1204 | + shifted: " "; |
1205 | + |
1206 | + action: "space" |
1207 | +} |
1208 | |
1209 | === added file 'qml/keys/Spacer.qml' |
1210 | --- qml/keys/Spacer.qml 1970-01-01 00:00:00 +0000 |
1211 | +++ qml/keys/Spacer.qml 2013-09-07 09:02:58 +0000 |
1212 | @@ -0,0 +1,26 @@ |
1213 | +/* |
1214 | + * Copyright 2013 Canonical Ltd. |
1215 | + * |
1216 | + * This program is free software; you can redistribute it and/or modify |
1217 | + * it under the terms of the GNU Lesser General Public License as published by |
1218 | + * the Free Software Foundation; version 3. |
1219 | + * |
1220 | + * This program is distributed in the hope that it will be useful, |
1221 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1222 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1223 | + * GNU Lesser General Public License for more details. |
1224 | + * |
1225 | + * You should have received a copy of the GNU Lesser General Public License |
1226 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1227 | + */ |
1228 | + |
1229 | +import QtQuick 2.0 |
1230 | + |
1231 | +/** |
1232 | + * an invisible spacer the size of a regular key. |
1233 | + * This component exists to improve readability. |
1234 | + */ |
1235 | + |
1236 | +Item { |
1237 | + width: panel.keyWidth; |
1238 | +} |
1239 | |
1240 | === added file 'qml/keys/SymbolShiftKey.qml' |
1241 | --- qml/keys/SymbolShiftKey.qml 1970-01-01 00:00:00 +0000 |
1242 | +++ qml/keys/SymbolShiftKey.qml 2013-09-07 09:02:58 +0000 |
1243 | @@ -0,0 +1,37 @@ |
1244 | +/* |
1245 | + * Copyright 2013 Canonical Ltd. |
1246 | + * |
1247 | + * This program is free software; you can redistribute it and/or modify |
1248 | + * it under the terms of the GNU Lesser General Public License as published by |
1249 | + * the Free Software Foundation; version 3. |
1250 | + * |
1251 | + * This program is distributed in the hope that it will be useful, |
1252 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1253 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1254 | + * GNU Lesser General Public License for more details. |
1255 | + * |
1256 | + * You should have received a copy of the GNU Lesser General Public License |
1257 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1258 | + */ |
1259 | + |
1260 | +import QtQuick 2.0 |
1261 | + |
1262 | +import "key_constants.js" as UI |
1263 | + |
1264 | +ActionKey { |
1265 | + label: "?123"; |
1266 | + shifted: "?123"; |
1267 | + action: "symbols"; |
1268 | + |
1269 | + fontSize: units.gu(UI.symbolShiftKeyFontSize); |
1270 | + |
1271 | + MouseArea { |
1272 | + anchors.fill: parent |
1273 | + onClicked: { |
1274 | + if (panel.state == "CHARACTERS") |
1275 | + panel.state = "SYMBOLS"; |
1276 | + else |
1277 | + panel.state = "CHARACTERS"; |
1278 | + } |
1279 | + } |
1280 | +} |
1281 | |
1282 | === added file 'qml/keys/key_constants.js' |
1283 | --- qml/keys/key_constants.js 1970-01-01 00:00:00 +0000 |
1284 | +++ qml/keys/key_constants.js 2013-09-07 09:02:58 +0000 |
1285 | @@ -0,0 +1,47 @@ |
1286 | +/* |
1287 | + * Copyright 2012 Canonical Ltd. |
1288 | + * |
1289 | + * This program is free software; you can redistribute it and/or modify |
1290 | + * it under the terms of the GNU General Public License as published by |
1291 | + * the Free Software Foundation; version 3. |
1292 | + * |
1293 | + * This program is distributed in the hope that it will be useful, |
1294 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1295 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1296 | + * GNU General Public License for more details. |
1297 | + * |
1298 | + * You should have received a copy of the GNU General Public License |
1299 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1300 | + */ |
1301 | + |
1302 | +.pragma library |
1303 | + |
1304 | +var keyMargins = 1.8; // dp |
1305 | +var fontSize = 2; // gu |
1306 | +var fontFamily = "Ubuntu Medium"; |
1307 | +var fontColor = "#666666" |
1308 | +var fontBold = true |
1309 | + |
1310 | +/* magnifier */ |
1311 | +var magnifierHorizontalPadding = 1; // gu, stretch the magnifier a little bit in x-axis |
1312 | +var magnifierVerticalPadding = 1; // gu, stretch the magnifier a little bit in y-axis |
1313 | + |
1314 | +/* special keys */ |
1315 | +var actionKeyPadding = 2; // gu, action keys are a bit bigger |
1316 | +var symbolShiftKeyFontSize = 2; // gu |
1317 | +var urlKeyFontSize = 1.5; // gu |
1318 | + |
1319 | +/* extended keys */ |
1320 | +var popoverCellSize = 4; // gu |
1321 | + |
1322 | +var imageCharKey = "../images/keybg@18.png" |
1323 | +var imageCharKeyPressed = "../images/keybg_action_active@18.png" |
1324 | + |
1325 | +var imageActionKey = "../images/keybg_action@18.png" |
1326 | +var imageActionKeyPressed = "../images/keybg_action_active@18.png" |
1327 | + |
1328 | +var top_margin = 1.35; // gu |
1329 | +var bottom_margin = 1.00; // gu |
1330 | + |
1331 | + |
1332 | +var urlLayoutLeftSpacerSize = 5; // gu |
1333 | |
1334 | === added directory 'qml/languages' |
1335 | === added file 'qml/languages/Keyboard_en_email.qml' |
1336 | --- qml/languages/Keyboard_en_email.qml 1970-01-01 00:00:00 +0000 |
1337 | +++ qml/languages/Keyboard_en_email.qml 2013-09-07 09:02:58 +0000 |
1338 | @@ -0,0 +1,92 @@ |
1339 | +/* |
1340 | + * Copyright 2013 Canonical Ltd. |
1341 | + * |
1342 | + * This program is free software; you can redistribute it and/or modify |
1343 | + * it under the terms of the GNU Lesser General Public License as published by |
1344 | + * the Free Software Foundation; version 3. |
1345 | + * |
1346 | + * This program is distributed in the hope that it will be useful, |
1347 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1348 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1349 | + * GNU Lesser General Public License for more details. |
1350 | + * |
1351 | + * You should have received a copy of the GNU Lesser General Public License |
1352 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1353 | + */ |
1354 | + |
1355 | +import QtQuick 2.0 |
1356 | +import "../keys" |
1357 | + |
1358 | +KeyPad { |
1359 | + anchors.fill: parent |
1360 | + |
1361 | + content: c1 |
1362 | + |
1363 | + Column { |
1364 | + id: c1 |
1365 | + anchors.fill: parent |
1366 | + spacing: 0 |
1367 | + |
1368 | + Row { |
1369 | + anchors.horizontalCenter: parent.horizontalCenter; |
1370 | + spacing: 0 |
1371 | + |
1372 | + CharKey { label: "q"; shifted: "Q"; } |
1373 | + CharKey { label: "w"; shifted: "W"; } |
1374 | + CharKey { label: "e"; shifted: "E"; extended: ["è", "é", "ê", "ë", "€"]; extendedShifted: ["È","É", "Ê", "Ë", "€"] } |
1375 | + CharKey { label: "r"; shifted: "R"; } |
1376 | + CharKey { label: "t"; shifted: "T"; extended: ["þ"]; extendedShifted: ["Þ"] } |
1377 | + CharKey { label: "y"; shifted: "Y"; extended: ["ý", "¥"]; extendedShifted: ["Ý", "¥"] } |
1378 | + CharKey { label: "u"; shifted: "U"; extended: ["û","ù","ú","ü"]; extendedShifted: ["Û","Ù","Ú","Ü"] } |
1379 | + CharKey { label: "i"; shifted: "I"; extended: ["î","ï","ì","í"]; extendedShifted: ["Î","Ï","Ì","Í"] } |
1380 | + CharKey { label: "o"; shifted: "O"; extended: ["ö","ô","ò","ó"]; extendedShifted: ["Ö","Ô","Ò","Ó"] } |
1381 | + CharKey { label: "p"; shifted: "P"; } |
1382 | + } |
1383 | + |
1384 | + Row { |
1385 | + anchors.horizontalCenter: parent.horizontalCenter; |
1386 | + spacing: 0 |
1387 | + |
1388 | + CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"] } |
1389 | + CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] } |
1390 | + CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] } |
1391 | + CharKey { label: "f"; shifted: "F"; } |
1392 | + CharKey { label: "g"; shifted: "G"; } |
1393 | + CharKey { label: "h"; shifted: "H"; } |
1394 | + CharKey { label: "j"; shifted: "J"; } |
1395 | + CharKey { label: "k"; shifted: "K"; } |
1396 | + CharKey { label: "l"; shifted: "L"; } |
1397 | + } |
1398 | + |
1399 | + Row { |
1400 | + anchors.horizontalCenter: parent.horizontalCenter; |
1401 | + spacing: 0 |
1402 | + |
1403 | + ShiftKey {} |
1404 | + CharKey { label: "z"; shifted: "Z"; } |
1405 | + CharKey { label: "x"; shifted: "X"; } |
1406 | + CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] } |
1407 | + CharKey { label: "v"; shifted: "V"; } |
1408 | + CharKey { label: "b"; shifted: "B"; } |
1409 | + CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] } |
1410 | + CharKey { label: "m"; shifted: "M"; } |
1411 | + BackspaceKey {} |
1412 | + } |
1413 | + |
1414 | + Item { |
1415 | + anchors.left: parent.left |
1416 | + anchors.right: parent.right |
1417 | + anchors.horizontalCenter: parent.horizontalCenter; |
1418 | + |
1419 | + height: panel.keyHeight; |
1420 | + |
1421 | + Spacer { id: leftSpacer; anchors.left: parent.left; } |
1422 | + CharKey { id: atKey; label: "@"; shifted: "/"; anchors.left: leftSpacer.right; } |
1423 | + SymbolShiftKey { id: symShiftKey; anchors.left: atKey.right; } |
1424 | + SpaceKey { id: spaceKey; anchors.left: symShiftKey.right; anchors.right: urlKey.left; noMagnifier: true } |
1425 | + CharKey { id: urlKey; label: ".com"; shifted: "/"; anchors.right: dotKey.left; } |
1426 | + CharKey { id: dotKey; label: "."; shifted: "."; anchors.right: enterKey.left; } |
1427 | + ReturnKey { id: enterKey; anchors.right: parent.right } |
1428 | + } |
1429 | + } // column |
1430 | +} |
1431 | |
1432 | === added file 'qml/languages/Keyboard_en_url.qml' |
1433 | --- qml/languages/Keyboard_en_url.qml 1970-01-01 00:00:00 +0000 |
1434 | +++ qml/languages/Keyboard_en_url.qml 2013-09-07 09:02:58 +0000 |
1435 | @@ -0,0 +1,94 @@ |
1436 | +/* |
1437 | + * Copyright 2013 Canonical Ltd. |
1438 | + * |
1439 | + * This program is free software; you can redistribute it and/or modify |
1440 | + * it under the terms of the GNU Lesser General Public License as published by |
1441 | + * the Free Software Foundation; version 3. |
1442 | + * |
1443 | + * This program is distributed in the hope that it will be useful, |
1444 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1445 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1446 | + * GNU Lesser General Public License for more details. |
1447 | + * |
1448 | + * You should have received a copy of the GNU Lesser General Public License |
1449 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1450 | + */ |
1451 | + |
1452 | +import QtQuick 2.0 |
1453 | +import "../keys" |
1454 | +import "../keys/key_constants.js" as UI |
1455 | + |
1456 | +KeyPad { |
1457 | + anchors.fill: parent |
1458 | + |
1459 | + content: c1 |
1460 | + |
1461 | + Column { |
1462 | + id: c1 |
1463 | + anchors.fill: parent |
1464 | + spacing: 0 |
1465 | + |
1466 | + Row { |
1467 | + anchors.horizontalCenter: parent.horizontalCenter; |
1468 | + spacing: 0 |
1469 | + |
1470 | + CharKey { label: "q"; shifted: "Q"; } |
1471 | + CharKey { label: "w"; shifted: "W"; } |
1472 | + CharKey { label: "e"; shifted: "E"; extended: ["è", "é", "ê", "ë", "€"]; extendedShifted: ["È","É", "Ê", "Ë", "€"] } |
1473 | + CharKey { label: "r"; shifted: "R"; } |
1474 | + CharKey { label: "t"; shifted: "T"; extended: ["þ"]; extendedShifted: ["Þ"] } |
1475 | + CharKey { label: "y"; shifted: "Y"; extended: ["ý", "¥"]; extendedShifted: ["Ý", "¥"] } |
1476 | + CharKey { label: "u"; shifted: "U"; extended: ["û","ù","ú","ü"]; extendedShifted: ["Û","Ù","Ú","Ü"] } |
1477 | + CharKey { label: "i"; shifted: "I"; extended: ["î","ï","ì","í"]; extendedShifted: ["Î","Ï","Ì","Í"] } |
1478 | + CharKey { label: "o"; shifted: "O"; extended: ["ö","ô","ò","ó"]; extendedShifted: ["Ö","Ô","Ò","Ó"] } |
1479 | + CharKey { label: "p"; shifted: "P"; } |
1480 | + } |
1481 | + |
1482 | + Row { |
1483 | + anchors.horizontalCenter: parent.horizontalCenter; |
1484 | + spacing: 0 |
1485 | + |
1486 | + CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"] } |
1487 | + CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] } |
1488 | + CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] } |
1489 | + CharKey { label: "f"; shifted: "F"; } |
1490 | + CharKey { label: "g"; shifted: "G"; } |
1491 | + CharKey { label: "h"; shifted: "H"; } |
1492 | + CharKey { label: "j"; shifted: "J"; } |
1493 | + CharKey { label: "k"; shifted: "K"; } |
1494 | + CharKey { label: "l"; shifted: "L"; } |
1495 | + } |
1496 | + |
1497 | + Row { |
1498 | + anchors.horizontalCenter: parent.horizontalCenter; |
1499 | + spacing: 0 |
1500 | + |
1501 | + ShiftKey {} |
1502 | + CharKey { label: "z"; shifted: "Z"; } |
1503 | + CharKey { label: "x"; shifted: "X"; } |
1504 | + CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] } |
1505 | + CharKey { label: "v"; shifted: "V"; } |
1506 | + CharKey { label: "b"; shifted: "B"; } |
1507 | + CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] } |
1508 | + CharKey { label: "m"; shifted: "M"; } |
1509 | + BackspaceKey {} |
1510 | + } |
1511 | + |
1512 | + Item { |
1513 | + anchors.left: parent.left |
1514 | + anchors.right: parent.right |
1515 | + anchors.horizontalCenter: parent.horizontalCenter; |
1516 | + |
1517 | + height: panel.keyHeight; |
1518 | + |
1519 | + Spacer { id: leftSpacer; anchors.left: parent.left; } |
1520 | + CharKey { id: slashKey; label: "/"; shifted: "/"; anchors.left: leftSpacer.right; } |
1521 | + SymbolShiftKey { id: symShiftKey; anchors.left: slashKey.right; } |
1522 | + CharKey { id: urlKey; label: ".com"; shifted: "/"; extended: [".co.uk", ".net", ".org", ".edu", ".gov", ".ac.uk"]; |
1523 | + fontSize: units.gu(UI.urlKeyFontSize); |
1524 | + anchors.left: symShiftKey.right; anchors.right: dotKey.left; } |
1525 | + CharKey { id: dotKey; label: "."; shifted: "."; anchors.right: enterKey.left; } |
1526 | + ReturnKey { id: enterKey; anchors.right: parent.right } |
1527 | + } |
1528 | + } // column |
1529 | +} |
1530 | |
1531 | === added file 'qml/languages/Keyboard_en_url_search.qml' |
1532 | --- qml/languages/Keyboard_en_url_search.qml 1970-01-01 00:00:00 +0000 |
1533 | +++ qml/languages/Keyboard_en_url_search.qml 2013-09-07 09:02:58 +0000 |
1534 | @@ -0,0 +1,94 @@ |
1535 | +/* |
1536 | + * Copyright 2013 Canonical Ltd. |
1537 | + * |
1538 | + * This program is free software; you can redistribute it and/or modify |
1539 | + * it under the terms of the GNU Lesser General Public License as published by |
1540 | + * the Free Software Foundation; version 3. |
1541 | + * |
1542 | + * This program is distributed in the hope that it will be useful, |
1543 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1544 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1545 | + * GNU Lesser General Public License for more details. |
1546 | + * |
1547 | + * You should have received a copy of the GNU Lesser General Public License |
1548 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1549 | + */ |
1550 | + |
1551 | +import QtQuick 2.0 |
1552 | +import "../keys" |
1553 | +import "../keys/key_constants.js" as UI |
1554 | + |
1555 | +KeyPad { |
1556 | + anchors.fill: parent |
1557 | + |
1558 | + content: c1 |
1559 | + |
1560 | + Column { |
1561 | + id: c1 |
1562 | + anchors.fill: parent |
1563 | + |
1564 | + spacing: 0 |
1565 | + |
1566 | + Row { |
1567 | + anchors.horizontalCenter: parent.horizontalCenter; |
1568 | + spacing: 0 |
1569 | + |
1570 | + CharKey { label: "q"; shifted: "Q"; } |
1571 | + CharKey { label: "w"; shifted: "W"; } |
1572 | + CharKey { label: "e"; shifted: "E"; extended: ["è", "é", "ê", "ë", "€"]; extendedShifted: ["È","É", "Ê", "Ë", "€"] } |
1573 | + CharKey { label: "r"; shifted: "R"; } |
1574 | + CharKey { label: "t"; shifted: "T"; extended: ["þ"]; extendedShifted: ["Þ"] } |
1575 | + CharKey { label: "y"; shifted: "Y"; extended: ["ý", "¥"]; extendedShifted: ["Ý", "¥"] } |
1576 | + CharKey { label: "u"; shifted: "U"; extended: ["û","ù","ú","ü"]; extendedShifted: ["Û","Ù","Ú","Ü"] } |
1577 | + CharKey { label: "i"; shifted: "I"; extended: ["î","ï","ì","í"]; extendedShifted: ["Î","Ï","Ì","Í"] } |
1578 | + CharKey { label: "o"; shifted: "O"; extended: ["ö","ô","ò","ó"]; extendedShifted: ["Ö","Ô","Ò","Ó"] } |
1579 | + CharKey { label: "p"; shifted: "P"; } |
1580 | + } |
1581 | + |
1582 | + Row { |
1583 | + anchors.horizontalCenter: parent.horizontalCenter; |
1584 | + spacing: 0 |
1585 | + |
1586 | + CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"] } |
1587 | + CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] } |
1588 | + CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] } |
1589 | + CharKey { label: "f"; shifted: "F"; } |
1590 | + CharKey { label: "g"; shifted: "G"; } |
1591 | + CharKey { label: "h"; shifted: "H"; } |
1592 | + CharKey { label: "j"; shifted: "J"; } |
1593 | + CharKey { label: "k"; shifted: "K"; } |
1594 | + CharKey { label: "l"; shifted: "L"; } |
1595 | + } |
1596 | + |
1597 | + Row { |
1598 | + anchors.horizontalCenter: parent.horizontalCenter; |
1599 | + spacing: 0 |
1600 | + |
1601 | + ShiftKey {} |
1602 | + CharKey { label: "z"; shifted: "Z"; } |
1603 | + CharKey { label: "x"; shifted: "X"; } |
1604 | + CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] } |
1605 | + CharKey { label: "v"; shifted: "V"; } |
1606 | + CharKey { label: "b"; shifted: "B"; } |
1607 | + CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] } |
1608 | + CharKey { label: "m"; shifted: "M"; } |
1609 | + BackspaceKey {} |
1610 | + } |
1611 | + |
1612 | + Item { |
1613 | + anchors.left: parent.left |
1614 | + anchors.right: parent.right |
1615 | + anchors.horizontalCenter: parent.horizontalCenter; |
1616 | + |
1617 | + height: panel.keyHeight; |
1618 | + |
1619 | + Spacer { id: leftSpacer; anchors.left: parent.left; } |
1620 | + CharKey { id: slashKey; label: "/"; shifted: "/"; anchors.left: leftSpacer.right; } |
1621 | + SymbolShiftKey { id: symShiftKey; anchors.left: slashKey.right; } |
1622 | + SpaceKey { id: spaceKey; anchors.left: symShiftKey.right; anchors.right: urlKey.left; noMagnifier: true } |
1623 | + CharKey { id: urlKey; label: ".com"; shifted: "/"; extended: [".co.uk", ".net", ".org", ".edu", ".gov", ".ac.uk"]; fontSize: units.gu(UI.urlKeyFontSize); anchors.right: dotKey.left; } |
1624 | + CharKey { id: dotKey; label: "."; shifted: "."; anchors.right: enterKey.left; } |
1625 | + ReturnKey { id: enterKey; anchors.right: parent.right } |
1626 | + } |
1627 | + } // column |
1628 | +} |
1629 | |
1630 | === added file 'qml/languages/Keyboard_en_us.qml' |
1631 | --- qml/languages/Keyboard_en_us.qml 1970-01-01 00:00:00 +0000 |
1632 | +++ qml/languages/Keyboard_en_us.qml 2013-09-07 09:02:58 +0000 |
1633 | @@ -0,0 +1,90 @@ |
1634 | +/* |
1635 | + * Copyright 2013 Canonical Ltd. |
1636 | + * |
1637 | + * This program is free software; you can redistribute it and/or modify |
1638 | + * it under the terms of the GNU Lesser General Public License as published by |
1639 | + * the Free Software Foundation; version 3. |
1640 | + * |
1641 | + * This program is distributed in the hope that it will be useful, |
1642 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1643 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1644 | + * GNU Lesser General Public License for more details. |
1645 | + * |
1646 | + * You should have received a copy of the GNU Lesser General Public License |
1647 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1648 | + */ |
1649 | + |
1650 | +import QtQuick 2.0 |
1651 | +import "../keys" |
1652 | + |
1653 | +KeyPad { |
1654 | + anchors.fill: parent |
1655 | + |
1656 | + content: c1 |
1657 | + |
1658 | + Column { |
1659 | + id: c1 |
1660 | + anchors.fill: parent |
1661 | + spacing: 0 |
1662 | + |
1663 | + Row { |
1664 | + anchors.horizontalCenter: parent.horizontalCenter; |
1665 | + spacing: 0 |
1666 | + |
1667 | + CharKey { label: "q"; shifted: "Q"; } |
1668 | + CharKey { label: "w"; shifted: "W"; } |
1669 | + CharKey { label: "e"; shifted: "E"; extended: ["è", "é", "ê", "ë", "€"]; extendedShifted: ["È","É", "Ê", "Ë", "€"] } |
1670 | + CharKey { label: "r"; shifted: "R"; } |
1671 | + CharKey { label: "t"; shifted: "T"; extended: ["þ"]; extendedShifted: ["Þ"] } |
1672 | + CharKey { label: "y"; shifted: "Y"; extended: ["ý", "¥"]; extendedShifted: ["Ý", "¥"] } |
1673 | + CharKey { label: "u"; shifted: "U"; extended: ["û","ù","ú","ü"]; extendedShifted: ["Û","Ù","Ú","Ü"] } |
1674 | + CharKey { label: "i"; shifted: "I"; extended: ["î","ï","ì","í"]; extendedShifted: ["Î","Ï","Ì","Í"] } |
1675 | + CharKey { label: "o"; shifted: "O"; extended: ["ö","ô","ò","ó"]; extendedShifted: ["Ö","Ô","Ò","Ó"] } |
1676 | + CharKey { label: "p"; shifted: "P"; } |
1677 | + } |
1678 | + |
1679 | + Row { |
1680 | + anchors.horizontalCenter: parent.horizontalCenter; |
1681 | + spacing: 0 |
1682 | + |
1683 | + CharKey { label: "a"; shifted: "A"; extended: ["ä","à","â","á","ã","å"]; extendedShifted: ["Ä","À","Â","Á","Ã","Å"] } |
1684 | + CharKey { label: "s"; shifted: "S"; extended: ["ß","$"]; extendedShifted: ["$"] } |
1685 | + CharKey { label: "d"; shifted: "D"; extended: ["ð"]; extendedShifted: ["Ð"] } |
1686 | + CharKey { label: "f"; shifted: "F"; } |
1687 | + CharKey { label: "g"; shifted: "G"; } |
1688 | + CharKey { label: "h"; shifted: "H"; } |
1689 | + CharKey { label: "j"; shifted: "J"; } |
1690 | + CharKey { label: "k"; shifted: "K"; } |
1691 | + CharKey { label: "l"; shifted: "L"; } |
1692 | + } |
1693 | + |
1694 | + Row { |
1695 | + anchors.horizontalCenter: parent.horizontalCenter; |
1696 | + spacing: 0 |
1697 | + |
1698 | + ShiftKey {} |
1699 | + CharKey { label: "z"; shifted: "Z"; } |
1700 | + CharKey { label: "x"; shifted: "X"; } |
1701 | + CharKey { label: "c"; shifted: "C"; extended: ["ç"]; extendedShifted: ["Ç"] } |
1702 | + CharKey { label: "v"; shifted: "V"; } |
1703 | + CharKey { label: "b"; shifted: "B"; } |
1704 | + CharKey { label: "n"; shifted: "N"; extended: ["ñ"]; extendedShifted: ["Ñ"] } |
1705 | + CharKey { label: "m"; shifted: "M"; } |
1706 | + BackspaceKey {} |
1707 | + } |
1708 | + |
1709 | + Item { |
1710 | + anchors.left: parent.left |
1711 | + anchors.right: parent.right |
1712 | + anchors.horizontalCenter: parent.horizontalCenter; |
1713 | + |
1714 | + height: panel.keyHeight; |
1715 | + |
1716 | + SymbolShiftKey { id: symShiftKey; anchors.left: parent.left; } |
1717 | + CharKey { id: commaKey; label: ","; shifted: "/"; anchors.left: symShiftKey.right; } |
1718 | + SpaceKey { id: spaceKey; anchors.left: commaKey.right; anchors.right: dotKey.left; noMagnifier: true } |
1719 | + CharKey { id: dotKey; label: "."; shifted: "."; anchors.right: enterKey.left; } |
1720 | + ReturnKey { id: enterKey; anchors.right: parent.right } |
1721 | + } |
1722 | + } // column |
1723 | +} |
1724 | |
1725 | === added file 'qml/languages/Keyboard_numbers.qml' |
1726 | --- qml/languages/Keyboard_numbers.qml 1970-01-01 00:00:00 +0000 |
1727 | +++ qml/languages/Keyboard_numbers.qml 2013-09-07 09:02:58 +0000 |
1728 | @@ -0,0 +1,73 @@ |
1729 | +/* |
1730 | + * Copyright 2013 Canonical Ltd. |
1731 | + * |
1732 | + * This program is free software; you can redistribute it and/or modify |
1733 | + * it under the terms of the GNU Lesser General Public License as published by |
1734 | + * the Free Software Foundation; version 3. |
1735 | + * |
1736 | + * This program is distributed in the hope that it will be useful, |
1737 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1738 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1739 | + * GNU Lesser General Public License for more details. |
1740 | + * |
1741 | + * You should have received a copy of the GNU Lesser General Public License |
1742 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1743 | + */ |
1744 | + |
1745 | +import QtQuick 2.0 |
1746 | +import "../keys" |
1747 | + |
1748 | +KeyPad { |
1749 | + anchors.fill: parent |
1750 | + |
1751 | + content: c1 |
1752 | + |
1753 | + Column { |
1754 | + id: c1 |
1755 | + anchors.fill: parent |
1756 | + anchors.margins: 0; |
1757 | + |
1758 | + spacing: 0 |
1759 | + |
1760 | + Row { |
1761 | + anchors.horizontalCenter: parent.horizontalCenter; |
1762 | + anchors.margins: 50; |
1763 | + spacing: 0 |
1764 | + |
1765 | + CharKey { label: "1"; } |
1766 | + CharKey { label: "2"; } |
1767 | + CharKey { label: "3"; } |
1768 | + } |
1769 | + |
1770 | + Row { |
1771 | + anchors.horizontalCenter: parent.horizontalCenter; |
1772 | + anchors.margins: 50; |
1773 | + spacing: 0 |
1774 | + |
1775 | + CharKey { label: "4"; } |
1776 | + CharKey { label: "5"; } |
1777 | + CharKey { label: "6"; } |
1778 | + } |
1779 | + |
1780 | + Row { |
1781 | + anchors.horizontalCenter: parent.horizontalCenter; |
1782 | + anchors.margins: 50; |
1783 | + spacing: 0 |
1784 | + |
1785 | + CharKey { label: "7"; } |
1786 | + CharKey { label: "8"; } |
1787 | + CharKey { label: "9"; } |
1788 | + } |
1789 | + |
1790 | + Row { |
1791 | + anchors.horizontalCenter: parent.horizontalCenter; |
1792 | + anchors.margins: 50; |
1793 | + spacing: 0 |
1794 | + |
1795 | + CharKey { label: "."; } |
1796 | + CharKey { label: "0"; } |
1797 | + BackspaceKey { padding: 0; } |
1798 | + } |
1799 | + } // column |
1800 | +} |
1801 | + |
1802 | |
1803 | === added file 'qml/languages/Keyboard_symbols.qml' |
1804 | --- qml/languages/Keyboard_symbols.qml 1970-01-01 00:00:00 +0000 |
1805 | +++ qml/languages/Keyboard_symbols.qml 2013-09-07 09:02:58 +0000 |
1806 | @@ -0,0 +1,95 @@ |
1807 | +/* |
1808 | + * Copyright 2013 Canonical Ltd. |
1809 | + * |
1810 | + * This program is free software; you can redistribute it and/or modify |
1811 | + * it under the terms of the GNU Lesser General Public License as published by |
1812 | + * the Free Software Foundation; version 3. |
1813 | + * |
1814 | + * This program is distributed in the hope that it will be useful, |
1815 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1816 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1817 | + * GNU Lesser General Public License for more details. |
1818 | + * |
1819 | + * You should have received a copy of the GNU Lesser General Public License |
1820 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1821 | + */ |
1822 | + |
1823 | +import QtQuick 2.0 |
1824 | +import "../keys" |
1825 | + |
1826 | +KeyPad { |
1827 | + anchors.fill: parent |
1828 | + |
1829 | + content: c1 |
1830 | + |
1831 | + Column { |
1832 | + id: c1 |
1833 | + anchors.fill: parent |
1834 | + anchors.margins: 0; |
1835 | + |
1836 | + spacing: 0 |
1837 | + |
1838 | + Row { |
1839 | + anchors.horizontalCenter: parent.horizontalCenter; |
1840 | + anchors.margins: 50; |
1841 | + spacing: 0 |
1842 | + |
1843 | + CharKey { label: "1"; shifted: "€"; } |
1844 | + CharKey { label: "2"; shifted: "£"; } |
1845 | + CharKey { label: "3"; shifted: "$"; extended: ["È","€"] } |
1846 | + CharKey { label: "4"; shifted: "¥"; } |
1847 | + CharKey { label: "5"; shifted: "₹"; } |
1848 | + CharKey { label: "6"; shifted: "%"; } |
1849 | + CharKey { label: "7"; shifted: "<"; } |
1850 | + CharKey { label: "8"; shifted: ">"; } |
1851 | + CharKey { label: "9"; shifted: "["; } |
1852 | + CharKey { label: "0"; shifted: "]"; } |
1853 | + } |
1854 | + |
1855 | + Row { |
1856 | + anchors.horizontalCenter: parent.horizontalCenter; |
1857 | + anchors.margins: 50; |
1858 | + spacing: 0 |
1859 | + |
1860 | + CharKey { label: "*"; shifted: "`"; } |
1861 | + CharKey { label: "#"; shifted: "^"; } |
1862 | + CharKey { label: "+"; shifted: "|"; } |
1863 | + CharKey { label: "-"; shifted: "_"; } |
1864 | + CharKey { label: "="; shifted: "§"; } |
1865 | + CharKey { label: "("; shifted: "{"; } |
1866 | + CharKey { label: ")"; shifted: "}"; } |
1867 | + CharKey { label: "!"; shifted: "¡"; } |
1868 | + CharKey { label: "?"; shifted: "¿"; } |
1869 | + } |
1870 | + |
1871 | + Row { |
1872 | + anchors.horizontalCenter: parent.horizontalCenter; |
1873 | + anchors.margins: 50; |
1874 | + spacing: 0 |
1875 | + |
1876 | + OneTwoKey { label: "1/2"; shifted: "2/2"; fontSize: units.gu(3); } |
1877 | + CharKey { label: "@"; shifted: "«"; } |
1878 | + CharKey { label: "~"; shifted: "»"; } |
1879 | + CharKey { label: "/"; shifted: "¨"; } |
1880 | + CharKey { label: "\\"; shifted: "“"; } |
1881 | + CharKey { label: "'"; shifted: "”"; } |
1882 | + CharKey { label: ";"; shifted: "„"; } |
1883 | + CharKey { label: ":"; shifted: "&"; } |
1884 | + BackspaceKey {} |
1885 | + } |
1886 | + |
1887 | + Item { |
1888 | + anchors.left: parent.left |
1889 | + anchors.right: parent.right |
1890 | + anchors.horizontalCenter: parent.horizontalCenter; |
1891 | + |
1892 | + height: panel.keyHeight; |
1893 | + |
1894 | + SymbolShiftKey { id: symShiftKey; label: "ABC"; shifted: "ABC"; anchors.left: parent.left; } |
1895 | + CharKey { id: commaKey; label: ","; shifted: "/"; anchors.left: symShiftKey.right; } |
1896 | + CharKey { id: spaceKey; label: " "; shifted: " "; anchors.left: commaKey.right; anchors.right: dotKey.left; noMagnifier: true } |
1897 | + CharKey { id: dotKey; label: "."; shifted: "."; anchors.right: enterKey.left; } |
1898 | + ReturnKey { id: enterKey; anchors.right: parent.right } |
1899 | + } |
1900 | + } // column |
1901 | +} |
1902 | |
1903 | === added file 'qml/languages/Keyboard_telephone.qml' |
1904 | --- qml/languages/Keyboard_telephone.qml 1970-01-01 00:00:00 +0000 |
1905 | +++ qml/languages/Keyboard_telephone.qml 2013-09-07 09:02:58 +0000 |
1906 | @@ -0,0 +1,73 @@ |
1907 | +/* |
1908 | + * Copyright 2013 Canonical Ltd. |
1909 | + * |
1910 | + * This program is free software; you can redistribute it and/or modify |
1911 | + * it under the terms of the GNU Lesser General Public License as published by |
1912 | + * the Free Software Foundation; version 3. |
1913 | + * |
1914 | + * This program is distributed in the hope that it will be useful, |
1915 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1916 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1917 | + * GNU Lesser General Public License for more details. |
1918 | + * |
1919 | + * You should have received a copy of the GNU Lesser General Public License |
1920 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1921 | + */ |
1922 | + |
1923 | +import QtQuick 2.0 |
1924 | +import "../keys" |
1925 | + |
1926 | +KeyPad { |
1927 | + anchors.fill: parent |
1928 | + |
1929 | + content: c1 |
1930 | + |
1931 | + Column { |
1932 | + id: c1 |
1933 | + anchors.fill: parent |
1934 | + anchors.margins: 0; |
1935 | + |
1936 | + spacing: 0 |
1937 | + |
1938 | + Row { |
1939 | + anchors.horizontalCenter: parent.horizontalCenter; |
1940 | + anchors.margins: 50; |
1941 | + spacing: 0 |
1942 | + |
1943 | + CharKey { label: "1"; } |
1944 | + CharKey { label: "2"; } |
1945 | + CharKey { label: "3"; } |
1946 | + } |
1947 | + |
1948 | + Row { |
1949 | + anchors.horizontalCenter: parent.horizontalCenter; |
1950 | + anchors.margins: 50; |
1951 | + spacing: 0 |
1952 | + |
1953 | + CharKey { label: "4"; } |
1954 | + CharKey { label: "5"; } |
1955 | + CharKey { label: "6"; } |
1956 | + } |
1957 | + |
1958 | + Row { |
1959 | + anchors.horizontalCenter: parent.horizontalCenter; |
1960 | + anchors.margins: 50; |
1961 | + spacing: 0 |
1962 | + |
1963 | + CharKey { label: "7"; } |
1964 | + CharKey { label: "8"; } |
1965 | + CharKey { label: "9"; } |
1966 | + } |
1967 | + |
1968 | + Row { |
1969 | + anchors.horizontalCenter: parent.horizontalCenter; |
1970 | + anchors.margins: 50; |
1971 | + spacing: 0 |
1972 | + |
1973 | + CharKey { label: "+"; extended: ["*", "(", ")"] } |
1974 | + CharKey { label: "0"; } |
1975 | + BackspaceKey { padding: 0; } |
1976 | + } |
1977 | + } // column |
1978 | +} |
1979 | + |
1980 | |
1981 | === removed file 'qml/maliit-keyboard-extended.qml' |
1982 | --- qml/maliit-keyboard-extended.qml 2013-07-19 12:05:07 +0000 |
1983 | +++ qml/maliit-keyboard-extended.qml 1970-01-01 00:00:00 +0000 |
1984 | @@ -1,49 +0,0 @@ |
1985 | -/* |
1986 | - * This file is part of Maliit plugins |
1987 | - * |
1988 | - * Copyright (C) 2012 Openismus GmbH |
1989 | - * |
1990 | - * Contact: maliit-discuss@lists.maliit.org |
1991 | - * |
1992 | - * Redistribution and use in source and binary forms, with or without modification, |
1993 | - * are permitted provided that the following conditions are met: |
1994 | - * |
1995 | - * Redistributions of source code must retain the above copyright notice, this list |
1996 | - * of conditions and the following disclaimer. |
1997 | - * Redistributions in binary form must reproduce the above copyright notice, this list |
1998 | - * of conditions and the following disclaimer in the documentation and/or other materials |
1999 | - * provided with the distribution. |
2000 | - * Neither the name of Nokia Corporation nor the names of its contributors may be |
2001 | - * used to endorse or promote products derived from this software without specific |
2002 | - * prior written permission. |
2003 | - * |
2004 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
2005 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
2006 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
2007 | - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
2008 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
2009 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
2010 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
2011 | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
2012 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2013 | - * |
2014 | - */ |
2015 | - |
2016 | -import QtQuick 2.0 |
2017 | - |
2018 | -Keyboard { |
2019 | - layout: maliit_extended_layout |
2020 | - event_handler: maliit_extended_event_handler |
2021 | - area_enabled: maliit_extended_layout.visible |
2022 | - |
2023 | - opacity: visible ? 1.0 : 0.0 |
2024 | - |
2025 | - // Only animates appearance because we reset extended keys model |
2026 | - // immediately after selecting a key. |
2027 | - Behavior on opacity { |
2028 | - PropertyAnimation { |
2029 | - duration: 300 |
2030 | - easing.type: Easing.InOutQuad |
2031 | - } |
2032 | - } |
2033 | -} |
2034 | |
2035 | === removed file 'qml/maliit-keyboard.qml' |
2036 | --- qml/maliit-keyboard.qml 2013-07-19 12:05:07 +0000 |
2037 | +++ qml/maliit-keyboard.qml 1970-01-01 00:00:00 +0000 |
2038 | @@ -1,37 +0,0 @@ |
2039 | -/* |
2040 | - * This file is part of Maliit plugins |
2041 | - * |
2042 | - * Copyright (C) 2012 Openismus GmbH |
2043 | - * |
2044 | - * Contact: maliit-discuss@lists.maliit.org |
2045 | - * |
2046 | - * Redistribution and use in source and binary forms, with or without modification, |
2047 | - * are permitted provided that the following conditions are met: |
2048 | - * |
2049 | - * Redistributions of source code must retain the above copyright notice, this list |
2050 | - * of conditions and the following disclaimer. |
2051 | - * Redistributions in binary form must reproduce the above copyright notice, this list |
2052 | - * of conditions and the following disclaimer in the documentation and/or other materials |
2053 | - * provided with the distribution. |
2054 | - * Neither the name of Nokia Corporation nor the names of its contributors may be |
2055 | - * used to endorse or promote products derived from this software without specific |
2056 | - * prior written permission. |
2057 | - * |
2058 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
2059 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
2060 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
2061 | - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
2062 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
2063 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
2064 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
2065 | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
2066 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2067 | - * |
2068 | - */ |
2069 | - |
2070 | -Keyboard { |
2071 | - layout: maliit_layout |
2072 | - event_handler: maliit_event_handler |
2073 | - area_enabled: !maliit_extended_layout.visible |
2074 | - title: maliit_layout.title |
2075 | -} |
2076 | |
2077 | === removed file 'qml/maliit-magnifier.qml' |
2078 | --- qml/maliit-magnifier.qml 2013-07-19 12:05:07 +0000 |
2079 | +++ qml/maliit-magnifier.qml 1970-01-01 00:00:00 +0000 |
2080 | @@ -1,36 +0,0 @@ |
2081 | -/* |
2082 | - * This file is part of Maliit plugins |
2083 | - * |
2084 | - * Copyright (C) 2012 Openismus GmbH |
2085 | - * |
2086 | - * Contact: maliit-discuss@lists.maliit.org |
2087 | - * |
2088 | - * Redistribution and use in source and binary forms, with or without modification, |
2089 | - * are permitted provided that the following conditions are met: |
2090 | - * |
2091 | - * Redistributions of source code must retain the above copyright notice, this list |
2092 | - * of conditions and the following disclaimer. |
2093 | - * Redistributions in binary form must reproduce the above copyright notice, this list |
2094 | - * of conditions and the following disclaimer in the documentation and/or other materials |
2095 | - * provided with the distribution. |
2096 | - * Neither the name of Nokia Corporation nor the names of its contributors may be |
2097 | - * used to endorse or promote products derived from this software without specific |
2098 | - * prior written permission. |
2099 | - * |
2100 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
2101 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
2102 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
2103 | - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
2104 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
2105 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
2106 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
2107 | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
2108 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2109 | - * |
2110 | - */ |
2111 | - |
2112 | -Keyboard { |
2113 | - layout: maliit_magnifier_layout |
2114 | - area_enabled: false |
2115 | - visible: !maliit_extended_layout.visible |
2116 | -} |
2117 | |
2118 | === added file 'qml/prototype.qmlproject' |
2119 | --- qml/prototype.qmlproject 1970-01-01 00:00:00 +0000 |
2120 | +++ qml/prototype.qmlproject 2013-09-07 09:02:58 +0000 |
2121 | @@ -0,0 +1,21 @@ |
2122 | +/* File generated by Qt Creator, version 2.7.0 */ |
2123 | + |
2124 | +import QmlProject 1.1 |
2125 | + |
2126 | +Project { |
2127 | + mainFile: "KeyboardContainer.qml" |
2128 | + |
2129 | + /* Include .qml, .js, and image files from current directory and subdirectories */ |
2130 | + QmlFiles { |
2131 | + directory: [".", "keys", "languages"]; |
2132 | + } |
2133 | + |
2134 | + JavaScriptFiles { |
2135 | + directory: "." |
2136 | + } |
2137 | + ImageFiles { |
2138 | + directory: "." |
2139 | + } |
2140 | + /* List of plugin directories passed to QML runtime */ |
2141 | + importPaths: [ "keys", ".", "languages" ] |
2142 | +} |
2143 | |
2144 | === modified file 'qml/qml.pro' |
2145 | --- qml/qml.pro 2013-08-27 12:45:27 +0000 |
2146 | +++ qml/qml.pro 2013-09-07 09:02:58 +0000 |
2147 | @@ -6,7 +6,18 @@ |
2148 | qml.path = $$UBUNTU_KEYBOARD_DATA_DIR |
2149 | qml.files = *.qml *.js |
2150 | |
2151 | -INSTALLS += qml |
2152 | +qml_keys.path = "$$UBUNTU_KEYBOARD_DATA_DIR/keys" |
2153 | +qml_keys.files = keys/*.qml keys/*.js |
2154 | + |
2155 | +qml_languages.path = "$$UBUNTU_KEYBOARD_DATA_DIR/languages" |
2156 | +qml_languages.files = languages/*.qml languages/*.js |
2157 | + |
2158 | +images.path = "$$UBUNTU_KEYBOARD_DATA_DIR/images" |
2159 | +images.files = images/*.png |
2160 | + |
2161 | +INSTALLS += qml qml_keys qml_languages images |
2162 | + |
2163 | +# for QtCreator |
2164 | OTHER_FILES += \ |
2165 | maliit-keyboard.qml \ |
2166 | maliit-keyboard-extended.qml \ |
2167 | @@ -16,5 +27,25 @@ |
2168 | RotationHelper.qml \ |
2169 | WordRibbon.qml \ |
2170 | Popper.qml \ |
2171 | - constants.js \ |
2172 | + KeyboardContainer.qml \ |
2173 | + languages/Keyboard_symbols.qml \ |
2174 | + languages/Keyboard_en_us.qml \ |
2175 | + keys/key_constants.js \ |
2176 | + keys/KeyPad.qml \ |
2177 | + keys/CharKey.qml \ |
2178 | + keys/ActionKey.qml \ |
2179 | + keys/BackspaceKey.qml \ |
2180 | + keys/ShiftKey.qml \ |
2181 | + keys/SymbolShiftKey.qml \ |
2182 | + keys/ReturnKey.qml \ |
2183 | + keys/Popper.qml \ |
2184 | + keys/OneTwoKey.qml \ |
2185 | + languages/Keyboard_en_url.qml \ |
2186 | + languages/Keyboard_en_url_search.qml \ |
2187 | + languages/Keyboard_en_email.qml \ |
2188 | + languages/Keyboard_numbers.qml \ |
2189 | + languages/Keyboard_telephone.qml \ |
2190 | + keys/ExtendedKeysSelector.qml \ |
2191 | + keys/SpaceKey.qml \ |
2192 | + keys/Spacer.qml |
2193 | |
2194 | |
2195 | === modified file 'src/lib/logic/eventhandler.cpp' |
2196 | --- src/lib/logic/eventhandler.cpp 2013-07-19 12:05:07 +0000 |
2197 | +++ src/lib/logic/eventhandler.cpp 2013-09-07 09:02:58 +0000 |
2198 | @@ -213,4 +213,37 @@ |
2199 | d->updater->setActiveKeyboardId(languageId); |
2200 | } |
2201 | |
2202 | +void EventHandler::onKeyPressed(QString label) |
2203 | +{ |
2204 | + Key key; |
2205 | + Label mlabel; |
2206 | + mlabel.setText(label); |
2207 | + key.setLabel(mlabel); |
2208 | + |
2209 | + Q_EMIT keyPressed(key); |
2210 | +} |
2211 | + |
2212 | +void EventHandler::onKeyReleased(QString label, QString action) |
2213 | +{ |
2214 | + Key key; |
2215 | + Label mlabel; |
2216 | + mlabel.setText(label); |
2217 | + key.setLabel(mlabel); |
2218 | + |
2219 | + if (action == "return") |
2220 | + key.setAction(Key::ActionReturn); |
2221 | + else if (action == "backspace") |
2222 | + key.setAction(Key::ActionBackspace); |
2223 | + else if (action == "space") |
2224 | + key.setAction(Key::ActionSpace); |
2225 | + else if (action == "shift") |
2226 | + key.setAction(Key::ActionShift); |
2227 | + else |
2228 | + key.setAction(Key::ActionInsert); |
2229 | + |
2230 | + Q_EMIT keyReleased(key); |
2231 | +} |
2232 | + |
2233 | + |
2234 | + |
2235 | }} // namespace Logic, MaliitKeyboard |
2236 | |
2237 | === modified file 'src/lib/logic/eventhandler.h' |
2238 | --- src/lib/logic/eventhandler.h 2013-07-19 12:05:07 +0000 |
2239 | +++ src/lib/logic/eventhandler.h 2013-09-07 09:02:58 +0000 |
2240 | @@ -75,6 +75,9 @@ |
2241 | Q_INVOKABLE void onWordCandidateReleased(QString word); |
2242 | Q_INVOKABLE void onLanguageChangeRequested(QString languageId); |
2243 | |
2244 | + Q_INVOKABLE void onKeyPressed(QString label); |
2245 | + Q_INVOKABLE void onKeyReleased(QString label, QString action = ""); |
2246 | + |
2247 | // Key signals: |
2248 | Q_SIGNAL void keyPressed(const Key &key); |
2249 | Q_SIGNAL void keyLongPressed(const Key &key); |
2250 | |
2251 | === modified file 'src/plugin/inputmethod.cpp' |
2252 | --- src/plugin/inputmethod.cpp 2013-08-24 05:01:54 +0000 |
2253 | +++ src/plugin/inputmethod.cpp 2013-09-07 09:02:58 +0000 |
2254 | @@ -30,10 +30,7 @@ |
2255 | */ |
2256 | |
2257 | #include "inputmethod.h" |
2258 | -#include "editor.h" |
2259 | -#include "updatenotifier.h" |
2260 | -#include "maliitcontext.h" |
2261 | -#include "ubuntuapplicationapiwrapper.h" |
2262 | +#include "inputmethod_p.h" |
2263 | |
2264 | #include "models/key.h" |
2265 | #include "models/keyarea.h" |
2266 | @@ -41,48 +38,31 @@ |
2267 | #include "models/layout.h" |
2268 | |
2269 | #include "logic/layouthelper.h" |
2270 | -#include "logic/layoutupdater.h" |
2271 | -#include "logic/wordengine.h" |
2272 | + |
2273 | #include "logic/style.h" |
2274 | -#include "logic/languagefeatures.h" |
2275 | -#include "logic/eventhandler.h" |
2276 | + |
2277 | #include "logic/keyareaconverter.h" |
2278 | -#include "logic/dynamiclayout.h" |
2279 | |
2280 | #include "view/setup.h" |
2281 | |
2282 | -#ifdef HAVE_QT_MOBILITY |
2283 | -#include "view/soundfeedback.h" |
2284 | -typedef MaliitKeyboard::SoundFeedback DefaultFeedback; |
2285 | -#else |
2286 | -#include "view/nullfeedback.h" |
2287 | -typedef MaliitKeyboard::NullFeedback DefaultFeedback; |
2288 | -#endif |
2289 | - |
2290 | #include <maliit/plugins/subviewdescription.h> |
2291 | -#include <maliit/plugins/abstractpluginsetting.h> |
2292 | + |
2293 | #include <maliit/plugins/updateevent.h> |
2294 | -#include <maliit/plugins/abstractinputmethodhost.h> |
2295 | + |
2296 | #include <maliit/namespace.h> |
2297 | |
2298 | #include <QApplication> |
2299 | #include <QWidget> |
2300 | #include <QDesktopWidget> |
2301 | -#include <QtQuick> |
2302 | + |
2303 | |
2304 | class MImUpdateEvent; |
2305 | |
2306 | namespace MaliitKeyboard { |
2307 | |
2308 | -typedef QScopedPointer<Maliit::Plugins::AbstractPluginSetting> ScopedSetting; |
2309 | -typedef QSharedPointer<MKeyOverride> SharedOverride; |
2310 | -typedef QMap<QString, SharedOverride>::const_iterator OverridesIterator; |
2311 | - |
2312 | namespace { |
2313 | |
2314 | -const QString g_maliit_keyboard_qml(UBUNTU_KEYBOARD_DATA_DIR "/maliit-keyboard.qml"); |
2315 | -const QString g_maliit_keyboard_extended_qml(UBUNTU_KEYBOARD_DATA_DIR "/maliit-keyboard-extended.qml"); |
2316 | -const QString g_maliit_magnifier_qml(UBUNTU_KEYBOARD_DATA_DIR "/maliit-magnifier.qml"); |
2317 | +const QString g_maliit_keyboard_qml(UBUNTU_KEYBOARD_DATA_DIR "/Keyboard.qml"); |
2318 | |
2319 | Key overrideToKey(const SharedOverride &override) |
2320 | { |
2321 | @@ -98,314 +78,6 @@ |
2322 | |
2323 | } // unnamed namespace |
2324 | |
2325 | -class Settings |
2326 | -{ |
2327 | -public: |
2328 | - ScopedSetting style; |
2329 | - ScopedSetting feedback; |
2330 | - ScopedSetting auto_correct; |
2331 | - ScopedSetting auto_caps; |
2332 | - ScopedSetting word_engine; |
2333 | -}; |
2334 | - |
2335 | -class LayoutGroup |
2336 | -{ |
2337 | -public: |
2338 | - Logic::LayoutHelper helper; |
2339 | - Logic::LayoutUpdater updater; |
2340 | - Model::Layout model; |
2341 | - Logic::EventHandler event_handler; |
2342 | - |
2343 | - explicit LayoutGroup(); |
2344 | -}; |
2345 | - |
2346 | -LayoutGroup::LayoutGroup() |
2347 | - : helper() |
2348 | - , updater() |
2349 | - , model() |
2350 | - , event_handler(&model, &updater) |
2351 | -{} |
2352 | - |
2353 | -QQuickView *createWindow(MAbstractInputMethodHost *host) |
2354 | -{ |
2355 | - QScopedPointer<QQuickView> view(new QQuickView); |
2356 | - |
2357 | - QSurfaceFormat format; |
2358 | - format.setAlphaBufferSize(8); |
2359 | - view->setFormat(format); |
2360 | - view->setColor(QColor(Qt::transparent)); |
2361 | - |
2362 | - host->registerWindow(view.data(), Maliit::PositionCenterBottom); |
2363 | - |
2364 | - return view.take(); |
2365 | -} |
2366 | - |
2367 | -class InputMethodPrivate |
2368 | -{ |
2369 | -public: |
2370 | - InputMethod* q; |
2371 | - QQuickItem* qmlRootItem; |
2372 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2373 | - SharedSurface extended_surface; |
2374 | - SharedSurface magnifier_surface; |
2375 | -#endif |
2376 | - Editor editor; |
2377 | - DefaultFeedback feedback; |
2378 | - SharedStyle style; |
2379 | - UpdateNotifier notifier; |
2380 | - QMap<QString, SharedOverride> key_overrides; |
2381 | - Settings settings; |
2382 | - LayoutGroup layout; |
2383 | - LayoutGroup extended_layout; |
2384 | - Model::Layout magnifier_layout; |
2385 | - MaliitContext context; |
2386 | - QRect windowGeometryRect; |
2387 | - QRect keyboardVisibleRect; |
2388 | - MAbstractInputMethodHost* host; |
2389 | - QQuickView* view; |
2390 | - UbuntuApplicationApiWrapper* applicationApiWrapper; |
2391 | - |
2392 | - bool predictionEnabled; |
2393 | - Maliit::TextContentType contentType; |
2394 | - QString activeLanguageId; |
2395 | - |
2396 | - explicit InputMethodPrivate(InputMethod * const q, |
2397 | - MAbstractInputMethodHost *host); |
2398 | - ~InputMethodPrivate(); |
2399 | - void setLayoutOrientation(Qt::ScreenOrientation qtOrientation); |
2400 | - void updateKeyboardOrientation(); |
2401 | - void updateWordRibbon(); |
2402 | - |
2403 | - void setActiveKeyboardId(const QString& id); |
2404 | - void connectToNotifier(); |
2405 | - void setContextProperties(QQmlContext *qml_context); |
2406 | -}; |
2407 | - |
2408 | - |
2409 | -InputMethodPrivate::InputMethodPrivate(InputMethod *const _q, |
2410 | - MAbstractInputMethodHost *host) |
2411 | - // : surface_factory(host->surfaceFactory()) |
2412 | - // , surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_surface_options))) |
2413 | - : q(_q) |
2414 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2415 | - , extended_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface))) |
2416 | - , magnifier_surface(qSharedPointerDynamicCast<Surface>(surface_factory->create(g_extended_surface_options, surface))) |
2417 | -#endif |
2418 | - , qmlRootItem(0) |
2419 | - , editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures) |
2420 | - , feedback() |
2421 | - , style(new Style) |
2422 | - , notifier() |
2423 | - , key_overrides() |
2424 | - , settings() |
2425 | - , layout() |
2426 | - , extended_layout() |
2427 | - , magnifier_layout() |
2428 | - , context(q, style) |
2429 | - , host(host) |
2430 | - , view(0) |
2431 | - , applicationApiWrapper(new UbuntuApplicationApiWrapper) |
2432 | - , predictionEnabled(false) |
2433 | - , contentType(Maliit::FreeTextContentType) |
2434 | - , activeLanguageId("en_us") |
2435 | -{ |
2436 | - view = createWindow(host); |
2437 | - |
2438 | - editor.setHost(host); |
2439 | - |
2440 | - layout.updater.setLayout(&layout.helper); |
2441 | - extended_layout.updater.setLayout(&extended_layout.helper); |
2442 | - |
2443 | - layout.updater.setStyle(style); |
2444 | - extended_layout.updater.setStyle(style); |
2445 | - feedback.setStyle(style); |
2446 | - |
2447 | - const QSize &screen_size(view->screen()->size()); |
2448 | - layout.helper.setScreenSize(screen_size); |
2449 | - layout.helper.setAlignment(Logic::LayoutHelper::Bottom); |
2450 | - extended_layout.helper.setScreenSize(screen_size); |
2451 | - extended_layout.helper.setAlignment(Logic::LayoutHelper::Floating); |
2452 | - |
2453 | - QObject::connect(&layout.event_handler, SIGNAL(wordCandidatePressed(WordCandidate)), |
2454 | - &layout.updater, SLOT( onWordCandidatePressed(WordCandidate) )); |
2455 | - |
2456 | - QObject::connect(&layout.event_handler, SIGNAL(wordCandidateReleased(WordCandidate)), |
2457 | - &layout.updater, SLOT( onWordCandidateReleased(WordCandidate) )); |
2458 | - |
2459 | - QObject::connect(&editor, SIGNAL(preeditEnabledChanged(bool)), |
2460 | - &layout.updater, SLOT(setWordRibbonVisible(bool))); |
2461 | - |
2462 | - QObject::connect(&layout.updater, SIGNAL(wordCandidateSelected(QString)), |
2463 | - editor.wordEngine(), SLOT(onWordCandidateSelected(QString))); |
2464 | - |
2465 | - QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), |
2466 | - editor.wordEngine(), SLOT(onLanguageChanged(QString))); |
2467 | - |
2468 | - QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), |
2469 | - &editor, SLOT(onLanguageChanged(const QString&))); |
2470 | - |
2471 | - QObject::connect(&layout.helper, SIGNAL(stateChanged(Model::Layout::State)), |
2472 | - &layout.model, SLOT(setState(Model::Layout::State))); |
2473 | - |
2474 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2475 | - QObject::connect(&layout.event_handler, SIGNAL(extendedKeysShown(Key)), |
2476 | - &extended_layout.event_handler, SLOT(onExtendedKeysShown(Key))); |
2477 | -#endif |
2478 | - connectToNotifier(); |
2479 | - |
2480 | -#ifdef DISABLED_FLAGS_FROM_SURFACE |
2481 | - view->setFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint |
2482 | - | Qt::X11BypassWindowManagerHint | Qt::WindowDoesNotAcceptFocus); |
2483 | -#endif |
2484 | - view->setWindowState(Qt::WindowNoState); |
2485 | - |
2486 | - QSurfaceFormat format; |
2487 | - format.setAlphaBufferSize(8); |
2488 | - view->setFormat(format); |
2489 | - view->setColor(QColor(Qt::transparent)); |
2490 | - |
2491 | - view->setVisible(false); |
2492 | - |
2493 | - // TODO: Figure out whether two views can share one engine. |
2494 | - QQmlEngine *const engine(view->engine()); |
2495 | - engine->addImportPath(UBUNTU_KEYBOARD_DATA_DIR); |
2496 | - setContextProperties(engine->rootContext()); |
2497 | - |
2498 | - QObject::connect(view, SIGNAL(statusChanged(QQuickView::Status)), |
2499 | - q, SLOT(onQQuickViewStatusChanged(QQuickView::Status))); |
2500 | - |
2501 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2502 | - QQmlEngine *const extended_engine(extended_surface->view()->engine()); |
2503 | - extended_engine->addImportPath(UBUNTU_KEYBOARD_DATA_DIR); |
2504 | - setContextProperties(extended_engine->rootContext()); |
2505 | - |
2506 | - extended_surface->view()->setSource(QUrl::fromLocalFile(g_maliit_keyboard_extended_qml)); |
2507 | - |
2508 | - QQmlEngine *const magnifier_engine(magnifier_surface->view()->engine()); |
2509 | - magnifier_engine->addImportPath(UBUNTU_KEYBOARD_DATA_DIR); |
2510 | - setContextProperties(magnifier_engine->rootContext()); |
2511 | - |
2512 | - magnifier_surface->view()->setSource(QUrl::fromLocalFile(g_maliit_magnifier_qml)); |
2513 | -#endif |
2514 | - |
2515 | - // following used to help shell identify the OSK surface |
2516 | - view->setProperty("role", applicationApiWrapper->oskWindowRole()); |
2517 | - view->setTitle("MaliitOnScreenKeyboard"); |
2518 | - |
2519 | - // workaround: resizeMode not working in current qpa imlementation |
2520 | - // http://qt-project.org/doc/qt-5.0/qtquick/qquickview.html#ResizeMode-enum |
2521 | - view->setResizeMode(QQuickView::SizeRootObjectToView); |
2522 | -} |
2523 | - |
2524 | -InputMethodPrivate::~InputMethodPrivate() |
2525 | -{ |
2526 | - delete applicationApiWrapper; |
2527 | -} |
2528 | - |
2529 | -void InputMethodPrivate::updateWordRibbon() |
2530 | -{ |
2531 | - layout.helper.wordRibbon()->setEnabled( predictionEnabled ); |
2532 | - Q_EMIT q->wordRibbonEnabledChanged( predictionEnabled ); |
2533 | - qmlRootItem->setProperty("wordribbon_visible", predictionEnabled ); |
2534 | - |
2535 | - updateKeyboardOrientation(); |
2536 | -} |
2537 | - |
2538 | -void InputMethodPrivate::setLayoutOrientation(Qt::ScreenOrientation screenOrientation) |
2539 | -{ |
2540 | - Logic::LayoutHelper::Orientation orientation = uiConst->screenToMaliitOrientation(screenOrientation); |
2541 | - |
2542 | - layout.updater.setOrientation(orientation); |
2543 | - extended_layout.updater.setOrientation(orientation); |
2544 | - |
2545 | - windowGeometryRect = uiConst->windowGeometryRect( screenOrientation ); |
2546 | - |
2547 | - keyboardVisibleRect = windowGeometryRect.adjusted(0,uiConst->invisibleTouchAreaHeight(orientation),0,0); |
2548 | - |
2549 | - // qpa does not rotate the coordinate system |
2550 | - windowGeometryRect = qGuiApp->primaryScreen()->mapBetween( |
2551 | - screenOrientation, |
2552 | - qGuiApp->primaryScreen()->primaryOrientation(), |
2553 | - windowGeometryRect); |
2554 | - |
2555 | - |
2556 | - view->setGeometry(windowGeometryRect); |
2557 | - |
2558 | - if (qmlRootItem->property("shown").toBool()) { |
2559 | - host->setScreenRegion(QRegion(keyboardVisibleRect)); |
2560 | - |
2561 | - QRect rect(keyboardVisibleRect); |
2562 | - rect.moveTop( windowGeometryRect.height() - keyboardVisibleRect.height() ); |
2563 | - host->setInputMethodArea(rect, view); |
2564 | - } |
2565 | - |
2566 | - qmlRootItem->setProperty("contentOrientation", screenOrientation); |
2567 | - |
2568 | - if (qmlRootItem->property("shown").toBool()) { |
2569 | - applicationApiWrapper->reportOSKInvisible(); |
2570 | - |
2571 | - qDebug() << "keyboard is reporting: total <x y w h>: <" |
2572 | - << windowGeometryRect.x() |
2573 | - << windowGeometryRect.y() |
2574 | - << windowGeometryRect.width() |
2575 | - << windowGeometryRect.height() |
2576 | - << "> and visible <" |
2577 | - << keyboardVisibleRect.x() |
2578 | - << keyboardVisibleRect.y() |
2579 | - << keyboardVisibleRect.width() |
2580 | - << keyboardVisibleRect.height() |
2581 | - << "> to the app manager."; |
2582 | - |
2583 | - // report the visible part as input trap, the invisible part can click through, e.g. browser url bar |
2584 | - applicationApiWrapper->reportOSKVisible( |
2585 | - keyboardVisibleRect.x(), |
2586 | - keyboardVisibleRect.y(), |
2587 | - keyboardVisibleRect.width(), |
2588 | - keyboardVisibleRect.height() |
2589 | - ); |
2590 | - } |
2591 | -} |
2592 | - |
2593 | -void InputMethodPrivate::updateKeyboardOrientation() |
2594 | -{ |
2595 | - setLayoutOrientation(QGuiApplication::primaryScreen()->orientation()); |
2596 | -} |
2597 | - |
2598 | -/* |
2599 | - * changes keyboard layout |
2600 | - * called directly to show URL or num layout for special contentTypes, |
2601 | - * does not change the current language id / activeView |
2602 | - */ |
2603 | - |
2604 | -void InputMethodPrivate::setActiveKeyboardId(const QString &id) |
2605 | -{ |
2606 | - // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance? |
2607 | - layout.updater.setActiveKeyboardId(id); |
2608 | - extended_layout.updater.setActiveKeyboardId(id); |
2609 | - layout.model.setActiveView(id); |
2610 | -} |
2611 | - |
2612 | -void InputMethodPrivate::connectToNotifier() |
2613 | -{ |
2614 | -#ifdef TEMP_DISABLED |
2615 | - QObject::connect(¬ifier, SIGNAL(cursorPositionChanged(int, QString)), |
2616 | - &editor, SLOT(onCursorPositionChanged(int, QString))); |
2617 | -#endif |
2618 | - QObject::connect(¬ifier, SIGNAL(keysOverriden(Logic::KeyOverrides, bool)), |
2619 | - &layout.helper, SLOT(onKeysOverriden(Logic::KeyOverrides, bool))); |
2620 | -} |
2621 | - |
2622 | -void InputMethodPrivate::setContextProperties(QQmlContext *qml_context) |
2623 | -{ |
2624 | - qml_context->setContextProperty("maliit", &context); |
2625 | - qml_context->setContextProperty("maliit_layout", &layout.model); |
2626 | - qml_context->setContextProperty("maliit_event_handler", &layout.event_handler); |
2627 | - qml_context->setContextProperty("maliit_extended_layout", &extended_layout.model); |
2628 | - qml_context->setContextProperty("maliit_extended_event_handler", &extended_layout.event_handler); |
2629 | - qml_context->setContextProperty("maliit_magnifier_layout", &magnifier_layout); |
2630 | - qml_context->setContextProperty("maliit_wordribbon", layout.helper.wordRibbon()); |
2631 | -} |
2632 | - |
2633 | InputMethod::InputMethod(MAbstractInputMethodHost *host) |
2634 | : MAbstractInputMethod(host) |
2635 | , d_ptr(new InputMethodPrivate(this, host)) |
2636 | @@ -416,46 +88,10 @@ |
2637 | |
2638 | // FIXME: Reconnect feedback instance. |
2639 | Setup::connectAll(&d->layout.event_handler, &d->layout.updater, &d->editor); |
2640 | - Setup::connectAll(&d->extended_layout.event_handler, &d->extended_layout.updater, &d->editor); |
2641 | |
2642 | connect(&d->layout.helper, SIGNAL(centerPanelChanged(KeyArea,Logic::KeyOverrides)), |
2643 | &d->layout.model, SLOT(setKeyArea(KeyArea))); |
2644 | |
2645 | - connect(&d->extended_layout.helper, SIGNAL(extendedPanelChanged(KeyArea,Logic::KeyOverrides)), |
2646 | - &d->extended_layout.model, SLOT(setKeyArea(KeyArea))); |
2647 | - |
2648 | - connect(&d->layout.helper, SIGNAL(magnifierChanged(KeyArea)), |
2649 | - &d->magnifier_layout, SLOT(setKeyArea(KeyArea))); |
2650 | - |
2651 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2652 | - connect(&d->layout.model, SIGNAL(widthChanged(int)), |
2653 | - this, SLOT(onLayoutWidthChanged(int))); |
2654 | - |
2655 | - connect(&d->layout.model, SIGNAL(heightChanged(int)), |
2656 | - this, SLOT(onLayoutHeightChanged(int))); |
2657 | - |
2658 | - connect(&d->layout.updater, SIGNAL(keyboardTitleChanged(QString)), |
2659 | - &d->layout.model, SLOT(setTitle(QString))); |
2660 | - |
2661 | - connect(&d->extended_layout.model, SIGNAL(widthChanged(int)), |
2662 | - this, SLOT(onExtendedLayoutWidthChanged(int))); |
2663 | - |
2664 | - connect(&d->extended_layout.model, SIGNAL(heightChanged(int)), |
2665 | - this, SLOT(onExtendedLayoutHeightChanged(int))); |
2666 | - |
2667 | - connect(&d->extended_layout.model, SIGNAL(originChanged(QPoint)), |
2668 | - this, SLOT(onExtendedLayoutOriginChanged(QPoint))); |
2669 | - |
2670 | - connect(&d->magnifier_layout, SIGNAL(widthChanged(int)), |
2671 | - this, SLOT(onMagnifierLayoutWidthChanged(int))); |
2672 | - |
2673 | - connect(&d->magnifier_layout, SIGNAL(heightChanged(int)), |
2674 | - this, SLOT(onMagnifierLayoutHeightChanged(int))); |
2675 | - |
2676 | - connect(&d->magnifier_layout, SIGNAL(originChanged(QPoint)), |
2677 | - this, SLOT(onMagnifierLayoutOriginChanged(QPoint))); |
2678 | -#endif |
2679 | - |
2680 | connect(&d->editor, SIGNAL(rightLayoutSelected()), |
2681 | this, SLOT(onRightLayoutSelected())); |
2682 | |
2683 | @@ -464,12 +100,12 @@ |
2684 | connect(this, SIGNAL(predictionEnabledChanged()), this, SLOT(updateWordEngine())); |
2685 | connect(this, SIGNAL(contentTypeChanged(Maliit::TextContentType)), this, SLOT(onContentTypeChanged(Maliit::TextContentType))); |
2686 | |
2687 | - registerStyleSetting(host); |
2688 | + d->registerStyleSetting(host); |
2689 | |
2690 | - registerFeedbackSetting(host); |
2691 | - registerAutoCorrectSetting(host); |
2692 | - registerAutoCapsSetting(host); |
2693 | - registerWordEngineSetting(host); |
2694 | + d->registerFeedbackSetting(host); |
2695 | + d->registerAutoCorrectSetting(host); |
2696 | + d->registerAutoCapsSetting(host); |
2697 | + d->registerWordEngineSetting(host); |
2698 | |
2699 | setActiveSubView("en_us"); |
2700 | |
2701 | @@ -487,11 +123,6 @@ |
2702 | |
2703 | d->view->setVisible(true); |
2704 | |
2705 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2706 | - d->surface->show(); |
2707 | - d->extended_surface->show(); |
2708 | - d->magnifier_surface->show(); |
2709 | -#endif |
2710 | inputMethodHost()->setScreenRegion(QRegion(d->keyboardVisibleRect)); |
2711 | |
2712 | QRect rect(d->keyboardVisibleRect); |
2713 | @@ -522,15 +153,6 @@ |
2714 | d->editor.clearPreedit(); |
2715 | |
2716 | d->view->setVisible(false); |
2717 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2718 | - d->surface->hide(); |
2719 | - d->extended_surface->hide(); |
2720 | - d->magnifier_surface->hide(); |
2721 | - |
2722 | - const QRegion r; |
2723 | - inputMethodHost()->setScreenRegion(r); |
2724 | - inputMethodHost()->setInputMethodArea(r); |
2725 | -#endif |
2726 | |
2727 | d->applicationApiWrapper->reportOSKInvisible(); |
2728 | |
2729 | @@ -631,147 +253,11 @@ |
2730 | return true; |
2731 | } |
2732 | |
2733 | -void InputMethod::registerStyleSetting(MAbstractInputMethodHost *host) |
2734 | -{ |
2735 | - Q_D(InputMethod); |
2736 | - |
2737 | - QVariantMap attributes; |
2738 | - QStringList available_styles = d->style->availableProfiles(); |
2739 | - attributes[Maliit::SettingEntryAttributes::defaultValue] = MALIIT_DEFAULT_PROFILE; |
2740 | - attributes[Maliit::SettingEntryAttributes::valueDomain] = available_styles; |
2741 | - attributes[Maliit::SettingEntryAttributes::valueDomainDescriptions] = available_styles; |
2742 | - |
2743 | - d->settings.style.reset(host->registerPluginSetting("current_style", |
2744 | - QT_TR_NOOP("Keyboard style"), |
2745 | - Maliit::StringType, |
2746 | - attributes)); |
2747 | - |
2748 | - connect(d->settings.style.data(), SIGNAL(valueChanged()), |
2749 | - this, SLOT(onStyleSettingChanged())); |
2750 | - |
2751 | - // Call manually for the first time to initialize dependent values: |
2752 | - onStyleSettingChanged(); |
2753 | -} |
2754 | - |
2755 | -void InputMethod::registerFeedbackSetting(MAbstractInputMethodHost *host) |
2756 | -{ |
2757 | - Q_D(InputMethod); |
2758 | - |
2759 | - QVariantMap attributes; |
2760 | - attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
2761 | - |
2762 | - d->settings.feedback.reset(host->registerPluginSetting("feedback_enabled", |
2763 | - QT_TR_NOOP("Feedback enabled"), |
2764 | - Maliit::BoolType, |
2765 | - attributes)); |
2766 | - |
2767 | - connect(d->settings.feedback.data(), SIGNAL(valueChanged()), |
2768 | - this, SLOT(onFeedbackSettingChanged())); |
2769 | - |
2770 | - d->feedback.setEnabled(d->settings.feedback->value().toBool()); |
2771 | -} |
2772 | - |
2773 | -void InputMethod::registerAutoCorrectSetting(MAbstractInputMethodHost *host) |
2774 | -{ |
2775 | - Q_D(InputMethod); |
2776 | - |
2777 | - QVariantMap attributes; |
2778 | - attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
2779 | - |
2780 | - d->settings.auto_correct.reset(host->registerPluginSetting("auto_correct_enabled", |
2781 | - QT_TR_NOOP("Auto-correct enabled"), |
2782 | - Maliit::BoolType, |
2783 | - attributes)); |
2784 | - |
2785 | - connect(d->settings.auto_correct.data(), SIGNAL(valueChanged()), |
2786 | - this, SLOT(onAutoCorrectSettingChanged())); |
2787 | - |
2788 | - d->editor.setAutoCorrectEnabled(d->settings.auto_correct->value().toBool()); |
2789 | -} |
2790 | - |
2791 | -void InputMethod::registerAutoCapsSetting(MAbstractInputMethodHost *host) |
2792 | -{ |
2793 | - Q_D(InputMethod); |
2794 | - |
2795 | - QVariantMap attributes; |
2796 | - attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
2797 | - |
2798 | - d->settings.auto_caps.reset(host->registerPluginSetting("auto_caps_enabled", |
2799 | - QT_TR_NOOP("Auto-capitalization enabled"), |
2800 | - Maliit::BoolType, |
2801 | - attributes)); |
2802 | - |
2803 | - connect(d->settings.auto_caps.data(), SIGNAL(valueChanged()), |
2804 | - this, SLOT(onAutoCapsSettingChanged())); |
2805 | - |
2806 | - d->editor.setAutoCapsEnabled(d->settings.auto_caps->value().toBool()); |
2807 | -} |
2808 | - |
2809 | -void InputMethod::registerWordEngineSetting(MAbstractInputMethodHost *host) |
2810 | -{ |
2811 | - Q_D(InputMethod); |
2812 | - |
2813 | - QVariantMap attributes; |
2814 | - attributes[Maliit::SettingEntryAttributes::defaultValue] = false; |
2815 | - |
2816 | - d->settings.word_engine.reset(host->registerPluginSetting("word_engine_enabled", |
2817 | - QT_TR_NOOP("Error correction/word prediction enabled"), |
2818 | - Maliit::BoolType, |
2819 | - attributes)); |
2820 | - |
2821 | - connect(d->settings.word_engine.data(), SIGNAL(valueChanged()), |
2822 | - this, SLOT(updateWordEngine())); |
2823 | - |
2824 | - Q_EMIT wordEngineEnabledChanged( d->settings.word_engine.data()->value().toBool() ); |
2825 | - |
2826 | -#ifndef DISABLE_PREEDIT |
2827 | - d->editor.wordEngine()->setEnabled(d->settings.word_engine->value().toBool()); |
2828 | -#else |
2829 | - d->editor.wordEngine()->setEnabled(false); |
2830 | -#endif |
2831 | -} |
2832 | - |
2833 | -void InputMethod::onLeftLayoutSelected() |
2834 | -{ |
2835 | - // This API smells real bad. |
2836 | - const QList<MImSubViewDescription> &list = |
2837 | - inputMethodHost()->surroundingSubViewDescriptions(Maliit::OnScreen); |
2838 | - |
2839 | - if (list.count() > 0) { |
2840 | - Q_EMIT activeSubViewChanged(list.at(0).id()); |
2841 | - } |
2842 | -} |
2843 | - |
2844 | -void InputMethod::onRightLayoutSelected() |
2845 | -{ |
2846 | - // This API smells real bad. |
2847 | - const QList<MImSubViewDescription> &list = |
2848 | - inputMethodHost()->surroundingSubViewDescriptions(Maliit::OnScreen); |
2849 | - |
2850 | - if (list.count() > 1) { |
2851 | - Q_EMIT activeSubViewChanged(list.at(1).id()); |
2852 | - } |
2853 | -} |
2854 | - |
2855 | -void InputMethod::onScreenSizeChange(const QSize &size) |
2856 | -{ |
2857 | - Q_D(InputMethod); |
2858 | - |
2859 | - d->layout.helper.setScreenSize(size); |
2860 | - d->extended_layout.helper.setScreenSize(d->layout.helper.screenSize()); |
2861 | - |
2862 | -#ifdef TEMP_DISABLED |
2863 | - d->updateKeyboardOrientation(); |
2864 | -#endif |
2865 | -} |
2866 | - |
2867 | void InputMethod::onStyleSettingChanged() |
2868 | { |
2869 | Q_D(InputMethod); |
2870 | d->style->setProfile(d->settings.style->value().toString()); |
2871 | d->layout.model.setImageDirectory(d->style->directory(Style::Images)); |
2872 | - d->extended_layout.model.setImageDirectory(d->style->directory(Style::Images)); |
2873 | - d->magnifier_layout.setImageDirectory(d->style->directory(Style::Images)); |
2874 | } |
2875 | |
2876 | void InputMethod::onFeedbackSettingChanged() |
2877 | @@ -855,44 +341,6 @@ |
2878 | Q_UNUSED(height); |
2879 | } |
2880 | |
2881 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2882 | -void InputMethod::onExtendedLayoutWidthChanged(int width) |
2883 | -{ |
2884 | - Q_D(InputMethod); |
2885 | - d->extended_surface->setSize(QSize(width, d->extended_surface->size().height())); |
2886 | -} |
2887 | - |
2888 | -void InputMethod::onExtendedLayoutHeightChanged(int height) |
2889 | -{ |
2890 | - Q_D(InputMethod); |
2891 | - d->extended_surface->setSize(QSize(d->extended_surface->size().width(), height)); |
2892 | -} |
2893 | - |
2894 | -void InputMethod::onExtendedLayoutOriginChanged(const QPoint &origin) |
2895 | -{ |
2896 | - Q_D(InputMethod); |
2897 | - d->extended_surface->setRelativePosition(origin); |
2898 | -} |
2899 | - |
2900 | -void InputMethod::onMagnifierLayoutWidthChanged(int width) |
2901 | -{ |
2902 | - Q_D(InputMethod); |
2903 | - d->magnifier_surface->setSize(QSize(width, d->magnifier_surface->size().height())); |
2904 | -} |
2905 | - |
2906 | -void InputMethod::onMagnifierLayoutHeightChanged(int height) |
2907 | -{ |
2908 | - Q_D(InputMethod); |
2909 | - d->magnifier_surface->setSize(QSize(d->magnifier_surface->size().width(), height)); |
2910 | -} |
2911 | - |
2912 | -void InputMethod::onMagnifierLayoutOriginChanged(const QPoint &origin) |
2913 | -{ |
2914 | - Q_D(InputMethod); |
2915 | - d->magnifier_surface->setRelativePosition(origin); |
2916 | -} |
2917 | -#endif |
2918 | - |
2919 | void InputMethod::onHideAnimationFinished() |
2920 | { |
2921 | Q_D(InputMethod); |
2922 | @@ -978,6 +426,8 @@ |
2923 | { |
2924 | Q_D(InputMethod); |
2925 | |
2926 | + // TODO when refactoring, forward the enum to QML |
2927 | + |
2928 | if (contentType == Maliit::FreeTextContentType) |
2929 | d->setActiveKeyboardId( d->activeLanguageId ); |
2930 | |
2931 | |
2932 | === modified file 'src/plugin/inputmethod.h' |
2933 | --- src/plugin/inputmethod.h 2013-08-09 15:22:29 +0000 |
2934 | +++ src/plugin/inputmethod.h 2013-09-07 09:02:58 +0000 |
2935 | @@ -72,8 +72,6 @@ |
2936 | virtual void setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides); |
2937 | //! \reimp_end |
2938 | |
2939 | - Q_SLOT void onLeftLayoutSelected(); |
2940 | - Q_SLOT void onRightLayoutSelected(); |
2941 | Q_SLOT void deviceOrientationChanged(Qt::ScreenOrientation orientation); |
2942 | |
2943 | Q_SLOT void updateWordEngine(); |
2944 | @@ -92,14 +90,6 @@ |
2945 | void contentTypeChanged(Maliit::TextContentType contentType); |
2946 | |
2947 | private: |
2948 | - void registerStyleSetting(MAbstractInputMethodHost *host); |
2949 | - void registerFeedbackSetting(MAbstractInputMethodHost *host); |
2950 | - void registerAutoCorrectSetting(MAbstractInputMethodHost *host); |
2951 | - void registerAutoCapsSetting(MAbstractInputMethodHost *host); |
2952 | - void registerWordEngineSetting(MAbstractInputMethodHost *host); |
2953 | - void registerHideWordRibbonInPortraitModeSetting(MAbstractInputMethodHost *host); |
2954 | - |
2955 | - Q_SLOT void onScreenSizeChange(const QSize &size); |
2956 | Q_SLOT void onStyleSettingChanged(); |
2957 | Q_SLOT void onFeedbackSettingChanged(); |
2958 | Q_SLOT void onAutoCorrectSettingChanged(); |
2959 | @@ -110,14 +100,6 @@ |
2960 | |
2961 | Q_SLOT void onLayoutWidthChanged(int width); |
2962 | Q_SLOT void onLayoutHeightChanged(int height); |
2963 | -#ifdef EXTENDED_SURFACE_TEMP_DISABLED |
2964 | - Q_SLOT void onExtendedLayoutWidthChanged(int width); |
2965 | - Q_SLOT void onExtendedLayoutHeightChanged(int height); |
2966 | - Q_SLOT void onExtendedLayoutOriginChanged(const QPoint &origin); |
2967 | - Q_SLOT void onMagnifierLayoutWidthChanged(int width); |
2968 | - Q_SLOT void onMagnifierLayoutHeightChanged(int height); |
2969 | - Q_SLOT void onMagnifierLayoutOriginChanged(const QPoint &origin); |
2970 | -#endif |
2971 | |
2972 | Q_SLOT void onContentTypeChanged(Maliit::TextContentType contentType); |
2973 | |
2974 | |
2975 | === added file 'src/plugin/inputmethod_p.h' |
2976 | --- src/plugin/inputmethod_p.h 1970-01-01 00:00:00 +0000 |
2977 | +++ src/plugin/inputmethod_p.h 2013-09-07 09:02:58 +0000 |
2978 | @@ -0,0 +1,390 @@ |
2979 | + |
2980 | +#include "inputmethod.h" |
2981 | + |
2982 | +#include "editor.h" |
2983 | + |
2984 | +#include "updatenotifier.h" |
2985 | + |
2986 | +#include "logic/layoutupdater.h" |
2987 | +#include "logic/eventhandler.h" |
2988 | +#include "logic/wordengine.h" |
2989 | +#include "logic/languagefeatures.h" |
2990 | +#include "logic/dynamiclayout.h" |
2991 | + |
2992 | +#include "ubuntuapplicationapiwrapper.h" |
2993 | + |
2994 | +#include <maliit/plugins/abstractinputmethodhost.h> |
2995 | +#include <maliit/plugins/abstractpluginsetting.h> |
2996 | + |
2997 | +#include <QtQuick> |
2998 | + |
2999 | +#ifdef HAVE_QT_MOBILITY |
3000 | +#include "view/soundfeedback.h" |
3001 | +typedef MaliitKeyboard::SoundFeedback DefaultFeedback; |
3002 | +#else |
3003 | +#include "view/nullfeedback.h" |
3004 | +typedef MaliitKeyboard::NullFeedback DefaultFeedback; |
3005 | +#endif |
3006 | + |
3007 | +namespace MaliitKeyboard { |
3008 | + |
3009 | +typedef QScopedPointer<Maliit::Plugins::AbstractPluginSetting> ScopedSetting; |
3010 | +typedef QSharedPointer<MKeyOverride> SharedOverride; |
3011 | +typedef QMap<QString, SharedOverride>::const_iterator OverridesIterator; |
3012 | + |
3013 | +class Settings |
3014 | +{ |
3015 | +public: |
3016 | + ScopedSetting style; |
3017 | + ScopedSetting feedback; |
3018 | + ScopedSetting auto_correct; |
3019 | + ScopedSetting auto_caps; |
3020 | + ScopedSetting word_engine; |
3021 | +}; |
3022 | + |
3023 | +class LayoutGroup |
3024 | +{ |
3025 | +public: |
3026 | + Logic::LayoutHelper helper; |
3027 | + Logic::LayoutUpdater updater; |
3028 | + Model::Layout model; |
3029 | + Logic::EventHandler event_handler; |
3030 | + |
3031 | + explicit LayoutGroup(); |
3032 | +}; |
3033 | + |
3034 | +LayoutGroup::LayoutGroup() |
3035 | + : helper() |
3036 | + , updater() |
3037 | + , model() |
3038 | + , event_handler(&model, &updater) |
3039 | +{} |
3040 | + |
3041 | +QQuickView *createWindow(MAbstractInputMethodHost *host) |
3042 | +{ |
3043 | + QScopedPointer<QQuickView> view(new QQuickView); |
3044 | + |
3045 | + QSurfaceFormat format; |
3046 | + format.setAlphaBufferSize(8); |
3047 | + view->setFormat(format); |
3048 | + view->setColor(QColor(Qt::transparent)); |
3049 | + |
3050 | + host->registerWindow(view.data(), Maliit::PositionCenterBottom); |
3051 | + |
3052 | + return view.take(); |
3053 | +} |
3054 | + |
3055 | +class InputMethodPrivate |
3056 | +{ |
3057 | +public: |
3058 | + InputMethod* q; |
3059 | + QQuickItem* qmlRootItem; |
3060 | + Editor editor; |
3061 | + DefaultFeedback feedback; |
3062 | + SharedStyle style; |
3063 | + UpdateNotifier notifier; |
3064 | + QMap<QString, SharedOverride> key_overrides; |
3065 | + Settings settings; |
3066 | + LayoutGroup layout; |
3067 | + QRect windowGeometryRect; |
3068 | + QRect keyboardVisibleRect; |
3069 | + MAbstractInputMethodHost* host; |
3070 | + QQuickView* view; |
3071 | + UbuntuApplicationApiWrapper* applicationApiWrapper; |
3072 | + |
3073 | + bool predictionEnabled; |
3074 | + Maliit::TextContentType contentType; |
3075 | + QString activeLanguageId; |
3076 | + |
3077 | + explicit InputMethodPrivate(InputMethod * const _q, |
3078 | + MAbstractInputMethodHost *host) |
3079 | + : q(_q) |
3080 | + , qmlRootItem(0) |
3081 | + , editor(EditorOptions(), new Model::Text, new Logic::WordEngine, new Logic::LanguageFeatures) |
3082 | + , feedback() |
3083 | + , style(new Style) |
3084 | + , notifier() |
3085 | + , key_overrides() |
3086 | + , settings() |
3087 | + , layout() |
3088 | + , host(host) |
3089 | + , view(0) |
3090 | + , applicationApiWrapper(new UbuntuApplicationApiWrapper) |
3091 | + , predictionEnabled(false) |
3092 | + , contentType(Maliit::FreeTextContentType) |
3093 | + , activeLanguageId("en_us") |
3094 | + { |
3095 | + view = createWindow(host); |
3096 | + |
3097 | + editor.setHost(host); |
3098 | + |
3099 | + layout.updater.setLayout(&layout.helper); |
3100 | + |
3101 | + layout.updater.setStyle(style); |
3102 | + feedback.setStyle(style); |
3103 | + |
3104 | + const QSize &screen_size(view->screen()->size()); |
3105 | + layout.helper.setScreenSize(screen_size); |
3106 | + layout.helper.setAlignment(Logic::LayoutHelper::Bottom); |
3107 | + |
3108 | + QObject::connect(&layout.event_handler, SIGNAL(wordCandidatePressed(WordCandidate)), |
3109 | + &layout.updater, SLOT( onWordCandidatePressed(WordCandidate) )); |
3110 | + |
3111 | + QObject::connect(&layout.event_handler, SIGNAL(wordCandidateReleased(WordCandidate)), |
3112 | + &layout.updater, SLOT( onWordCandidateReleased(WordCandidate) )); |
3113 | + |
3114 | + QObject::connect(&editor, SIGNAL(preeditEnabledChanged(bool)), |
3115 | + &layout.updater, SLOT(setWordRibbonVisible(bool))); |
3116 | + |
3117 | + QObject::connect(&layout.updater, SIGNAL(wordCandidateSelected(QString)), |
3118 | + editor.wordEngine(), SLOT(onWordCandidateSelected(QString))); |
3119 | + |
3120 | + QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), |
3121 | + editor.wordEngine(), SLOT(onLanguageChanged(QString))); |
3122 | + |
3123 | + QObject::connect(&layout.updater, SIGNAL(languageChanged(QString)), |
3124 | + &editor, SLOT(onLanguageChanged(const QString&))); |
3125 | + |
3126 | + QObject::connect(&layout.helper, SIGNAL(stateChanged(Model::Layout::State)), |
3127 | + &layout.model, SLOT(setState(Model::Layout::State))); |
3128 | + |
3129 | + connectToNotifier(); |
3130 | + |
3131 | + #ifdef DISABLED_FLAGS_FROM_SURFACE |
3132 | + view->setFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint |
3133 | + | Qt::X11BypassWindowManagerHint | Qt::WindowDoesNotAcceptFocus); |
3134 | + #endif |
3135 | + view->setWindowState(Qt::WindowNoState); |
3136 | + |
3137 | + QSurfaceFormat format; |
3138 | + format.setAlphaBufferSize(8); |
3139 | + view->setFormat(format); |
3140 | + view->setColor(QColor(Qt::transparent)); |
3141 | + |
3142 | + view->setVisible(false); |
3143 | + |
3144 | + // TODO: Figure out whether two views can share one engine. |
3145 | + QQmlEngine *const engine(view->engine()); |
3146 | + engine->addImportPath(UBUNTU_KEYBOARD_DATA_DIR); |
3147 | + setContextProperties(engine->rootContext()); |
3148 | + |
3149 | + QObject::connect(view, SIGNAL(statusChanged(QQuickView::Status)), |
3150 | + q, SLOT(onQQuickViewStatusChanged(QQuickView::Status))); |
3151 | + |
3152 | + // following used to help shell identify the OSK surface |
3153 | + view->setProperty("role", applicationApiWrapper->oskWindowRole()); |
3154 | + view->setTitle("MaliitOnScreenKeyboard"); |
3155 | + |
3156 | + // workaround: resizeMode not working in current qpa imlementation |
3157 | + // http://qt-project.org/doc/qt-5.0/qtquick/qquickview.html#ResizeMode-enum |
3158 | + view->setResizeMode(QQuickView::SizeRootObjectToView); |
3159 | + } |
3160 | + |
3161 | + ~InputMethodPrivate() |
3162 | + { |
3163 | + delete applicationApiWrapper; |
3164 | + } |
3165 | + |
3166 | + void setLayoutOrientation(Qt::ScreenOrientation screenOrientation) |
3167 | + { |
3168 | + Logic::LayoutHelper::Orientation orientation = uiConst->screenToMaliitOrientation(screenOrientation); |
3169 | + |
3170 | + layout.updater.setOrientation(orientation); |
3171 | + |
3172 | + windowGeometryRect = uiConst->windowGeometryRect( screenOrientation ); |
3173 | + |
3174 | + keyboardVisibleRect = windowGeometryRect.adjusted(0,uiConst->invisibleTouchAreaHeight(orientation),0,0); |
3175 | + |
3176 | + // qpa does not rotate the coordinate system |
3177 | + windowGeometryRect = qGuiApp->primaryScreen()->mapBetween( |
3178 | + screenOrientation, |
3179 | + qGuiApp->primaryScreen()->primaryOrientation(), |
3180 | + windowGeometryRect); |
3181 | + |
3182 | + |
3183 | + view->setGeometry(windowGeometryRect); |
3184 | + |
3185 | + if (qmlRootItem->property("shown").toBool()) { |
3186 | + host->setScreenRegion(QRegion(keyboardVisibleRect)); |
3187 | + |
3188 | + QRect rect(keyboardVisibleRect); |
3189 | + rect.moveTop( windowGeometryRect.height() - keyboardVisibleRect.height() ); |
3190 | + host->setInputMethodArea(rect, view); |
3191 | + } |
3192 | + |
3193 | + qmlRootItem->setProperty("contentOrientation", screenOrientation); |
3194 | + |
3195 | + if (qmlRootItem->property("shown").toBool()) { |
3196 | + applicationApiWrapper->reportOSKInvisible(); |
3197 | + |
3198 | + qDebug() << "keyboard is reporting: total <x y w h>: <" |
3199 | + << windowGeometryRect.x() |
3200 | + << windowGeometryRect.y() |
3201 | + << windowGeometryRect.width() |
3202 | + << windowGeometryRect.height() |
3203 | + << "> and visible <" |
3204 | + << keyboardVisibleRect.x() |
3205 | + << keyboardVisibleRect.y() |
3206 | + << keyboardVisibleRect.width() |
3207 | + << keyboardVisibleRect.height() |
3208 | + << "> to the app manager."; |
3209 | + |
3210 | + // report the visible part as input trap, the invisible part can click through, e.g. browser url bar |
3211 | + applicationApiWrapper->reportOSKVisible( |
3212 | + keyboardVisibleRect.x(), |
3213 | + keyboardVisibleRect.y(), |
3214 | + keyboardVisibleRect.width(), |
3215 | + keyboardVisibleRect.height() |
3216 | + ); |
3217 | + } |
3218 | + } |
3219 | + |
3220 | + void updateKeyboardOrientation() |
3221 | + { |
3222 | + setLayoutOrientation(QGuiApplication::primaryScreen()->orientation()); |
3223 | + } |
3224 | + |
3225 | + void updateWordRibbon() |
3226 | + { |
3227 | + layout.helper.wordRibbon()->setEnabled( predictionEnabled ); |
3228 | + Q_EMIT q->wordRibbonEnabledChanged( predictionEnabled ); |
3229 | + qmlRootItem->setProperty("wordribbon_visible", predictionEnabled ); |
3230 | + |
3231 | + updateKeyboardOrientation(); |
3232 | + } |
3233 | + |
3234 | + /* |
3235 | + * changes keyboard layout |
3236 | + * called directly to show URL or num layout for special contentTypes, |
3237 | + * does not change the current language id / activeView |
3238 | + */ |
3239 | + |
3240 | + void setActiveKeyboardId(const QString& id) |
3241 | + { |
3242 | + // FIXME: Perhaps better to let both LayoutUpdater share the same KeyboardLoader instance? |
3243 | + layout.updater.setActiveKeyboardId(id); |
3244 | + layout.model.setActiveView(id); |
3245 | + |
3246 | + qmlRootItem->setProperty("layoutId", id); |
3247 | + } |
3248 | + |
3249 | + void connectToNotifier() |
3250 | + { |
3251 | + #ifdef TEMP_DISABLED |
3252 | + QObject::connect(¬ifier, SIGNAL(cursorPositionChanged(int, QString)), |
3253 | + &editor, SLOT(onCursorPositionChanged(int, QString))); |
3254 | + #endif |
3255 | + QObject::connect(¬ifier, SIGNAL(keysOverriden(Logic::KeyOverrides, bool)), |
3256 | + &layout.helper, SLOT(onKeysOverriden(Logic::KeyOverrides, bool))); |
3257 | + } |
3258 | + |
3259 | + void setContextProperties(QQmlContext *qml_context) |
3260 | + { |
3261 | + qml_context->setContextProperty("maliit_layout", &layout.model); |
3262 | + qml_context->setContextProperty("maliit_event_handler", &layout.event_handler); |
3263 | + qml_context->setContextProperty("maliit_wordribbon", layout.helper.wordRibbon()); |
3264 | + } |
3265 | + |
3266 | + |
3267 | + /* |
3268 | + * register settings |
3269 | + */ |
3270 | + |
3271 | + void registerStyleSetting(MAbstractInputMethodHost *host) |
3272 | + { |
3273 | + QVariantMap attributes; |
3274 | + QStringList available_styles = style->availableProfiles(); |
3275 | + attributes[Maliit::SettingEntryAttributes::defaultValue] = MALIIT_DEFAULT_PROFILE; |
3276 | + attributes[Maliit::SettingEntryAttributes::valueDomain] = available_styles; |
3277 | + attributes[Maliit::SettingEntryAttributes::valueDomainDescriptions] = available_styles; |
3278 | + |
3279 | + settings.style.reset(host->registerPluginSetting("current_style", |
3280 | + QT_TR_NOOP("Keyboard style"), |
3281 | + Maliit::StringType, |
3282 | + attributes)); |
3283 | + |
3284 | + QObject::connect(settings.style.data(), SIGNAL(valueChanged()), q, SLOT(onStyleSettingChanged())); |
3285 | + |
3286 | + // Call manually for the first time to initialize dependent values: |
3287 | + q->onStyleSettingChanged(); |
3288 | + } |
3289 | + |
3290 | + void registerFeedbackSetting(MAbstractInputMethodHost *host) |
3291 | + { |
3292 | + QVariantMap attributes; |
3293 | + attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
3294 | + |
3295 | + settings.feedback.reset(host->registerPluginSetting("feedback_enabled", |
3296 | + QT_TR_NOOP("Feedback enabled"), |
3297 | + Maliit::BoolType, |
3298 | + attributes)); |
3299 | + |
3300 | + QObject::connect(settings.feedback.data(), SIGNAL(valueChanged()), q, SLOT(onFeedbackSettingChanged())); |
3301 | + |
3302 | + feedback.setEnabled(settings.feedback->value().toBool()); |
3303 | + } |
3304 | + |
3305 | + void registerAutoCorrectSetting(MAbstractInputMethodHost *host) |
3306 | + { |
3307 | + QVariantMap attributes; |
3308 | + attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
3309 | + |
3310 | + settings.auto_correct.reset(host->registerPluginSetting("auto_correct_enabled", |
3311 | + QT_TR_NOOP("Auto-correct enabled"), |
3312 | + Maliit::BoolType, |
3313 | + attributes)); |
3314 | + |
3315 | + QObject::connect(settings.auto_correct.data(), SIGNAL(valueChanged()), q, SLOT(onAutoCorrectSettingChanged())); |
3316 | + |
3317 | + editor.setAutoCorrectEnabled(settings.auto_correct->value().toBool()); |
3318 | + } |
3319 | + |
3320 | + void registerAutoCapsSetting(MAbstractInputMethodHost *host) |
3321 | + { |
3322 | + QVariantMap attributes; |
3323 | + attributes[Maliit::SettingEntryAttributes::defaultValue] = true; |
3324 | + |
3325 | + settings.auto_caps.reset(host->registerPluginSetting("auto_caps_enabled", |
3326 | + QT_TR_NOOP("Auto-capitalization enabled"), |
3327 | + Maliit::BoolType, |
3328 | + attributes)); |
3329 | + |
3330 | + QObject::connect(settings.auto_caps.data(), SIGNAL(valueChanged()), q, SLOT(onAutoCapsSettingChanged())); |
3331 | + |
3332 | + editor.setAutoCapsEnabled(settings.auto_caps->value().toBool()); |
3333 | + } |
3334 | + |
3335 | + void registerWordEngineSetting(MAbstractInputMethodHost *host) |
3336 | + { |
3337 | + QVariantMap attributes; |
3338 | + attributes[Maliit::SettingEntryAttributes::defaultValue] = false; |
3339 | + |
3340 | + settings.word_engine.reset(host->registerPluginSetting("word_engine_enabled", |
3341 | + QT_TR_NOOP("Error correction/word prediction enabled"), |
3342 | + Maliit::BoolType, |
3343 | + attributes)); |
3344 | + |
3345 | + QObject::connect(settings.word_engine.data(), SIGNAL(valueChanged()), q, SLOT(updateWordEngine())); |
3346 | + |
3347 | + Q_EMIT q->wordEngineEnabledChanged( settings.word_engine.data()->value().toBool() ); |
3348 | + |
3349 | + #ifndef DISABLE_PREEDIT |
3350 | + editor.wordEngine()->setEnabled(settings.word_engine->value().toBool()); |
3351 | + #else |
3352 | + editor.wordEngine()->setEnabled(false); |
3353 | + #endif |
3354 | + } |
3355 | + |
3356 | + void onScreenSizeChange(const QSize &size) |
3357 | + { |
3358 | + layout.helper.setScreenSize(size); |
3359 | + |
3360 | + #ifdef TEMP_DISABLED |
3361 | + updateKeyboardOrientation(); |
3362 | + #endif |
3363 | + } |
3364 | + |
3365 | +}; |
3366 | + |
3367 | +} // namespace |
3368 | + |
3369 | |
3370 | === removed file 'src/plugin/maliitcontext.cpp' |
3371 | --- src/plugin/maliitcontext.cpp 2013-07-19 12:05:07 +0000 |
3372 | +++ src/plugin/maliitcontext.cpp 1970-01-01 00:00:00 +0000 |
3373 | @@ -1,109 +0,0 @@ |
3374 | -/* |
3375 | - * This file is part of Maliit Plugins |
3376 | - * |
3377 | - * Copyright (C) 2012 Openismus GmbH. All rights reserved. |
3378 | - * |
3379 | - * Contact: maliit-discuss@lists.maliit.org |
3380 | - * |
3381 | - * Redistribution and use in source and binary forms, with or without modification, |
3382 | - * are permitted provided that the following conditions are met: |
3383 | - * |
3384 | - * Redistributions of source code must retain the above copyright notice, this list |
3385 | - * of conditions and the following disclaimer. |
3386 | - * Redistributions in binary form must reproduce the above copyright notice, this list |
3387 | - * of conditions and the following disclaimer in the documentation and/or other materials |
3388 | - * provided with the distribution. |
3389 | - * Neither the name of Nokia Corporation nor the names of its contributors may be |
3390 | - * used to endorse or promote products derived from this software without specific |
3391 | - * prior written permission. |
3392 | - * |
3393 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
3394 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
3395 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
3396 | - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3397 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
3398 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
3399 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
3400 | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
3401 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3402 | - * |
3403 | - */ |
3404 | - |
3405 | -#include "maliitcontext.h" |
3406 | -#include "inputmethod.h" |
3407 | - |
3408 | -namespace MaliitKeyboard { |
3409 | -//! \class MaliitContext |
3410 | -//! \brief Helper class to export properties and static data to QML |
3411 | - |
3412 | - |
3413 | -class MaliitContextPrivate |
3414 | -{ |
3415 | -public: |
3416 | - InputMethod * const input_method; |
3417 | - SharedStyle style; |
3418 | - |
3419 | - explicit MaliitContextPrivate(InputMethod * const new_input_method, |
3420 | - const SharedStyle &new_style); |
3421 | -}; |
3422 | - |
3423 | - |
3424 | -MaliitContextPrivate::MaliitContextPrivate(InputMethod *const new_input_method, |
3425 | - const SharedStyle &new_style) |
3426 | - : input_method(new_input_method) |
3427 | - , style(new_style) |
3428 | -{ |
3429 | - Q_ASSERT(input_method != 0); |
3430 | - Q_ASSERT(not style.isNull()); |
3431 | -} |
3432 | - |
3433 | - |
3434 | -MaliitContext::MaliitContext(InputMethod *const input_method, |
3435 | - const SharedStyle &style, |
3436 | - QObject *parent) |
3437 | - : QObject(parent) |
3438 | - , d_ptr(new MaliitContextPrivate(input_method, style)) |
3439 | -{} |
3440 | - |
3441 | - |
3442 | -MaliitContext::~MaliitContext() |
3443 | -{} |
3444 | - |
3445 | - |
3446 | -//! \brief Converts image name to a fully qualified file name. |
3447 | -//! |
3448 | -//! Takes the currently chosen styling profile into account. |
3449 | -//! \param base_name Base name of the image. |
3450 | -QString MaliitContext::image(const QString &base_name) const |
3451 | -{ |
3452 | - if (not base_name.isEmpty()) { |
3453 | - Q_D(const MaliitContext); |
3454 | - return d->style->directory(Style::Images) + "/" + base_name; |
3455 | - } |
3456 | - |
3457 | - return QString(); |
3458 | -} |
3459 | - |
3460 | - |
3461 | -//! \brief Triggers user-initiated hiding of virtual keyboard. |
3462 | -void MaliitContext::hide() |
3463 | -{ |
3464 | - Q_D(MaliitContext); |
3465 | - d->input_method->hide(); |
3466 | -} |
3467 | - |
3468 | - |
3469 | -void MaliitContext::selectLeftLayout() |
3470 | -{ |
3471 | - Q_D(MaliitContext); |
3472 | - d->input_method->onLeftLayoutSelected(); |
3473 | -} |
3474 | - |
3475 | - |
3476 | -void MaliitContext::selectRightLayout() |
3477 | -{ |
3478 | - Q_D(MaliitContext); |
3479 | - d->input_method->onRightLayoutSelected(); |
3480 | -} |
3481 | - |
3482 | -} // namespace MaliitKeyboard |
3483 | |
3484 | === removed file 'src/plugin/maliitcontext.h' |
3485 | --- src/plugin/maliitcontext.h 2013-07-19 12:05:07 +0000 |
3486 | +++ src/plugin/maliitcontext.h 1970-01-01 00:00:00 +0000 |
3487 | @@ -1,67 +0,0 @@ |
3488 | -/* |
3489 | - * This file is part of Maliit Plugins |
3490 | - * |
3491 | - * Copyright (C) 2012 Openismus GmbH. All rights reserved. |
3492 | - * |
3493 | - * Contact: maliit-discuss@lists.maliit.org |
3494 | - * |
3495 | - * Redistribution and use in source and binary forms, with or without modification, |
3496 | - * are permitted provided that the following conditions are met: |
3497 | - * |
3498 | - * Redistributions of source code must retain the above copyright notice, this list |
3499 | - * of conditions and the following disclaimer. |
3500 | - * Redistributions in binary form must reproduce the above copyright notice, this list |
3501 | - * of conditions and the following disclaimer in the documentation and/or other materials |
3502 | - * provided with the distribution. |
3503 | - * Neither the name of Nokia Corporation nor the names of its contributors may be |
3504 | - * used to endorse or promote products derived from this software without specific |
3505 | - * prior written permission. |
3506 | - * |
3507 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY |
3508 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
3509 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
3510 | - * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
3511 | - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
3512 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
3513 | - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
3514 | - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
3515 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
3516 | - * |
3517 | - */ |
3518 | - |
3519 | -#ifndef MALIIT_KEYBOARD_MALIITCONTEXT_H |
3520 | -#define MALIIT_KEYBOARD_MALIITCONTEXT_H |
3521 | - |
3522 | -#include "logic/style.h" |
3523 | -#include <QtCore> |
3524 | - |
3525 | -namespace MaliitKeyboard { |
3526 | - |
3527 | -class InputMethod; |
3528 | -class MaliitContextPrivate; |
3529 | - |
3530 | -class MaliitContext |
3531 | - : public QObject |
3532 | -{ |
3533 | - Q_OBJECT |
3534 | - Q_DISABLE_COPY(MaliitContext) |
3535 | - Q_DECLARE_PRIVATE(MaliitContext) |
3536 | - |
3537 | -public: |
3538 | - explicit MaliitContext(InputMethod *input_method, |
3539 | - const SharedStyle &style, |
3540 | - QObject *parent = 0); |
3541 | - virtual ~MaliitContext(); |
3542 | - |
3543 | - Q_INVOKABLE QString image(const QString &base_name) const; |
3544 | - Q_INVOKABLE void hide(); |
3545 | - Q_INVOKABLE void selectLeftLayout(); |
3546 | - Q_INVOKABLE void selectRightLayout(); |
3547 | - |
3548 | -private: |
3549 | - const QScopedPointer<MaliitContextPrivate> d_ptr; |
3550 | -}; |
3551 | - |
3552 | -} // MaliitKeyboard |
3553 | - |
3554 | -#endif // MALIIT_KEYBOARD_MALIITCONTEXT_H |
3555 | |
3556 | === modified file 'src/plugin/plugin.pro' |
3557 | --- src/plugin/plugin.pro 2013-08-23 10:25:09 +0000 |
3558 | +++ src/plugin/plugin.pro 2013-09-07 09:02:58 +0000 |
3559 | @@ -24,7 +24,6 @@ |
3560 | inputmethod.h \ |
3561 | editor.h \ |
3562 | updatenotifier.h \ |
3563 | - maliitcontext.h \ |
3564 | ubuntuapplicationapiwrapper.h |
3565 | |
3566 | SOURCES += \ |
3567 | @@ -32,7 +31,6 @@ |
3568 | inputmethod.cpp \ |
3569 | editor.cpp \ |
3570 | updatenotifier.cpp \ |
3571 | - maliitcontext.cpp \ |
3572 | ubuntuapplicationapiwrapper.cpp |
3573 | |
3574 | target.path += $${MALIIT_PLUGINS_DIR} |
MR for having packages, not ready yet