Debian Codegraph @

app/ui/LandscapeKeyboard.qml

raw
1 /*
2 * Copyright (C) 2017-2019 UBports
3 * Copyright (C) 2015 Canonical Ltd
4 *
5 * This file is part of Lomiri Calculator App
6 *
7 * Lomiri Calculator App is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 3 as
9 * published by the Free Software Foundation.
10 *
11 * Lomiri Calculator App is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 import QtQuick 2.4
21 import Lomiri.Components 1.3
22
23 CalcKeyboard {
24 id: calcKeyboard
25
26 KeyboardPage {
27 buttonRatio: 0.6
28 buttonMaxHeight: scrollableView.height / 10.0
29 columns: 8
30
31 keyboardModel: new Array(
32 { text: "←", name: "delete", action: "delete", kbdKeys: [Qt.Key_Backspace, Qt.Key_Delete], secondaryAction: "clearFormula", role: "highlight" },
33 { text: "( )", name: "universalBracket", pushText: "()", pasteTexts: ["(", ")"], kbdKeys: [Qt.Key_ParenLeft, Qt.Key_ParenRight, Qt.Key_BracketLeft, Qt.Key_BracketRight] },
34 { text: "√", name: "sqrt", pushText: "sqrt(" },
35 { text: "÷", name: "divide", pushText: "/", kbdKeys: [Qt.Key_Slash] },
36 { text: "xⁿ", name: "power", pushText: "^", kbdKeys: [Qt.Key_AsciiCircum, 16781906] }, //Number needed to make key work with the German keyboard layout as that character is normally typed by pressing the circumflex key twice but that does not work here
37 { text: "x²", name: "square", pushText: "^2", kbdKeys: [Qt.Key_twosuperior] },
38 { text: "x³", name: "cube", pushText: "^3", kbdKeys: [Qt.Key_threesuperior] },
39 { text: i18n.tr("log"), name: "logarithm", pushText: "log(", kbdKeys: [Qt.Key_L] },
40 { number: 7, name: "seven" },
41 { number: 8, name: "eight" },
42 { number: 9, name: "nine" },
43 { text: "×", name: "multiply", pushText: "*", kbdKeys: [Qt.Key_Asterisk] },
44 { text: "ℯ", name: "eNumber", pushText: "E", kbdKeys: [Qt.Key_E] },
45 { text: "π", name: "piNumber", pushText: "pi", kbdKeys: [Qt.Key_P] },
46 { text: i18n.tr("mod"), name: "modulo", pushText: "%", kbdKeys: [Qt.Key_Percent] },
47 { text: "!", name: "factorialNumber", kbdKeys: [Qt.Key_Exclam] },
48 { number: 4, name: "four" },
49 { number: 5, name: "five" },
50 { number: 6, name: "six" },
51 { text: "−", name: "minus", pushText: "-", kbdKeys: [Qt.Key_Minus] },
52 { text: "ℯⁿ", name: "exp", pushText: "E^"},
53 { text: "1/x", name: "multiplicativeInverse", pushText: "^-1" },
54 { text: "1/x²", name: "multiplicativeInverse2", pushText: "^-2" },
55 { text: "1/x³", name: "multiplicativeInverse3", pushText: "^-3" },
56 { number: 1, name: "one" },
57 { number: 2, name: "two" },
58 { number: 3, name: "three" },
59 { text: "+", name: "plus" },
60 { text: "i", name: "i", pushText: "i", kbdKeys: [Qt.Key_I] },
61 { text: "sin", name: "sinus", pushText: "sin(", kbdKeys: [Qt.Key_S] },
62 { text: "cos", name: "cos", pushText: "cos(", kbdKeys: [Qt.Key_C] },
63 { text: "tan", name: "tangens", pushText: "tan(", kbdKeys: [Qt.Key_T] },
64 { text: decimalPoint, name: "point", pushText: "." },
65 { number: 0, name: "zero", forceNumber: true },
66 { text: "=", name: "equals", wFactor: 2, action: "calculate", kbdKeys: [Qt.Key_Enter, Qt.Key_Return], role: "button" },
67 { text: "|x|", name: "abs", pushText: "abs(", kbdKeys: [Qt.Key_A, Qt.Key_Bar] },
68 { text: "sin⁻¹", name: "arcsinus", pushText: "asin(" },
69 { text: "cos⁻¹", name: "arccos", pushText: "acos(" },
70 { text: "tan⁻¹", name: "arctangens", pushText: "atan(" }
71 )
72 }
73 }