CLKeyboard.qml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /**
  2. * Copyright © 2010 Digia Plc
  3. * Copyright © 2010 Nokia Corporation
  4. *
  5. * All rights reserved.
  6. *
  7. * Nokia and Nokia Connecting People are registered trademarks of
  8. * Nokia Corporation.
  9. * Java and all Java-based marks are trademarks or registered
  10. * trademarks of
  11. * Sun Microsystems, Inc. Other product and company names
  12. * mentioned herein may be
  13. * trademarks or trade names of their respective owners.
  14. *
  15. *
  16. * Subject to the conditions below, you may, without charge:
  17. *
  18. * · Use, copy, modify and/or merge copies of this software and
  19. * associated documentation files (the "Software")
  20. *
  21. * · Publish, distribute, sub-licence and/or sell new software
  22. * derived from or incorporating the Software.
  23. *
  24. *
  25. * This file, unmodified, shall be included with all copies or
  26. * substantial portions
  27. * of the Software that are distributed in source code form.
  28. *
  29. * The Software cannot constitute the primary value of any new
  30. * software derived
  31. * from or incorporating the Software.
  32. *
  33. * Any person dealing with the Software shall not misrepresent
  34. * the source of the Software.
  35. *
  36. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  37. * KIND, EXPRESS OR IMPLIED,
  38. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  39. * MERCHANTABILITY, FITNESS FOR A
  40. * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41. * AUTHORS OR COPYRIGHT
  42. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  43. * WHETHER IN AN ACTION
  44. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  45. * CONNECTION WITH THE
  46. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  47. */
  48. import Qt 4.7
  49. import "javascripts/keyboard.js" as KeyboardEngine
  50. import "gradients/"
  51. import "includes/"
  52. /**
  53. * More simple keyboard. Loading time optimized.
  54. */
  55. Rectangle {
  56. id: keyboard
  57. property CLStyle style : CLStyle { }
  58. property string text
  59. property real buttonWidth: ((keyboard.width-buttonSpacing*11)/11) - (keyboard.width*0.05)/11 ;
  60. property real buttonHeight: (keyboard.height-buttonSpacing*4)/4
  61. property int buttonSpacing: width*0.005
  62. property bool abcOn: true // read-only
  63. property bool numbersOn: false; // read-only
  64. property bool europeansOn: false // read-only
  65. property Gradient buttonGradientWhenSelected : style.gradientWhenSelected
  66. property color buttonColorWhenSelected : style.colorWhenSelected
  67. property bool buttonGradientSelectedOn : style.gradientSelectedOn
  68. property bool shiftOn: false // read-only
  69. property bool capsOn: false // read-only
  70. property bool showOkCLButton: true
  71. property bool showCancelCLButton: true
  72. property real shiftTextFontSize : buttonFontSize*0.7
  73. property string shiftTextFontFamily : style.fontFamily
  74. property string shiftTextFontWeight : style.fontWeight
  75. property color shiftTextColor : style.textColor
  76. property real imageWidth : buttonWidth
  77. property real imageHeight : buttonHeight
  78. property Image shiftImage : Image { source: "images/shift_50x50.png"; scale: buttonHeight*0.01; smooth: true}
  79. property Image enterImage : Image { source: "images/enter_50x70.png"; scale: buttonWidth*0.01; smooth: true}
  80. property Image backspaceImage : Image { source: "images/backspace_50x70.png"; scale: buttonWidth*0.01; smooth: true}
  81. property Image leftArrowImage : Image { source: "images/arrow_left_50x50.png"; scale: buttonHeight*0.008; smooth: true}
  82. property Image rightArrowImage : Image { source: "images/arrow_right_50x50.png"; scale: buttonHeight*0.008; smooth: true}
  83. property Image upArrowImage : Image { source: "images/arrow_up_50x50.png"; scale: buttonHeight*0.008; smooth: true}
  84. property Image downArrowImage : Image { source: "images/arrow_down_50x50.png"; scale: buttonHeight*0.008; smooth: true}
  85. property Image okImage : Image { source: "images/ok_50x50.png"; scale: buttonHeight*0.01; smooth: true}
  86. property Image cancelImage : Image { source: "images/delete_50x50.png"; scale: buttonHeight*0.01; smooth: true}
  87. property Image capsImage : nullImage
  88. //properties straight from button
  89. property color buttonColorWhenDefault : style.colorWhenDefault
  90. property color buttonColorWhenPressed : style.colorWhenPressed
  91. property color buttonColorWhenHovered : style.colorWhenHovered
  92. property color buttonTextColor : style.textColor
  93. property real buttonRoundness : style.roundness
  94. property color buttonBorderColor : style.borderColor
  95. property int buttonBorderWidth : style.borderWidth
  96. property real buttonFontSize : height*0.05
  97. property string buttonFontFamily: style.fontFamily
  98. property string buttonFontWeight : style.fontWeight
  99. property color buttonBorderColorWhenHovered : style.borderColorWhenHovered
  100. property color buttonBorderColorWhenPressed : style.borderColorWhenPressed
  101. /* Properties for background images
  102. * --------------------------------
  103. * This solution is temporary. Remember performance.
  104. */
  105. property Image nullImage : Image { //this property is "private" don't write it to documentation
  106. id: "null"
  107. source: ""
  108. width: buttonWidth
  109. height: buttonHeight
  110. fillMode: Image.PreserveAspectCrop
  111. }
  112. property Image buttonBackgroundImage : nullImage
  113. property Image buttonBackgroundImageWhenHovered : nullImage
  114. property Image buttonBackgroundImageWhenPressed : nullImage
  115. property Image buttonCurrentImage : buttonBackgroundImage //this property is "private" don't write it to documentation
  116. property bool buttonGradientDefaultOn : style.gradientDefaultOn
  117. property bool buttonGradientHoveredOn : style.gradientHoveredOn
  118. property bool buttonGradientPressedOn : style.gradientPressedOn
  119. property bool buttonHoveredStateOn : style.hoveredStateOn
  120. property bool buttonPressedStateOn : style.pressedStateOn
  121. property Gradient buttonGradientWhenDefault : style.gradientWhenDefault
  122. property Gradient buttonGradientWhenHovered : style.gradientWhenHovered
  123. property Gradient buttonGradientWhenPressed : style.gradientWhenPressed
  124. property string buttonTextAlign: "center"
  125. property real buttonLeftMargin: 0
  126. property real buttonRightMargin: 0
  127. signal leftArrowClicked()
  128. signal rightArrowClicked()
  129. signal upArrowClicked()
  130. signal downArrowClicked()
  131. signal okCLButtonClicked()
  132. signal cancelCLButtonClicked()
  133. signal clicked()
  134. signal backspaceClicked()
  135. /**
  136. * Function shows number buttons.
  137. */
  138. function showNumbers() {
  139. if (!numbersOn) {
  140. numbers.selected = true
  141. abc.selected = false
  142. europeans.selected = false
  143. changeCharacters(KeyboardEngine.numbers)
  144. numbersOn = true;
  145. abcOn = false
  146. europeansOn = false
  147. }
  148. }
  149. /**
  150. * Function shows abc buttons
  151. */
  152. function showAbc() {
  153. if (!abcOn) {
  154. abc.selected = true
  155. europeans.selected = false
  156. numbers.selected = false
  157. changeCharacters(KeyboardEngine.abc)
  158. abcOn = true
  159. numbersOn = false
  160. europeansOn = false
  161. }
  162. }
  163. /**
  164. * Function shows european(äöå) buttons
  165. */
  166. function showEuropeans() {
  167. if (!europeans.selected) {
  168. europeans.selected = true
  169. abc.selected = false
  170. numbers.selected = false
  171. changeCharacters(KeyboardEngine.europeans)
  172. europeansOn = true
  173. abcOn = false
  174. numbersOn = false
  175. }
  176. }
  177. /**
  178. * This function changes character text in buttons when "state" is changed.
  179. * Changes characters between abc characters, number characaters and european special characters (äöå)
  180. *
  181. * @param buttons in array
  182. * @return nothing
  183. */
  184. function changeCharacters(characters) {
  185. for (var i=0; i<row1.children.length; i++) {
  186. row1.children[i].value = characters[i][0];
  187. if(characters[i][1] != null) row1.children[i].shiftValue = characters[i][1];
  188. else row1.children[i].shiftValue = characters[i][0].toUpperCase()
  189. if ((shiftOn || capsOn) && row1.children[i].shiftValue != "") {
  190. row1.children[i].text = row1.children[i].shiftValue
  191. row1.children[i].shiftText = row1.children[i].value
  192. } else {
  193. row1.children[i].text = row1.children[i].value
  194. if (row1.children[i].shiftValue != "") row1.children[i].shiftText = row1.children[i].shiftValue
  195. else row1.children[i].shiftText = ""
  196. }
  197. }
  198. for (var i=0; i<row2.children.length; i++) {
  199. row2.children[i].value = characters[KeyboardEngine.row1Length + i][0];
  200. if (characters[KeyboardEngine.row1Length - 1 + i][1] != null) {
  201. row2.children[i].shiftValue = characters[KeyboardEngine.row1Length + i][1];
  202. } else row2.children[i].shiftValue = characters[KeyboardEngine.row1Length + i][0].toUpperCase();
  203. //if shift or caps is on and character has a shift value
  204. if ((shiftOn || capsOn) && row2.children[i].shiftValue != "") {
  205. row2.children[i].text = row2.children[i].shiftValue
  206. row2.children[i].shiftText = row2.children[i].value
  207. } else {
  208. row2.children[i].text = row2.children[i].value
  209. if (row2.children[i].shiftValue != "") row2.children[i].shiftText = row2.children[i].shiftValue
  210. else row2.children[i].shiftText = ""
  211. }
  212. }
  213. for (var i=0; i<row3.children.length; i++) {
  214. row3.children[i].value = characters[KeyboardEngine.row1Length+KeyboardEngine.row2Length + i][0];
  215. if (characters[KeyboardEngine.row1Length+KeyboardEngine.row2Length + i][1] != null)row3.children[i].shiftValue = characters[KeyboardEngine.row1Length+KeyboardEngine.row2Length + i][1];
  216. else row3.children[i].shiftValue = characters[KeyboardEngine.row1Length+KeyboardEngine.row2Length + i][0].toUpperCase();
  217. if ((shiftOn || capsOn) && row3.children[i].shiftValue != "") {
  218. row3.children[i].text = row3.children[i].shiftValue
  219. row3.children[i].shiftText = row3.children[i].value
  220. } else {
  221. row3.children[i].text = row3.children[i].value
  222. if(row3.children[i].shiftValue != "") row3.children[i].shiftText = row3.children[i].shiftValue
  223. else row3.children[i].shiftText = ""
  224. }
  225. }
  226. }
  227. /**
  228. * Function which will be performed when button is clicked. In this moment
  229. * only used by buttons with shift value.
  230. *
  231. * @param active text(character) of button which is clicked
  232. * @return nothing
  233. */
  234. function keyboardCLButtonClicked(character) {
  235. keyboard.text += character;
  236. keyboard.clicked();
  237. if(shiftOn) shift();
  238. }
  239. /**
  240. * This function will be executed if shift- or caps-button is clicked on
  241. */
  242. function setShiftOn() {
  243. shiftOnSingleRow(row1);
  244. shiftOnSingleRow(row2);
  245. shiftOnSingleRow(row3);
  246. //if there is background image for up arrow button
  247. if (upArrowImage.source != "") {
  248. leftArrow.text = ""
  249. leftArrow.specialImage = upArrowImage
  250. } else {
  251. leftArrow.text = leftArrow.shiftValue
  252. leftArrow.specialImage = nullImage
  253. }
  254. leftArrow.shiftText = leftArrow.value
  255. //if there is background image for down arrow button
  256. if (downArrowImage.source != "") {
  257. rightArrow.text = ""
  258. rightArrow.specialImage = downArrowImage
  259. } else {
  260. rightArrow.text = rightArrow.shiftValue
  261. rightArrow.specialImage = nullImage
  262. }
  263. rightArrow.shiftText = rightArrow.value
  264. apostrophe.text = apostrophe.shiftValue
  265. apostrophe.shiftText = apostrophe.value
  266. }
  267. /**
  268. * Change button text to shift value in single row
  269. *
  270. * @param row Row of buttons.
  271. * @return nothing
  272. */
  273. function shiftOnSingleRow(row) {
  274. for (var i=0; i<row.children.length; i++) {
  275. if (row.children[i].shiftValue != "") {
  276. row.children[i].text = row.children[i].shiftValue;
  277. row.children[i].shiftText = row.children[i].value;
  278. }
  279. }
  280. }
  281. /**
  282. * This function will be executed if shift- or caps-button is clicked off
  283. */
  284. function setShiftOff() {
  285. shiftOffSingleRow(row1);
  286. shiftOffSingleRow(row2);
  287. shiftOffSingleRow(row3);
  288. if (leftArrowImage.source != "") {
  289. leftArrow.text = ""
  290. leftArrow.specialImage = leftArrowImage
  291. } else {
  292. leftArrow.text = leftArrow.value
  293. leftArrow.specialImage = nullImage
  294. }
  295. leftArrow.shiftText = leftArrow.shiftValue
  296. if (rightArrowImage.source != "") {
  297. leftArrow.text = ""
  298. rightArrow.specialImage = rightArrowImage
  299. } else {
  300. rightArrow.text = rightArrow.value
  301. rightArrow.specialImage = nullImage
  302. }
  303. rightArrow.shiftText = rightArrow.shiftValue
  304. apostrophe.text = apostrophe.value
  305. apostrophe.shiftText = apostrophe.shiftValue
  306. }
  307. /**
  308. * Sets shift off in single row of buttons.
  309. *
  310. * @param row of buttons
  311. * @return nothing
  312. */
  313. function shiftOffSingleRow(row) {
  314. for (var i=0; i<row.children.length; i++) {
  315. if (row.children[i].shiftValue != "") {
  316. row.children[i].text = row.children[i].value;
  317. row.children[i].shiftText = row.children[i].shiftValue;
  318. }
  319. }
  320. }
  321. /**
  322. * Function is called when shift-button is pressed...
  323. */
  324. function shift() {
  325. if (shiftOn) {
  326. //if shift is on, let's put it off
  327. setShiftOff();
  328. shiftOn = false;
  329. capsCLButton.disabled = false;
  330. shiftCLButton.selected = false
  331. } else {
  332. //if shift is off, let's put it on
  333. setShiftOn();
  334. shiftOn = true;
  335. capsCLButton.disabled = true;
  336. shiftCLButton.selected = true
  337. }
  338. }
  339. /**
  340. * Function is called when caps-button is pressed...
  341. */
  342. function caps() {
  343. if (capsOn) {
  344. //if caps is on, let's put if off
  345. setShiftOff();
  346. capsOn = false;
  347. capsCLButton.selected = false
  348. shiftCLButton.disabled = false;
  349. } else {
  350. //if caps is off, let's put it on
  351. setShiftOn();
  352. capsOn = true
  353. capsCLButton.selected = true
  354. shiftCLButton.disabled = true;
  355. }
  356. }
  357. Component.onCompleted: {
  358. abc.selected = true
  359. //if special buttons are using images in background texts has to removed
  360. if (backspaceImage.source != "") backspace.text = "";
  361. if (enterImage.source != "") enter.text = "";
  362. if (leftArrowImage.source != "") leftArrow.text = "";
  363. if (rightArrowImage.source != "") rightArrow.text = "";
  364. if (okImage.source != "") ok.text = "";
  365. if (cancelImage.source != "") cancel.text = "";
  366. if (capsImage.source != "") caps.text = "";
  367. if (shiftImage.source != "") shiftCLButton.text = "";
  368. if (!showOkCLButton) ok.visible = false
  369. if (!showCancelCLButton) cancel.visible = false
  370. }
  371. clip: true;
  372. smooth: true
  373. width: 500
  374. height: 250
  375. color: "transparent"
  376. //this element is only used for forwarding properties to buttons
  377. CLButton { id: styleCLButton; visible: false; style: keyboard.style; colorWhenDefault: buttonColorWhenDefault; colorWhenPressed: buttonColorWhenPressed; colorWhenHovered: buttonColorWhenHovered; textColor: buttonTextColor; roundness: buttonRoundness; borderColor: buttonBorderColor; borderWidth: buttonBorderWidth; fontSize: buttonFontSize; fontFamily: buttonFontFamily; fontWeight: buttonFontWeight; borderColorWhenHovered: buttonBorderColorWhenHovered; borderColorWhenPressed: buttonBorderColorWhenPressed; backgroundImage: buttonBackgroundImage; backgroundImageWhenHovered: buttonBackgroundImageWhenHovered; backgroundImageWhenPressed: buttonBackgroundImageWhenPressed; gradientDefaultOn: buttonGradientDefaultOn; gradientHoveredOn: buttonGradientHoveredOn; gradientPressedOn: buttonGradientPressedOn; hoveredStateOn: buttonHoveredStateOn; pressedStateOn: buttonPressedStateOn; gradientWhenDefault: buttonGradientWhenDefault; gradientWhenHovered: buttonGradientWhenHovered; gradientWhenPressed: buttonGradientWhenPressed; textAlign: buttonTextAlign; leftMargin: buttonLeftMargin; rightMargin: buttonRightMargin; smooth: keyboard.smooth; gradientWhenSelected: buttonGradientWhenSelected; colorWhenSelected: buttonColorWhenSelected; gradientSelectedOn: buttonGradientSelectedOn}
  378. Column {
  379. id: qwerty
  380. spacing: buttonSpacing
  381. Column {
  382. id: abcCLButtons
  383. spacing: buttonSpacing
  384. Row {
  385. x: buttonWidth*0.5
  386. spacing: buttonSpacing
  387. Row {
  388. id: row1
  389. spacing: buttonSpacing
  390. KeyboardButton { text: value; value: KeyboardEngine.abc[0][0]; shiftValue: KeyboardEngine.abc[0][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  391. KeyboardButton { text: value; value: KeyboardEngine.abc[1][0]; shiftValue: KeyboardEngine.abc[1][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  392. KeyboardButton { text: value; value: KeyboardEngine.abc[2][0]; shiftValue: KeyboardEngine.abc[2][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  393. KeyboardButton { text: value; value: KeyboardEngine.abc[3][0]; shiftValue: KeyboardEngine.abc[3][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  394. KeyboardButton { text: value; value: KeyboardEngine.abc[4][0]; shiftValue: KeyboardEngine.abc[4][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  395. KeyboardButton { text: value; value: KeyboardEngine.abc[5][0]; shiftValue: KeyboardEngine.abc[5][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  396. KeyboardButton { text: value; value: KeyboardEngine.abc[6][0]; shiftValue: KeyboardEngine.abc[6][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  397. KeyboardButton { text: value; value: KeyboardEngine.abc[7][0]; shiftValue: KeyboardEngine.abc[7][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  398. KeyboardButton { text: value; value: KeyboardEngine.abc[8][0]; shiftValue: KeyboardEngine.abc[8][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  399. KeyboardButton { text: value; value: KeyboardEngine.abc[9][0]; shiftValue: KeyboardEngine.abc[9][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  400. }
  401. KeyboardButton { id: backspace; shiftValue: ""; text:"<--"; style: keyboard.style; width: buttonWidth; height: buttonHeight; specialImage: backspaceImage; onClicked: {
  402. keyboard.text = keyboard.text.substring(0,keyboard.text.length-1);
  403. backspaceClicked()} buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor;
  404. }
  405. }
  406. Row {
  407. spacing: buttonSpacing
  408. KeyboardButton { id: capsCLButton; text:"caps"; shiftValue: ""; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: caps(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: capsImage}
  409. Row {
  410. id: row2
  411. spacing: buttonSpacing
  412. KeyboardButton { text: value; value: KeyboardEngine.abc[10][0]; shiftValue: KeyboardEngine.abc[10][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  413. KeyboardButton { text: value; value: KeyboardEngine.abc[11][0]; shiftValue: KeyboardEngine.abc[11][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  414. KeyboardButton { text: value; value: KeyboardEngine.abc[12][0]; shiftValue: KeyboardEngine.abc[12][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  415. KeyboardButton { text: value; value: KeyboardEngine.abc[13][0]; shiftValue: KeyboardEngine.abc[13][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  416. KeyboardButton { text: value; value: KeyboardEngine.abc[14][0]; shiftValue: KeyboardEngine.abc[14][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  417. KeyboardButton { text: value; value: KeyboardEngine.abc[15][0]; shiftValue: KeyboardEngine.abc[15][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  418. KeyboardButton { text: value; value: KeyboardEngine.abc[16][0]; shiftValue: KeyboardEngine.abc[16][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  419. KeyboardButton { text: value; value: KeyboardEngine.abc[17][0]; shiftValue: KeyboardEngine.abc[17][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  420. KeyboardButton { text: value; value: KeyboardEngine.abc[18][0]; shiftValue: KeyboardEngine.abc[18][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor }
  421. }
  422. KeyboardButton { id: enter; text: value; value: "enter"; shiftValue: ""; style: keyboard.style; width: buttonWidth*1.5; height: buttonHeight; onClicked: keyboardCLButtonClicked("\n"); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: enterImage}
  423. }
  424. Row {
  425. id: row3
  426. x: buttonWidth*0.5
  427. spacing: buttonSpacing
  428. KeyboardButton { text: value; value: KeyboardEngine.abc[19][0]; shiftValue: KeyboardEngine.abc[19][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  429. KeyboardButton { text: value; value: KeyboardEngine.abc[20][0]; shiftValue: KeyboardEngine.abc[20][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  430. KeyboardButton { text: value; value: KeyboardEngine.abc[21][0]; shiftValue: KeyboardEngine.abc[21][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  431. KeyboardButton { text: value; value: KeyboardEngine.abc[22][0]; shiftValue: KeyboardEngine.abc[22][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  432. KeyboardButton { text: value; value: KeyboardEngine.abc[23][0]; shiftValue: KeyboardEngine.abc[23][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  433. KeyboardButton { text: value; value: KeyboardEngine.abc[24][0]; shiftValue: KeyboardEngine.abc[24][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  434. KeyboardButton { text: value; value: KeyboardEngine.abc[25][0]; shiftValue: KeyboardEngine.abc[25][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  435. KeyboardButton { text: value; value: KeyboardEngine.abc[26][0]; shiftValue: KeyboardEngine.abc[26][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  436. KeyboardButton { text: value; value: KeyboardEngine.abc[27][0]; shiftValue: KeyboardEngine.abc[27][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  437. KeyboardButton { text: value; value: KeyboardEngine.abc[28][0]; shiftValue: KeyboardEngine.abc[28][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  438. KeyboardButton { text: value; value: KeyboardEngine.abc[29][0]; shiftValue: KeyboardEngine.abc[29][1]; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  439. }
  440. }
  441. Row {
  442. id: row4
  443. spacing: buttonSpacing
  444. KeyboardButton { id: shiftCLButton; text: "shift"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: shift(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: shiftImage}
  445. KeyboardButton { id: abc; text:"abc"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: showAbc(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  446. KeyboardButton { id: numbers; text:"123@"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: showNumbers(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  447. KeyboardButton { id: europeans; text:"<html>&auml;&ouml;&aring;</html>"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: showEuropeans(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  448. KeyboardButton { id: space; text:""; shiftValue: ""; style: keyboard.style; width: buttonWidth*2; height: buttonHeight; onClicked: keyboardCLButtonClicked(" "); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  449. KeyboardButton { id: leftArrow; text:value; value: "<html>&larr;</html>"; shiftValue: "<html>&uarr;</html>"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: {
  450. if (shiftOn) {
  451. keyboard.upArrowClicked();
  452. shift();
  453. } else if (capsOn) {
  454. keyboard.upArrowClicked();
  455. } else {
  456. keyboard.leftArrowClicked();
  457. }
  458. } buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: leftArrowImage}
  459. KeyboardButton { id: rightArrow; text: value; value: "<html>&rarr;</html>"; shiftValue: "<html>&darr;</html>"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: {
  460. if (shiftOn) {
  461. keyboard.downArrowClicked();
  462. shift();
  463. } else if (capsOn) {
  464. keyboard.downArrowClicked();
  465. } else {
  466. keyboard.rightArrowClicked();
  467. }
  468. } buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: rightArrowImage}
  469. KeyboardButton { id: apostrophe; text: value; value: "'"; shiftValue: "\""; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboardCLButtonClicked(text); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor}
  470. KeyboardButton { id: ok; text:"ok"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboard.okCLButtonClicked(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: okImage}
  471. KeyboardButton { id: cancel; text:"cancel"; style: keyboard.style; width: buttonWidth; height: buttonHeight; onClicked: keyboard.cancelCLButtonClicked(); buttonCLStyle: styleCLButton; shiftTextFontSize: keyboard.shiftTextFontSize; shiftTextFontFamily: keyboard.shiftTextFontFamily; shiftTextFontWeight: keyboard.shiftTextFontWeight; shiftTextColor: keyboard.shiftTextColor; specialImage: cancelImage}
  472. }
  473. }
  474. }