| 1 |
/**************************************************************************** |
| 2 |
** |
| 3 |
** Copyright (C) 2016 The Qt Company Ltd. |
| 4 |
** Contact: https://www.qt.io/licensing/ |
| 5 |
** |
| 6 |
** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. |
| 7 |
** |
| 8 |
** $QT_BEGIN_LICENSE:GPL$ |
| 9 |
** Commercial License Usage |
| 10 |
** Licensees holding valid commercial Qt licenses may use this file in |
| 11 |
** accordance with the commercial license agreement provided with the |
| 12 |
** Software or, alternatively, in accordance with the terms contained in |
| 13 |
** a written agreement between you and The Qt Company. For licensing terms |
| 14 |
** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 |
** information use the contact form at https://www.qt.io/contact-us. |
| 16 |
** |
| 17 |
** GNU General Public License Usage |
| 18 |
** Alternatively, this file may be used under the terms of the GNU |
| 19 |
** General Public License version 3 or (at your option) any later version |
| 20 |
** approved by the KDE Free Qt Foundation. The licenses are as published by |
| 21 |
** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
| 22 |
** included in the packaging of this file. Please review the following |
| 23 |
** information to ensure the GNU General Public License requirements will |
| 24 |
** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 25 |
** |
| 26 |
** $QT_END_LICENSE$ |
| 27 |
** |
| 28 |
****************************************************************************/ |
| 29 |
|
| 30 |
import QtQuick 2.0 |
| 31 |
import QtQuick.VirtualKeyboard 2.1 |
| 32 |
import QtQuick.VirtualKeyboard.Styles 2.1 |
| 33 |
|
| 34 |
KeyboardStyle { |
| 35 |
id: currentStyle |
| 36 |
readonly property bool compactSelectionList: [InputEngine.Pinyin, InputEngine.Cangjie, InputEngine.Zhuyin].indexOf(InputContext.inputEngine.inputMode) !== -1 |
| 37 |
readonly property string fontFamily: "Sans" |
| 38 |
readonly property real keyBackgroundMargin: Math.round(13 * scaleHint) |
| 39 |
readonly property real keyContentMargin: Math.round(45 * scaleHint) |
| 40 |
readonly property real keyIconScale: scaleHint * 0.6 |
| 41 |
readonly property string resourcePrefix: "qrc:/QtQuick/VirtualKeyboard/content/styles/default/" |
| 42 |
|
| 43 |
readonly property string inputLocale: InputContext.locale |
| 44 |
property color inputLocaleIndicatorColor: "white" |
| 45 |
property Timer inputLocaleIndicatorHighlightTimer: Timer { |
| 46 |
interval: 1000 |
| 47 |
onTriggered: inputLocaleIndicatorColor = "gray" |
| 48 |
} |
| 49 |
onInputLocaleChanged: { |
| 50 |
inputLocaleIndicatorColor = "white" |
| 51 |
inputLocaleIndicatorHighlightTimer.restart() |
| 52 |
} |
| 53 |
|
| 54 |
keyboardDesignWidth: 2560 |
| 55 |
keyboardDesignHeight: 1500 |
| 56 |
//keyboardRelativeLeftMargin: 114 / keyboardDesignWidth |
| 57 |
//keyboardRelativeRightMargin: 114 / keyboardDesignWidth |
| 58 |
keyboardRelativeTopMargin: 10 / keyboardDesignHeight |
| 59 |
keyboardRelativeBottomMargin: 10 / keyboardDesignHeight |
| 60 |
|
| 61 |
keyboardBackground: Rectangle { |
| 62 |
color: "black" |
| 63 |
} |
| 64 |
|
| 65 |
keyPanel: KeyPanel { |
| 66 |
Rectangle { |
| 67 |
id: keyBackground |
| 68 |
radius: 5 |
| 69 |
color: "#383533" |
| 70 |
anchors.fill: parent |
| 71 |
anchors.margins: keyBackgroundMargin |
| 72 |
Text { |
| 73 |
id: keySmallText |
| 74 |
text: control.smallText |
| 75 |
visible: control.smallTextVisible |
| 76 |
color: "gray" |
| 77 |
anchors.right: parent.right |
| 78 |
anchors.top: parent.top |
| 79 |
anchors.margins: keyContentMargin / 3 |
| 80 |
font { |
| 81 |
family: fontFamily |
| 82 |
weight: Font.Normal |
| 83 |
pixelSize: 86 * scaleHint |
| 84 |
capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase |
| 85 |
} |
| 86 |
} |
| 87 |
Text { |
| 88 |
id: keyText |
| 89 |
text: control.displayText |
| 90 |
color: "white" |
| 91 |
horizontalAlignment: Text.AlignHCenter |
| 92 |
verticalAlignment: Text.AlignVCenter |
| 93 |
anchors.fill: parent |
| 94 |
anchors.leftMargin: keyContentMargin |
| 95 |
anchors.topMargin: control.smallTextVisible ? keyContentMargin * 1.2 : keyContentMargin |
| 96 |
anchors.rightMargin: keyContentMargin |
| 97 |
anchors.bottomMargin: control.smallTextVisible ? keyContentMargin * 0.8 : keyContentMargin |
| 98 |
font { |
| 99 |
family: fontFamily |
| 100 |
weight: Font.Normal |
| 101 |
pixelSize: 117 * scaleHint |
| 102 |
capitalization: control.uppercased ? Font.AllUppercase : Font.MixedCase |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
states: [ |
| 107 |
State { |
| 108 |
name: "pressed" |
| 109 |
when: control.pressed |
| 110 |
PropertyChanges { |
| 111 |
target: keyBackground |
| 112 |
opacity: 0.75 |
| 113 |
} |
| 114 |
PropertyChanges { |
| 115 |
target: keyText |
| 116 |
opacity: 0.5 |
| 117 |
} |
| 118 |
}, |
| 119 |
State { |
| 120 |
name: "disabled" |
| 121 |
when: !control.enabled |
| 122 |
PropertyChanges { |
| 123 |
target: keyBackground |
| 124 |
opacity: 0.75 |
| 125 |
} |
| 126 |
PropertyChanges { |
| 127 |
target: keyText |
| 128 |
opacity: 0.05 |
| 129 |
} |
| 130 |
} |
| 131 |
] |
| 132 |
} |
| 133 |
|
| 134 |
backspaceKeyPanel: KeyPanel { |
| 135 |
Rectangle { |
| 136 |
id: backspaceKeyBackground |
| 137 |
radius: 5 |
| 138 |
color: "#23211E" |
| 139 |
anchors.fill: parent |
| 140 |
anchors.margins: keyBackgroundMargin |
| 141 |
Image { |
| 142 |
id: backspaceKeyIcon |
| 143 |
anchors.centerIn: parent |
| 144 |
sourceSize.width: 159 * keyIconScale |
| 145 |
sourceSize.height: 88 * keyIconScale |
| 146 |
smooth: false |
| 147 |
source: resourcePrefix + "images/backspace-868482.svg" |
| 148 |
} |
| 149 |
} |
| 150 |
states: [ |
| 151 |
State { |
| 152 |
name: "pressed" |
| 153 |
when: control.pressed |
| 154 |
PropertyChanges { |
| 155 |
target: backspaceKeyBackground |
| 156 |
opacity: 0.80 |
| 157 |
} |
| 158 |
PropertyChanges { |
| 159 |
target: backspaceKeyIcon |
| 160 |
opacity: 0.6 |
| 161 |
} |
| 162 |
}, |
| 163 |
State { |
| 164 |
name: "disabled" |
| 165 |
when: !control.enabled |
| 166 |
PropertyChanges { |
| 167 |
target: backspaceKeyBackground |
| 168 |
opacity: 0.8 |
| 169 |
} |
| 170 |
PropertyChanges { |
| 171 |
target: backspaceKeyIcon |
| 172 |
opacity: 0.2 |
| 173 |
} |
| 174 |
} |
| 175 |
] |
| 176 |
} |
| 177 |
|
| 178 |
languageKeyPanel: KeyPanel { |
| 179 |
Rectangle { |
| 180 |
id: languageKeyBackground |
| 181 |
radius: 5 |
| 182 |
color: "#35322f" |
| 183 |
anchors.fill: parent |
| 184 |
anchors.margins: keyBackgroundMargin |
| 185 |
Image { |
| 186 |
id: languageKeyIcon |
| 187 |
anchors.centerIn: parent |
| 188 |
sourceSize.width: 144 * keyIconScale |
| 189 |
sourceSize.height: 144 * keyIconScale |
| 190 |
smooth: false |
| 191 |
source: resourcePrefix + "images/globe-868482.svg" |
| 192 |
} |
| 193 |
} |
| 194 |
states: [ |
| 195 |
State { |
| 196 |
name: "pressed" |
| 197 |
when: control.pressed |
| 198 |
PropertyChanges { |
| 199 |
target: languageKeyBackground |
| 200 |
opacity: 0.80 |
| 201 |
} |
| 202 |
PropertyChanges { |
| 203 |
target: languageKeyIcon |
| 204 |
opacity: 0.75 |
| 205 |
} |
| 206 |
}, |
| 207 |
State { |
| 208 |
name: "disabled" |
| 209 |
when: !control.enabled |
| 210 |
PropertyChanges { |
| 211 |
target: languageKeyBackground |
| 212 |
opacity: 0.8 |
| 213 |
} |
| 214 |
PropertyChanges { |
| 215 |
target: languageKeyIcon |
| 216 |
opacity: 0.2 |
| 217 |
} |
| 218 |
} |
| 219 |
] |
| 220 |
} |
| 221 |
|
| 222 |
enterKeyPanel: KeyPanel { |
| 223 |
Rectangle { |
| 224 |
id: enterKeyBackground |
| 225 |
radius: 5 |
| 226 |
color: "#1e1b18" |
| 227 |
anchors.fill: parent |
| 228 |
anchors.margins: keyBackgroundMargin |
| 229 |
Image { |
| 230 |
id: enterKeyIcon |
| 231 |
visible: enterKeyText.text.length === 0 |
| 232 |
anchors.centerIn: parent |
| 233 |
readonly property size enterKeyIconSize: { |
| 234 |
switch (control.actionId) { |
| 235 |
case EnterKeyAction.Go: |
| 236 |
case EnterKeyAction.Send: |
| 237 |
case EnterKeyAction.Next: |
| 238 |
case EnterKeyAction.Done: |
| 239 |
return Qt.size(170, 119) |
| 240 |
case EnterKeyAction.Search: |
| 241 |
return Qt.size(148, 148) |
| 242 |
default: |
| 243 |
return Qt.size(211, 80) |
| 244 |
} |
| 245 |
} |
| 246 |
sourceSize.width: enterKeyIconSize.width * keyIconScale |
| 247 |
sourceSize.height: enterKeyIconSize.height * keyIconScale |
| 248 |
smooth: false |
| 249 |
source: { |
| 250 |
switch (control.actionId) { |
| 251 |
case EnterKeyAction.Go: |
| 252 |
case EnterKeyAction.Send: |
| 253 |
case EnterKeyAction.Next: |
| 254 |
case EnterKeyAction.Done: |
| 255 |
return resourcePrefix + "images/check-868482.svg" |
| 256 |
case EnterKeyAction.Search: |
| 257 |
return resourcePrefix + "images/search-868482.svg" |
| 258 |
default: |
| 259 |
return resourcePrefix + "images/enter-868482.svg" |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
Text { |
| 264 |
id: enterKeyText |
| 265 |
visible: text.length !== 0 |
| 266 |
text: control.actionId !== EnterKeyAction.None ? "" : control.displayText |
| 267 |
clip: true |
| 268 |
fontSizeMode: Text.HorizontalFit |
| 269 |
horizontalAlignment: Text.AlignHCenter |
| 270 |
verticalAlignment: Text.AlignVCenter |
| 271 |
color: "#80c342" |
| 272 |
font { |
| 273 |
family: fontFamily |
| 274 |
weight: Font.Normal |
| 275 |
pixelSize: 99 * scaleHint |
| 276 |
capitalization: Font.AllUppercase |
| 277 |
} |
| 278 |
anchors.fill: parent |
| 279 |
anchors.margins: Math.round(42 * scaleHint) |
| 280 |
} |
| 281 |
} |
| 282 |
states: [ |
| 283 |
State { |
| 284 |
name: "pressed" |
| 285 |
when: control.pressed |
| 286 |
PropertyChanges { |
| 287 |
target: enterKeyBackground |
| 288 |
opacity: 0.80 |
| 289 |
} |
| 290 |
PropertyChanges { |
| 291 |
target: enterKeyIcon |
| 292 |
opacity: 0.6 |
| 293 |
} |
| 294 |
PropertyChanges { |
| 295 |
target: enterKeyText |
| 296 |
opacity: 0.6 |
| 297 |
} |
| 298 |
}, |
| 299 |
State { |
| 300 |
name: "disabled" |
| 301 |
when: !control.enabled |
| 302 |
PropertyChanges { |
| 303 |
target: enterKeyBackground |
| 304 |
opacity: 0.8 |
| 305 |
} |
| 306 |
PropertyChanges { |
| 307 |
target: enterKeyIcon |
| 308 |
opacity: 0.2 |
| 309 |
} |
| 310 |
PropertyChanges { |
| 311 |
target: enterKeyText |
| 312 |
opacity: 0.05 |
| 313 |
} |
| 314 |
} |
| 315 |
] |
| 316 |
} |
| 317 |
|
| 318 |
hideKeyPanel: KeyPanel { |
| 319 |
Rectangle { |
| 320 |
id: hideKeyBackground |
| 321 |
radius: 5 |
| 322 |
color: "#1e1b18" |
| 323 |
anchors.fill: parent |
| 324 |
anchors.margins: keyBackgroundMargin |
| 325 |
Image { |
| 326 |
id: hideKeyIcon |
| 327 |
anchors.centerIn: parent |
| 328 |
sourceSize.width: 144 * keyIconScale |
| 329 |
sourceSize.height: 127 * keyIconScale |
| 330 |
smooth: false |
| 331 |
source: resourcePrefix + "images/hidekeyboard-868482.svg" |
| 332 |
} |
| 333 |
} |
| 334 |
states: [ |
| 335 |
State { |
| 336 |
name: "pressed" |
| 337 |
when: control.pressed |
| 338 |
PropertyChanges { |
| 339 |
target: hideKeyBackground |
| 340 |
opacity: 0.80 |
| 341 |
} |
| 342 |
PropertyChanges { |
| 343 |
target: hideKeyIcon |
| 344 |
opacity: 0.6 |
| 345 |
} |
| 346 |
}, |
| 347 |
State { |
| 348 |
name: "disabled" |
| 349 |
when: !control.enabled |
| 350 |
PropertyChanges { |
| 351 |
target: hideKeyBackground |
| 352 |
opacity: 0.8 |
| 353 |
} |
| 354 |
PropertyChanges { |
| 355 |
target: hideKeyIcon |
| 356 |
opacity: 0.2 |
| 357 |
} |
| 358 |
} |
| 359 |
] |
| 360 |
} |
| 361 |
|
| 362 |
shiftKeyPanel: KeyPanel { |
| 363 |
Rectangle { |
| 364 |
id: shiftKeyBackground |
| 365 |
radius: 5 |
| 366 |
color: "#1e1b18" |
| 367 |
anchors.fill: parent |
| 368 |
anchors.margins: keyBackgroundMargin |
| 369 |
Image { |
| 370 |
id: shiftKeyIcon |
| 371 |
anchors.centerIn: parent |
| 372 |
sourceSize.width: 144 * keyIconScale |
| 373 |
sourceSize.height: 134 * keyIconScale |
| 374 |
smooth: false |
| 375 |
source: resourcePrefix + "images/shift-868482.svg" |
| 376 |
} |
| 377 |
states: [ |
| 378 |
State { |
| 379 |
name: "capslock" |
| 380 |
when: InputContext.capsLock |
| 381 |
PropertyChanges { |
| 382 |
target: shiftKeyBackground |
| 383 |
color: "#5a892e" |
| 384 |
} |
| 385 |
PropertyChanges { |
| 386 |
target: shiftKeyIcon |
| 387 |
source: resourcePrefix + "images/shift-c5d6b6.svg" |
| 388 |
} |
| 389 |
}, |
| 390 |
State { |
| 391 |
name: "shift" |
| 392 |
when: InputContext.shift |
| 393 |
PropertyChanges { |
| 394 |
target: shiftKeyIcon |
| 395 |
source: resourcePrefix + "images/shift-80c342.svg" |
| 396 |
} |
| 397 |
} |
| 398 |
] |
| 399 |
} |
| 400 |
states: [ |
| 401 |
State { |
| 402 |
name: "pressed" |
| 403 |
when: control.pressed |
| 404 |
PropertyChanges { |
| 405 |
target: shiftKeyBackground |
| 406 |
opacity: 0.80 |
| 407 |
} |
| 408 |
PropertyChanges { |
| 409 |
target: shiftKeyIcon |
| 410 |
opacity: 0.6 |
| 411 |
} |
| 412 |
}, |
| 413 |
State { |
| 414 |
name: "disabled" |
| 415 |
when: !control.enabled |
| 416 |
PropertyChanges { |
| 417 |
target: shiftKeyBackground |
| 418 |
opacity: 0.8 |
| 419 |
} |
| 420 |
PropertyChanges { |
| 421 |
target: shiftKeyIcon |
| 422 |
opacity: 0.2 |
| 423 |
} |
| 424 |
} |
| 425 |
] |
| 426 |
} |
| 427 |
|
| 428 |
spaceKeyPanel: KeyPanel { |
| 429 |
Rectangle { |
| 430 |
id: spaceKeyBackground |
| 431 |
radius: 5 |
| 432 |
color: "#35322f" |
| 433 |
anchors.fill: parent |
| 434 |
anchors.margins: keyBackgroundMargin |
| 435 |
Text { |
| 436 |
id: spaceKeyText |
| 437 |
text: Qt.locale(InputContext.locale).nativeLanguageName |
| 438 |
color: currentStyle.inputLocaleIndicatorColor |
| 439 |
Behavior on color { PropertyAnimation { duration: 250 } } |
| 440 |
anchors.centerIn: parent |
| 441 |
font { |
| 442 |
family: fontFamily |
| 443 |
weight: Font.Normal |
| 444 |
pixelSize: 72 * scaleHint |
| 445 |
} |
| 446 |
} |
| 447 |
} |
| 448 |
states: [ |
| 449 |
State { |
| 450 |
name: "pressed" |
| 451 |
when: control.pressed |
| 452 |
PropertyChanges { |
| 453 |
target: spaceKeyBackground |
| 454 |
opacity: 0.80 |
| 455 |
} |
| 456 |
}, |
| 457 |
State { |
| 458 |
name: "disabled" |
| 459 |
when: !control.enabled |
| 460 |
PropertyChanges { |
| 461 |
target: spaceKeyBackground |
| 462 |
opacity: 0.8 |
| 463 |
} |
| 464 |
} |
| 465 |
] |
| 466 |
} |
| 467 |
|
| 468 |
symbolKeyPanel: KeyPanel { |
| 469 |
Rectangle { |
| 470 |
id: symbolKeyBackground |
| 471 |
radius: 5 |
| 472 |
color: "#1e1b18" |
| 473 |
anchors.fill: parent |
| 474 |
anchors.margins: keyBackgroundMargin |
| 475 |
Text { |
| 476 |
id: symbolKeyText |
| 477 |
text: control.displayText |
| 478 |
color: "white" |
| 479 |
horizontalAlignment: Text.AlignHCenter |
| 480 |
verticalAlignment: Text.AlignVCenter |
| 481 |
anchors.fill: parent |
| 482 |
anchors.margins: keyContentMargin |
| 483 |
font { |
| 484 |
family: fontFamily |
| 485 |
weight: Font.Normal |
| 486 |
pixelSize: 66 * scaleHint |
| 487 |
capitalization: Font.AllUppercase |
| 488 |
} |
| 489 |
} |
| 490 |
} |
| 491 |
states: [ |
| 492 |
State { |
| 493 |
name: "pressed" |
| 494 |
when: control.pressed |
| 495 |
PropertyChanges { |
| 496 |
target: symbolKeyBackground |
| 497 |
opacity: 0.80 |
| 498 |
} |
| 499 |
PropertyChanges { |
| 500 |
target: symbolKeyText |
| 501 |
opacity: 0.6 |
| 502 |
} |
| 503 |
}, |
| 504 |
State { |
| 505 |
name: "disabled" |
| 506 |
when: !control.enabled |
| 507 |
PropertyChanges { |
| 508 |
target: symbolKeyBackground |
| 509 |
opacity: 0.8 |
| 510 |
} |
| 511 |
PropertyChanges { |
| 512 |
target: symbolKeyText |
| 513 |
opacity: 0.2 |
| 514 |
} |
| 515 |
} |
| 516 |
] |
| 517 |
} |
| 518 |
|
| 519 |
modeKeyPanel: KeyPanel { |
| 520 |
Rectangle { |
| 521 |
id: modeKeyBackground |
| 522 |
radius: 5 |
| 523 |
color: "#1e1b18" |
| 524 |
anchors.fill: parent |
| 525 |
anchors.margins: keyBackgroundMargin |
| 526 |
Text { |
| 527 |
id: modeKeyText |
| 528 |
text: control.displayText |
| 529 |
color: "white" |
| 530 |
horizontalAlignment: Text.AlignHCenter |
| 531 |
verticalAlignment: Text.AlignVCenter |
| 532 |
anchors.fill: parent |
| 533 |
anchors.margins: keyContentMargin |
| 534 |
font { |
| 535 |
family: fontFamily |
| 536 |
weight: Font.Normal |
| 537 |
pixelSize: 66 * scaleHint |
| 538 |
capitalization: Font.AllUppercase |
| 539 |
} |
| 540 |
} |
| 541 |
Rectangle { |
| 542 |
id: modeKeyIndicator |
| 543 |
implicitHeight: parent.height * 0.1 |
| 544 |
anchors.left: parent.left |
| 545 |
anchors.right: parent.right |
| 546 |
anchors.bottom: parent.bottom |
| 547 |
anchors.leftMargin: parent.width * 0.4 |
| 548 |
anchors.rightMargin: parent.width * 0.4 |
| 549 |
anchors.bottomMargin: parent.height * 0.12 |
| 550 |
color: "#80c342" |
| 551 |
radius: 3 |
| 552 |
visible: control.mode |
| 553 |
} |
| 554 |
} |
| 555 |
states: [ |
| 556 |
State { |
| 557 |
name: "pressed" |
| 558 |
when: control.pressed |
| 559 |
PropertyChanges { |
| 560 |
target: modeKeyBackground |
| 561 |
opacity: 0.80 |
| 562 |
} |
| 563 |
PropertyChanges { |
| 564 |
target: modeKeyText |
| 565 |
opacity: 0.6 |
| 566 |
} |
| 567 |
}, |
| 568 |
State { |
| 569 |
name: "disabled" |
| 570 |
when: !control.enabled |
| 571 |
PropertyChanges { |
| 572 |
target: modeKeyBackground |
| 573 |
opacity: 0.8 |
| 574 |
} |
| 575 |
PropertyChanges { |
| 576 |
target: modeKeyText |
| 577 |
opacity: 0.2 |
| 578 |
} |
| 579 |
} |
| 580 |
] |
| 581 |
} |
| 582 |
|
| 583 |
handwritingKeyPanel: KeyPanel { |
| 584 |
Rectangle { |
| 585 |
id: hwrKeyBackground |
| 586 |
radius: 5 |
| 587 |
color: "#35322f" |
| 588 |
anchors.fill: parent |
| 589 |
anchors.margins: keyBackgroundMargin |
| 590 |
Image { |
| 591 |
id: hwrKeyIcon |
| 592 |
anchors.centerIn: parent |
| 593 |
readonly property size hwrKeyIconSize: keyboard.handwritingMode ? Qt.size(124, 96) : Qt.size(156, 104) |
| 594 |
sourceSize.width: hwrKeyIconSize.width * keyIconScale |
| 595 |
sourceSize.height: hwrKeyIconSize.height * keyIconScale |
| 596 |
smooth: false |
| 597 |
source: resourcePrefix + (keyboard.handwritingMode ? "images/textmode-868482.svg" : "images/handwriting-868482.svg") |
| 598 |
} |
| 599 |
} |
| 600 |
states: [ |
| 601 |
State { |
| 602 |
name: "pressed" |
| 603 |
when: control.pressed |
| 604 |
PropertyChanges { |
| 605 |
target: hwrKeyBackground |
| 606 |
opacity: 0.80 |
| 607 |
} |
| 608 |
PropertyChanges { |
| 609 |
target: hwrKeyIcon |
| 610 |
opacity: 0.6 |
| 611 |
} |
| 612 |
}, |
| 613 |
State { |
| 614 |
name: "disabled" |
| 615 |
when: !control.enabled |
| 616 |
PropertyChanges { |
| 617 |
target: hwrKeyBackground |
| 618 |
opacity: 0.8 |
| 619 |
} |
| 620 |
PropertyChanges { |
| 621 |
target: hwrKeyIcon |
| 622 |
opacity: 0.2 |
| 623 |
} |
| 624 |
} |
| 625 |
] |
| 626 |
} |
| 627 |
|
| 628 |
characterPreviewMargin: 1.5 * keyContentMargin |
| 629 |
characterPreviewDelegate: Item { |
| 630 |
property string text |
| 631 |
id: characterPreview |
| 632 |
Rectangle { |
| 633 |
id: characterPreviewBackground |
| 634 |
anchors.fill: parent |
| 635 |
color: "#5d5b59" |
| 636 |
radius: 5 |
| 637 |
Text { |
| 638 |
id: characterPreviewText |
| 639 |
color: "white" |
| 640 |
text: characterPreview.text |
| 641 |
fontSizeMode: Text.HorizontalFit |
| 642 |
horizontalAlignment: Text.AlignHCenter |
| 643 |
verticalAlignment: Text.AlignVCenter |
| 644 |
anchors.fill: parent |
| 645 |
anchors.margins: Math.round(48 * scaleHint) |
| 646 |
font { |
| 647 |
family: fontFamily |
| 648 |
weight: Font.Normal |
| 649 |
pixelSize: 82 * scaleHint |
| 650 |
} |
| 651 |
} |
| 652 |
} |
| 653 |
} |
| 654 |
|
| 655 |
alternateKeysListItemWidth: 99 * scaleHint |
| 656 |
alternateKeysListItemHeight: 150 * scaleHint |
| 657 |
alternateKeysListDelegate: Item { |
| 658 |
id: alternateKeysListItem |
| 659 |
width: alternateKeysListItemWidth |
| 660 |
height: alternateKeysListItemHeight |
| 661 |
Text { |
| 662 |
id: listItemText |
| 663 |
text: model.text |
| 664 |
color: "#868482" |
| 665 |
font { |
| 666 |
family: fontFamily |
| 667 |
weight: Font.Normal |
| 668 |
pixelSize: 52 * scaleHint |
| 669 |
} |
| 670 |
anchors.centerIn: parent |
| 671 |
} |
| 672 |
states: State { |
| 673 |
name: "current" |
| 674 |
when: alternateKeysListItem.ListView.isCurrentItem |
| 675 |
PropertyChanges { |
| 676 |
target: listItemText |
| 677 |
color: "white" |
| 678 |
} |
| 679 |
} |
| 680 |
} |
| 681 |
alternateKeysListHighlight: Rectangle { |
| 682 |
color: "#5d5b59" |
| 683 |
radius: 5 |
| 684 |
} |
| 685 |
alternateKeysListBackground: Rectangle { |
| 686 |
color: "#1e1b18" |
| 687 |
radius: 5 |
| 688 |
} |
| 689 |
|
| 690 |
selectionListHeight: 85 * scaleHint |
| 691 |
selectionListDelegate: SelectionListItem { |
| 692 |
id: selectionListItem |
| 693 |
width: Math.round(selectionListLabel.width + selectionListLabel.anchors.leftMargin * 2) |
| 694 |
Text { |
| 695 |
id: selectionListLabel |
| 696 |
anchors.left: parent.left |
| 697 |
anchors.leftMargin: Math.round((compactSelectionList ? 50 : 140) * scaleHint) |
| 698 |
anchors.verticalCenter: parent.verticalCenter |
| 699 |
text: decorateText(display, wordCompletionLength) |
| 700 |
color: "#80c342" |
| 701 |
font { |
| 702 |
family: fontFamily |
| 703 |
weight: Font.Normal |
| 704 |
pixelSize: 44 * scaleHint |
| 705 |
} |
| 706 |
function decorateText(text, wordCompletionLength) { |
| 707 |
if (wordCompletionLength > 0) { |
| 708 |
return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>' |
| 709 |
} |
| 710 |
return text |
| 711 |
} |
| 712 |
} |
| 713 |
Rectangle { |
| 714 |
id: selectionListSeparator |
| 715 |
width: 4 * scaleHint |
| 716 |
height: 36 * scaleHint |
| 717 |
radius: 2 |
| 718 |
color: "#35322f" |
| 719 |
anchors.verticalCenter: parent.verticalCenter |
| 720 |
anchors.right: parent.left |
| 721 |
} |
| 722 |
states: State { |
| 723 |
name: "current" |
| 724 |
when: selectionListItem.ListView.isCurrentItem |
| 725 |
PropertyChanges { |
| 726 |
target: selectionListLabel |
| 727 |
color: "white" |
| 728 |
} |
| 729 |
} |
| 730 |
} |
| 731 |
selectionListBackground: Rectangle { |
| 732 |
color: "#1e1b18" |
| 733 |
} |
| 734 |
selectionListAdd: Transition { |
| 735 |
NumberAnimation { property: "y"; from: wordCandidateView.height; duration: 200 } |
| 736 |
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 } |
| 737 |
} |
| 738 |
selectionListRemove: Transition { |
| 739 |
NumberAnimation { property: "y"; to: -wordCandidateView.height; duration: 200 } |
| 740 |
NumberAnimation { property: "opacity"; to: 0; duration: 200 } |
| 741 |
} |
| 742 |
|
| 743 |
navigationHighlight: Rectangle { |
| 744 |
color: "transparent" |
| 745 |
border.color: "yellow" |
| 746 |
border.width: 5 |
| 747 |
} |
| 748 |
|
| 749 |
traceInputKeyPanelDelegate: TraceInputKeyPanel { |
| 750 |
traceMargins: keyBackgroundMargin |
| 751 |
Rectangle { |
| 752 |
id: traceInputKeyPanelBackground |
| 753 |
radius: 5 |
| 754 |
color: "#35322f" |
| 755 |
anchors.fill: parent |
| 756 |
anchors.margins: keyBackgroundMargin |
| 757 |
Text { |
| 758 |
id: hwrInputModeIndicator |
| 759 |
visible: control.patternRecognitionMode === InputEngine.HandwritingRecoginition |
| 760 |
text: InputContext.inputEngine.inputMode === InputEngine.Latin ? "Abc" : "123" |
| 761 |
color: "white" |
| 762 |
anchors.left: parent.left |
| 763 |
anchors.top: parent.top |
| 764 |
anchors.margins: keyContentMargin |
| 765 |
font { |
| 766 |
family: fontFamily |
| 767 |
weight: Font.Normal |
| 768 |
pixelSize: 44 * scaleHint |
| 769 |
capitalization: { |
| 770 |
if (InputContext.capsLock) |
| 771 |
return Font.AllUppercase |
| 772 |
if (InputContext.shift) |
| 773 |
return Font.MixedCase |
| 774 |
return Font.AllLowercase |
| 775 |
} |
| 776 |
} |
| 777 |
} |
| 778 |
} |
| 779 |
Canvas { |
| 780 |
id: traceInputKeyGuideLines |
| 781 |
anchors.fill: traceInputKeyPanelBackground |
| 782 |
opacity: 0.1 |
| 783 |
onPaint: { |
| 784 |
var ctx = getContext("2d") |
| 785 |
ctx.lineWidth = 1 |
| 786 |
ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF) |
| 787 |
ctx.clearRect(0, 0, width, height) |
| 788 |
var i |
| 789 |
if (control.horizontalRulers) { |
| 790 |
for (i = 0; i < control.horizontalRulers.length; i++) { |
| 791 |
ctx.beginPath() |
| 792 |
ctx.moveTo(0, control.horizontalRulers[i]) |
| 793 |
ctx.lineTo(width, control.horizontalRulers[i]) |
| 794 |
ctx.stroke() |
| 795 |
} |
| 796 |
} |
| 797 |
if (control.verticalRulers) { |
| 798 |
for (i = 0; i < control.verticalRulers.length; i++) { |
| 799 |
ctx.beginPath() |
| 800 |
ctx.moveTo(control.verticalRulers[i], 0) |
| 801 |
ctx.lineTo(control.verticalRulers[i], height) |
| 802 |
ctx.stroke() |
| 803 |
} |
| 804 |
} |
| 805 |
} |
| 806 |
} |
| 807 |
} |
| 808 |
|
| 809 |
traceCanvasDelegate: TraceCanvas { |
| 810 |
id: traceCanvas |
| 811 |
onAvailableChanged: { |
| 812 |
if (!available) |
| 813 |
return |
| 814 |
var ctx = getContext("2d") |
| 815 |
if (parent.canvasType === "fullscreen") { |
| 816 |
ctx.lineWidth = 10 |
| 817 |
ctx.strokeStyle = Qt.rgba(0, 0, 0) |
| 818 |
} else { |
| 819 |
ctx.lineWidth = 10 * scaleHint |
| 820 |
ctx.strokeStyle = Qt.rgba(0xFF, 0xFF, 0xFF) |
| 821 |
} |
| 822 |
ctx.lineCap = "round" |
| 823 |
ctx.fillStyle = ctx.strokeStyle |
| 824 |
} |
| 825 |
autoDestroyDelay: 800 |
| 826 |
onTraceChanged: if (trace === null) opacity = 0 |
| 827 |
Behavior on opacity { PropertyAnimation { easing.type: Easing.OutCubic; duration: 150 } } |
| 828 |
} |
| 829 |
|
| 830 |
popupListDelegate: SelectionListItem { |
| 831 |
property real cursorAnchor: popupListLabel.x + popupListLabel.width |
| 832 |
id: popupListItem |
| 833 |
width: popupListLabel.width + popupListLabel.anchors.leftMargin * 2 |
| 834 |
height: popupListLabel.height + popupListLabel.anchors.topMargin * 2 |
| 835 |
Text { |
| 836 |
id: popupListLabel |
| 837 |
anchors.left: parent.left |
| 838 |
anchors.top: parent.top |
| 839 |
anchors.leftMargin: popupListLabel.height / 2 |
| 840 |
anchors.topMargin: popupListLabel.height / 3 |
| 841 |
text: decorateText(display, wordCompletionLength) |
| 842 |
color: "#5CAA15" |
| 843 |
font { |
| 844 |
family: fontFamily |
| 845 |
weight: Font.Normal |
| 846 |
pixelSize: Qt.inputMethod.cursorRectangle.height * 0.8 |
| 847 |
} |
| 848 |
function decorateText(text, wordCompletionLength) { |
| 849 |
if (wordCompletionLength > 0) { |
| 850 |
return text.slice(0, -wordCompletionLength) + '<u>' + text.slice(-wordCompletionLength) + '</u>' |
| 851 |
} |
| 852 |
return text |
| 853 |
} |
| 854 |
} |
| 855 |
states: State { |
| 856 |
name: "current" |
| 857 |
when: popupListItem.ListView.isCurrentItem |
| 858 |
PropertyChanges { |
| 859 |
target: popupListLabel |
| 860 |
color: "black" |
| 861 |
} |
| 862 |
} |
| 863 |
} |
| 864 |
|
| 865 |
popupListBackground: Item { |
| 866 |
Rectangle { |
| 867 |
width: parent.width |
| 868 |
height: parent.height |
| 869 |
color: "white" |
| 870 |
border { |
| 871 |
width: 1 |
| 872 |
color: "#929495" |
| 873 |
} |
| 874 |
} |
| 875 |
} |
| 876 |
|
| 877 |
popupListAdd: Transition { |
| 878 |
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 200 } |
| 879 |
} |
| 880 |
|
| 881 |
popupListRemove: Transition { |
| 882 |
NumberAnimation { property: "opacity"; to: 0; duration: 200 } |
| 883 |
} |
| 884 |
|
| 885 |
selectionHandle: Image { |
| 886 |
sourceSize.width: 20 |
| 887 |
source: resourcePrefix + "images/selectionhandle-bottom.svg" |
| 888 |
} |
| 889 |
} |