Merge lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement into lp:ubuntu-calculator-app

Proposed by Riccardo Padovani
Status: Merged
Merged at revision: 5
Proposed branch: lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement
Merge into: lp:ubuntu-calculator-app
Prerequisite: lp:~rpadovani/ubuntu-calculator-app/cleanUp
Diff against target: 934 lines (+411/-481)
2 files modified
app/ubuntu-calculator-app.qml (+1/-1)
app/ui/CalcKeyboard.qml (+410/-480)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement
Reviewer Review Type Date Requested Status
Bartosz Kosiorek Approve
Review via email: mp+242887@code.launchpad.net

Commit message

Added swype to advanced functions and support for them

Description of the change

Added swype to advanced functions and support for them

To post a comment you must log in.
6. By Riccardo Padovani

Updated copyright

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Looks ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ubuntu-calculator-app.qml'
2--- app/ubuntu-calculator-app.qml 2014-11-26 09:41:07 +0000
3+++ app/ubuntu-calculator-app.qml 2014-11-26 09:41:07 +0000
4@@ -42,7 +42,7 @@
5
6 function calculate() {
7 console.log("Formula: " + formula)
8- var result = MathJs.eval(formula);
9+ var result = mathJs.eval(formula);
10 result = result.toString();
11 console.log("Result: " + result);
12 formula = '';
13
14=== modified file 'app/ui/CalcKeyboard.qml'
15--- app/ui/CalcKeyboard.qml 2014-11-26 09:41:07 +0000
16+++ app/ui/CalcKeyboard.qml 2014-11-26 09:41:07 +0000
17@@ -1,13 +1,13 @@
18 /*
19- * Copyright 2014 Canonical Ltd.
20- *
21- * This file is part of ubuntu-calculator-app.
22- *
23- * ubuntu-calculator-app is free software; you can redistribute it and/or modify
24- * it under the terms of the GNU General Public License as published by
25- * the Free Software Foundation; version 3.
26- *
27- * ubuntu-calculator-app is distributed in the hope that it will be useful,
28+ * Copyright (C) 2014 Canonical Ltd
29+ *
30+ * This file is part of Ubuntu Calculator App
31+ *
32+ * Ubuntu Calculator App is free software: you can redistribute it and/or modify
33+ * it under the terms of the GNU General Public License version 3 as
34+ * published by the Free Software Foundation.
35+ *
36+ * Ubuntu Calculator App is distributed in the hope that it will be useful,
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 * GNU General Public License for more details.
40@@ -15,14 +15,13 @@
41 * You should have received a copy of the GNU General Public License
42 * along with this program. If not, see <http://www.gnu.org/licenses/>.
43 */
44-
45 import QtQuick 2.3
46 import Ubuntu.Components 1.1
47
48 Item {
49 id: virtualKeyboard
50 width: parent.width
51- height: parent.height / 2
52+ height: grid.height+units.gu(2)
53
54 property int calcGridUnit: width / 50
55 property variant keyboardButtons: {'0': zeroButton,
56@@ -51,478 +50,409 @@
57 'clear': clearButton,
58 'backspace': backspaceButton }
59
60- Rectangle {
61- width: virtualKeyboard.width * 2
62- height: grid.height + units.gu(2)
63- color: "#ffffff"
64+ Flickable {
65+ id: flickableKeyboard
66+ anchors.fill: parent
67+ flickableDirection: Flickable.HorizontalFlick
68+ contentWidth: virtualKeyboard.width * 2
69+ contentHeight: grid.height + units.gu(4)
70+ boundsBehavior: Flickable.DragOverBounds
71
72- anchors{
73- top: parent.top
74- topMargin: formulaView.__wasAtYBegining & formulaView.__displaceDist > 0 ? formulaView.__displaceDist : 0
75+ onMovementEnded: {
76+ // if we are not on the border of the virtual calculator keyboard
77+ // then trigger flick
78+ if (!flickableKeyboard.atXBeginning && !flickableKeyboard.atXEnd) {
79+ if (contentX < virtualKeyboard.width / 2) {
80+ flickableKeyboard.flick( units.gu(200), 0);
81+ } else {
82+ flickableKeyboard.flick( -units.gu(200), 0);
83+ }
84+ }
85 }
86
87- Item {
88- id: grid
89-
90- // 8 keys and 7 space between and border
91- width: (calcGridUnit*12)*8 + (calcGridUnit)*7 + calcGridUnit
92- height: (calcGridUnit*9)*5 + (calcGridUnit)*4
93-
94- anchors{
95- horizontalCenter: parent.horizontalCenter
96- top: parent.top
97- topMargin: units.gu(1)
98- }
99-
100- KeyboardButton {
101- objectName: "clearButton"
102- id: clearButton
103- x: 0
104- y: 0
105- // TRANSLATORS: Refers to Clear, keep the translation to 2 characters
106- text: i18n.tr("←")
107- onReleased: {
108- numeralPop();
109-
110- }
111- }
112-
113- KeyboardButton {
114- objectName: "signButton"
115- id: signButton
116- x: (calcGridUnit*13)
117- y: 0
118- text: "+/-"
119- onReleased: {
120- changeSign();
121- }
122- }
123-
124- KeyboardButton {
125- objectName: "divideButton"
126- id: divideButton
127- x: (calcGridUnit*13)*2
128- y: 0
129- text: "÷"
130- onReleased: {
131- formulaPush('/');
132-
133- }
134- }
135-
136- KeyboardButton {
137- objectName: "multiplyButton"
138- id: multiplyButton
139- x: (calcGridUnit*13)*3
140- y: 0
141- text: "×"
142- onReleased: {
143- formulaPush('*');
144-
145- }
146- }
147-
148- KeyboardButton {
149- objectName: "powerButton"
150- id: powerButton
151- x: (calcGridUnit*13)*4 + calcGridUnit
152- y: 0
153- text: "xⁿ"
154- onReleased: {
155- formulaPush('^');
156- }
157- }
158-
159-
160- KeyboardButton {
161- objectName: "squareButton"
162- id: squareButton
163- x: (calcGridUnit*13)*5 + calcGridUnit
164- y: 0
165- text: "x²"
166- onReleased: {
167- if (formulaPush('^') === true) {
168- hasToAddDot = true
169- formulaPush('2')
170- }
171- }
172- }
173-
174- KeyboardButton {
175- objectName: "cubeButton"
176- id: cubeButton
177- x: (calcGridUnit*13)*6 + calcGridUnit
178- y: 0
179- text: "x³"
180- onReleased: {
181- if (formulaPush('^') === true) {
182- //make sure that we have integers (to avoid expressions like 2^2.1)
183- hasToAddDot = true
184- formulaPush('3')
185- }
186- }
187- }
188-
189- KeyboardButton {
190- objectName: "backspaceButton"
191- id: backspaceButton
192- x: (calcGridUnit*13)*7 + calcGridUnit
193- y: 0
194- text: "←"
195- onReleased: {
196- numeralPop();
197- }
198- }
199-
200- KeyboardButton {
201- objectName: "sevenButton"
202- id: sevenButton
203- x: 0
204- y: (calcGridUnit*10)
205- text: Number(7).toLocaleString(Qt.locale(), "f", 0)
206- onReleased: {
207- formulaPush(text);
208- }
209- }
210-
211- KeyboardButton {
212- objectName: "eightButton"
213- id: eightButton
214- x: (calcGridUnit*13)
215- y: (calcGridUnit*10)
216- text: Number(8).toLocaleString(Qt.locale(), "f", 0)
217- onReleased: {
218- formulaPush(text);
219- }
220- }
221-
222- KeyboardButton {
223- objectName: "nineButton"
224- id: nineButton
225- x: (calcGridUnit*13)*2
226- y: (calcGridUnit*10)
227- text: Number(9).toLocaleString(Qt.locale(), "f", 0)
228- onReleased: {
229- formulaPush(text);
230- }
231- }
232-
233- KeyboardButton {
234- objectName: "minusButton"
235- id: minusButton
236- x: (calcGridUnit*13)*3
237- y: (calcGridUnit*10)
238- text: "−"
239- onReleased: {
240- formulaPush('-');
241-
242- }
243- }
244-
245-
246- KeyboardButton {
247- objectName: "eNumberButton"
248- id: eNumberButton
249- x: (calcGridUnit*13)*4 + calcGridUnit
250- y: (calcGridUnit*10)
251- text: "e"
252- onReleased: {
253- formulaPush('E');
254-
255- }
256- }
257-
258- KeyboardButton {
259- objectName: "piNumberButton"
260- id: piNumberButton
261- x: (calcGridUnit*13)*5 + calcGridUnit
262- y: (calcGridUnit*10)
263- text: "π"
264- onReleased: {
265- formulaPush('pi');
266-
267- }
268- }
269-
270- KeyboardButton {
271- objectName: "moduloButton"
272- id: moduloButton
273- x: (calcGridUnit*13)*6 + calcGridUnit
274- y: (calcGridUnit*10)
275- // TRANSLATORS: Refers to Modulo - operation that finds the remainder of division of one number by another.
276- text: i18n.tr("mod")
277- onReleased: {
278- formulaPush('%');
279-
280- }
281- }
282-
283- KeyboardButton {
284- objectName: "factorialNumberButton"
285- id: factorialNumberButton
286- x: (calcGridUnit*13)*7 + calcGridUnit
287- y: (calcGridUnit*10)
288- text: "!"
289- onReleased: {
290- formulaPush('!');
291-
292- }
293- }
294-
295- KeyboardButton {
296- objectName: "fourButton"
297- id: fourButton
298- x: 0
299- y: (calcGridUnit*10)*2
300- text: Number(4).toLocaleString(Qt.locale(), "f", 0)
301- onReleased: {
302- formulaPush(text);
303- }
304- }
305-
306- KeyboardButton {
307- objectName: "fiveButton"
308- id: fiveButton
309- x: (calcGridUnit*13)
310- y: (calcGridUnit*10)*2
311- text: Number(5).toLocaleString(Qt.locale(), "f", 0)
312- onReleased: {
313- formulaPush(text);
314- }
315- }
316-
317- KeyboardButton {
318- objectName: "sixButton"
319- id: sixButton
320- x: (calcGridUnit*13)*2
321- y: (calcGridUnit*10)*2
322- text: Number(6).toLocaleString(Qt.locale(), "f", 0)
323- onReleased: {
324- formulaPush(text);
325- }
326- }
327-
328- KeyboardButton {
329- objectName: "plusButton"
330- id: plusButton
331- x: (calcGridUnit*13)*3
332- y: (calcGridUnit*10)*2
333- text: "+"
334- onReleased: {
335- formulaPush(text);
336-
337- }
338- }
339-
340- KeyboardButton {
341- objectName: "openBracketButton"
342- id: openBracketButton
343- x: (calcGridUnit*13)*4 + calcGridUnit
344- y: (calcGridUnit*10)*2
345- text: "("
346- onReleased: {
347- formulaPush('(');
348-
349- }
350- }
351-
352- KeyboardButton {
353- objectName: "closeBracketButton"
354- id: closeBracketButton
355- x: (calcGridUnit*13)*5 + calcGridUnit
356- y: (calcGridUnit*10)*2
357- text: ")"
358- onReleased: {
359- formulaPush(')');
360-
361- }
362- }
363-
364- KeyboardButton {
365- objectName: "multiplicativeInverseButton"
366- id: multiplicativeInverseButton
367- x: (calcGridUnit*13)*6 + calcGridUnit
368- y: (calcGridUnit*10)*2
369- text: "1/x"
370- onReleased: {
371- if (formulaPush('^') === true) {
372- //make sure that we have integers (to avoid expressions like 2^2.1)
373- hasToAddDot = true
374- formulaPush('-1')
375- }
376- }
377- }
378-
379- KeyboardButton {
380- objectName: "multiplicativeInverseButton2"
381- id: multiplicativeInverseButton2
382- x: (calcGridUnit*13)*7 + calcGridUnit
383- y: (calcGridUnit*10)*2
384- text: "1/x²"
385- onReleased: {
386- if (formulaPush('^') === true) {
387- //make sure that we have integers (to avoid expressions like 2^2.1)
388- hasToAddDot = true
389- formulaPush('-2')
390- }
391- }
392- }
393-
394- KeyboardButton {
395- objectName: "oneButton"
396- id: oneButton
397- x: 0
398- y: (calcGridUnit*10)*3
399- text: Number(1).toLocaleString(Qt.locale(), "f", 0)
400- onReleased: {
401- formulaPush(text);
402- }
403- }
404-
405- KeyboardButton {
406- objectName: "twoButton"
407- id: twoButton
408- x: (calcGridUnit*13)
409- y: (calcGridUnit*10)*3
410- text: Number(2).toLocaleString(Qt.locale(), "f", 0)
411- onReleased: {
412- formulaPush(text);
413- }
414- }
415-
416- KeyboardButton {
417- objectName: "threeButton"
418- id: threeButton
419- x: (calcGridUnit*13)*2
420- y: (calcGridUnit*10)*3
421- text: Number(3).toLocaleString(Qt.locale(), "f", 0)
422- onReleased: {
423- formulaPush(text);
424- }
425- }
426-
427- KeyboardButton {
428- objectName: "equalsButton"
429- id: equalsButton
430- x: (calcGridUnit*13)*3
431- y: (calcGridUnit*10)*3
432- height: (calcGridUnit*19)
433- text: "="
434- onReleased: {
435- calculate();
436-
437- }
438- }
439-
440- KeyboardButton {
441- objectName: "sqrtButton"
442- id: sqrtButton
443- x: (calcGridUnit*13)*4 + calcGridUnit
444- y: (calcGridUnit*10)*3
445- text: "√ "
446- onReleased: {
447- formulaPush('sqrt(')
448- hasToAddDot = true
449- }
450- }
451-
452- KeyboardButton {
453- objectName: "cosinusButton2"
454- id: cosinusButton2
455- x: (calcGridUnit*13)*5 + calcGridUnit
456- y: (calcGridUnit*10)*3
457- text: "cos"
458- onReleased: {
459- formulaPush('cos(')
460- hasToAddDot = true
461- }
462- }
463-
464- KeyboardButton {
465- objectName: "tangensButton2"
466- id: tangensButton2
467- x: (calcGridUnit*13)*6 + calcGridUnit
468- y: (calcGridUnit*10)*3
469- text: "tan"
470- onReleased: {
471- formulaPush('tan(')
472- hasToAddDot = true
473- }
474- }
475-
476- KeyboardButton {
477- objectName: "cotangensButton2"
478- id: cotangensButton2
479- x: (calcGridUnit*13)*7 + calcGridUnit
480- y: (calcGridUnit*10)*3
481- text: "ctg"
482- onReleased: {
483- formulaPush('atan(')
484- hasToAddDot = true
485- }
486- }
487-
488- KeyboardButton {
489- objectName: "zeroButton"
490- id: zeroButton
491- x: 0
492- y: (calcGridUnit*10)*4
493- width: (calcGridUnit*12)*2+calcGridUnit
494- text: Number(0).toLocaleString(Qt.locale(), "f", 0)
495- onReleased: {
496- formulaPush(text);
497- }
498- }
499-
500- KeyboardButton {
501- objectName: "pointButton"
502- id: pointButton
503- x: (calcGridUnit*13)*2
504- y: (calcGridUnit*10)*4
505- text: '.'
506- }
507-
508- KeyboardButton {
509- objectName: "sinusButton"
510- id: sinusButton
511- x: (calcGridUnit*13)*4 + calcGridUnit
512- y: (calcGridUnit*10)*4
513- text: "sin"
514- onReleased: {
515- formulaPush('sin(')
516- }
517- }
518-
519- KeyboardButton {
520- objectName: "cosinusButton"
521- id: cosinusButton
522- x: (calcGridUnit*13)*5 + calcGridUnit
523- y: (calcGridUnit*10)*4
524- text: "cos"
525- onReleased: {
526- formulaPush('cos(')
527- }
528- }
529-
530- KeyboardButton {
531- objectName: "tangensButton"
532- id: tangensButton
533- x: (calcGridUnit*13)*6 + calcGridUnit
534- y: (calcGridUnit*10)*4
535- text: "tan"
536- onReleased: {
537- formulaPush('tan(')
538- }
539- }
540-
541- KeyboardButton {
542- objectName: "cotangensButton"
543- id: cotangensButton
544- x: (calcGridUnit*13)*7 + calcGridUnit
545- y: (calcGridUnit*10)*4
546- text: "ctg"
547- onReleased: {
548- formulaPush('atan(')
549+ Rectangle {
550+ width: virtualKeyboard.width * 2
551+ height: grid.height + units.gu(2)
552+ color: "#ffffff"
553+
554+ Item {
555+ id: grid
556+
557+ // 8 keys and 7 space between and border
558+ width: (calcGridUnit*12)*8 + (calcGridUnit)*7 + calcGridUnit
559+ height: (calcGridUnit*9)*5 + (calcGridUnit)*4
560+
561+ anchors{
562+ horizontalCenter: parent.horizontalCenter
563+ top: parent.top
564+ topMargin: units.gu(1)
565+ }
566+
567+ KeyboardButton {
568+ objectName: "clearButton"
569+ id: clearButton
570+ x: 0
571+ y: 0
572+ // TRANSLATORS: Refers to Clear, keep the translation to 2 characters
573+ text: i18n.tr("←")
574+ // TODO: implement function to remove last char
575+ // onReleased: numeralPop();
576+ }
577+
578+ KeyboardButton {
579+ objectName: "signButton"
580+ id: signButton
581+ x: (calcGridUnit*13)
582+ y: 0
583+ text: "+/-"
584+ // TODO: implement changeSign function
585+ // onReleased: changeSign();
586+ }
587+
588+ KeyboardButton {
589+ objectName: "divideButton"
590+ id: divideButton
591+ x: (calcGridUnit*13)*2
592+ y: 0
593+ text: "÷"
594+ onReleased: formulaPush('/');
595+ }
596+
597+ KeyboardButton {
598+ objectName: "multiplyButton"
599+ id: multiplyButton
600+ x: (calcGridUnit*13)*3
601+ y: 0
602+ text: "×"
603+ onReleased: formulaPush('*');
604+ }
605+
606+ KeyboardButton {
607+ objectName: "powerButton"
608+ id: powerButton
609+ x: (calcGridUnit*13)*4 + calcGridUnit
610+ y: 0
611+ text: "xⁿ"
612+ onReleased: formulaPush('^');
613+ }
614+
615+
616+ KeyboardButton {
617+ objectName: "squareButton"
618+ id: squareButton
619+ x: (calcGridUnit*13)*5 + calcGridUnit
620+ y: 0
621+ text: "x²"
622+ onReleased: {
623+ if (formulaPush('^') === true) {
624+ formulaPush('2')
625+ }
626+ }
627+ }
628+
629+ KeyboardButton {
630+ objectName: "cubeButton"
631+ id: cubeButton
632+ x: (calcGridUnit*13)*6 + calcGridUnit
633+ y: 0
634+ text: "x³"
635+ onReleased: {
636+ if (formulaPush('^') === true) {
637+ formulaPush('3')
638+ }
639+ }
640+ }
641+
642+ KeyboardButton {
643+ objectName: "backspaceButton"
644+ id: backspaceButton
645+ x: (calcGridUnit*13)*7 + calcGridUnit
646+ y: 0
647+ text: "←"
648+ // TODO: implement function to delete last char
649+ // onReleased: numeralPop();
650+ }
651+
652+ KeyboardButton {
653+ objectName: "sevenButton"
654+ id: sevenButton
655+ x: 0
656+ y: (calcGridUnit*10)
657+ text: Number(7).toLocaleString(Qt.locale(), "f", 0)
658+ onReleased: formulaPush(text);
659+ }
660+
661+ KeyboardButton {
662+ objectName: "eightButton"
663+ id: eightButton
664+ x: (calcGridUnit*13)
665+ y: (calcGridUnit*10)
666+ text: Number(8).toLocaleString(Qt.locale(), "f", 0)
667+ onReleased: formulaPush(text);
668+ }
669+
670+ KeyboardButton {
671+ objectName: "nineButton"
672+ id: nineButton
673+ x: (calcGridUnit*13)*2
674+ y: (calcGridUnit*10)
675+ text: Number(9).toLocaleString(Qt.locale(), "f", 0)
676+ onReleased: formulaPush(text);
677+ }
678+
679+ KeyboardButton {
680+ objectName: "minusButton"
681+ id: minusButton
682+ x: (calcGridUnit*13)*3
683+ y: (calcGridUnit*10)
684+ text: "−"
685+ onReleased: formulaPush('-');
686+ }
687+
688+ KeyboardButton {
689+ objectName: "eNumberButton"
690+ id: eNumberButton
691+ x: (calcGridUnit*13)*4 + calcGridUnit
692+ y: (calcGridUnit*10)
693+ text: "e"
694+ onReleased: formulaPush('E');
695+ }
696+
697+ KeyboardButton {
698+ objectName: "piNumberButton"
699+ id: piNumberButton
700+ x: (calcGridUnit*13)*5 + calcGridUnit
701+ y: (calcGridUnit*10)
702+ text: "π"
703+ onReleased: formulaPush('pi');
704+ }
705+
706+ KeyboardButton {
707+ objectName: "moduloButton"
708+ id: moduloButton
709+ x: (calcGridUnit*13)*6 + calcGridUnit
710+ y: (calcGridUnit*10)
711+ // TRANSLATORS: Refers to Modulo - operation that finds the remainder of division of one number by another.
712+ text: i18n.tr("mod")
713+ onReleased: formulaPush('%');
714+ }
715+
716+ KeyboardButton {
717+ objectName: "factorialNumberButton"
718+ id: factorialNumberButton
719+ x: (calcGridUnit*13)*7 + calcGridUnit
720+ y: (calcGridUnit*10)
721+ text: "!"
722+ onReleased: formulaPush('!');
723+ }
724+
725+ KeyboardButton {
726+ objectName: "fourButton"
727+ id: fourButton
728+ x: 0
729+ y: (calcGridUnit*10)*2
730+ text: Number(4).toLocaleString(Qt.locale(), "f", 0)
731+ onReleased: formulaPush(text);
732+ }
733+
734+ KeyboardButton {
735+ objectName: "fiveButton"
736+ id: fiveButton
737+ x: (calcGridUnit*13)
738+ y: (calcGridUnit*10)*2
739+ text: Number(5).toLocaleString(Qt.locale(), "f", 0)
740+ onReleased: formulaPush(text);
741+ }
742+
743+ KeyboardButton {
744+ objectName: "sixButton"
745+ id: sixButton
746+ x: (calcGridUnit*13)*2
747+ y: (calcGridUnit*10)*2
748+ text: Number(6).toLocaleString(Qt.locale(), "f", 0)
749+ onReleased: formulaPush(text);
750+ }
751+
752+ KeyboardButton {
753+ objectName: "plusButton"
754+ id: plusButton
755+ x: (calcGridUnit*13)*3
756+ y: (calcGridUnit*10)*2
757+ text: "+"
758+ onReleased: formulaPush(text);
759+ }
760+
761+ KeyboardButton {
762+ objectName: "openBracketButton"
763+ id: openBracketButton
764+ x: (calcGridUnit*13)*4 + calcGridUnit
765+ y: (calcGridUnit*10)*2
766+ text: "("
767+ onReleased: formulaPush('(');
768+ }
769+
770+ KeyboardButton {
771+ objectName: "closeBracketButton"
772+ id: closeBracketButton
773+ x: (calcGridUnit*13)*5 + calcGridUnit
774+ y: (calcGridUnit*10)*2
775+ text: ")"
776+ onReleased: formulaPush(')');
777+ }
778+
779+ KeyboardButton {
780+ objectName: "multiplicativeInverseButton"
781+ id: multiplicativeInverseButton
782+ x: (calcGridUnit*13)*6 + calcGridUnit
783+ y: (calcGridUnit*10)*2
784+ text: "1/x"
785+ onReleased: {
786+ if (formulaPush('^') === true) {
787+ formulaPush('-1')
788+ }
789+ }
790+ }
791+
792+ KeyboardButton {
793+ objectName: "multiplicativeInverseButton2"
794+ id: multiplicativeInverseButton2
795+ x: (calcGridUnit*13)*7 + calcGridUnit
796+ y: (calcGridUnit*10)*2
797+ text: "1/x²"
798+ onReleased: {
799+ if (formulaPush('^') === true) {
800+ formulaPush('-2')
801+ }
802+ }
803+ }
804+
805+ KeyboardButton {
806+ objectName: "oneButton"
807+ id: oneButton
808+ x: 0
809+ y: (calcGridUnit*10)*3
810+ text: Number(1).toLocaleString(Qt.locale(), "f", 0)
811+ onReleased: formulaPush(text);
812+ }
813+
814+ KeyboardButton {
815+ objectName: "twoButton"
816+ id: twoButton
817+ x: (calcGridUnit*13)
818+ y: (calcGridUnit*10)*3
819+ text: Number(2).toLocaleString(Qt.locale(), "f", 0)
820+ onReleased: formulaPush(text);
821+ }
822+
823+ KeyboardButton {
824+ objectName: "threeButton"
825+ id: threeButton
826+ x: (calcGridUnit*13)*2
827+ y: (calcGridUnit*10)*3
828+ text: Number(3).toLocaleString(Qt.locale(), "f", 0)
829+ onReleased: formulaPush(text);
830+ }
831+
832+ KeyboardButton {
833+ objectName: "equalsButton"
834+ id: equalsButton
835+ x: (calcGridUnit*13)*3
836+ y: (calcGridUnit*10)*3
837+ height: (calcGridUnit*19)
838+ text: "="
839+ onReleased: calculate();
840+ }
841+
842+ KeyboardButton {
843+ objectName: "sqrtButton"
844+ id: sqrtButton
845+ x: (calcGridUnit*13)*4 + calcGridUnit
846+ y: (calcGridUnit*10)*3
847+ text: "√ "
848+ onReleased: formulaPush('sqrt(')
849+ }
850+
851+ KeyboardButton {
852+ objectName: "cosinusButton2"
853+ id: cosinusButton2
854+ x: (calcGridUnit*13)*5 + calcGridUnit
855+ y: (calcGridUnit*10)*3
856+ text: "cos"
857+ onReleased: formulaPush('cos(')
858+ }
859+
860+ KeyboardButton {
861+ objectName: "tangensButton2"
862+ id: tangensButton2
863+ x: (calcGridUnit*13)*6 + calcGridUnit
864+ y: (calcGridUnit*10)*3
865+ text: "tan"
866+ onReleased: formulaPush('tan(')
867+ }
868+
869+ KeyboardButton {
870+ objectName: "cotangensButton2"
871+ id: cotangensButton2
872+ x: (calcGridUnit*13)*7 + calcGridUnit
873+ y: (calcGridUnit*10)*3
874+ text: "ctg"
875+ onReleased: formulaPush('atan(')
876+ }
877+
878+ KeyboardButton {
879+ objectName: "zeroButton"
880+ id: zeroButton
881+ x: 0
882+ y: (calcGridUnit*10)*4
883+ width: (calcGridUnit*12)*2+calcGridUnit
884+ text: Number(0).toLocaleString(Qt.locale(), "f", 0)
885+ onReleased: formulaPush(text);
886+ }
887+
888+ KeyboardButton {
889+ objectName: "pointButton"
890+ id: pointButton
891+ x: (calcGridUnit*13)*2
892+ y: (calcGridUnit*10)*4
893+ text: "."
894+ // TODO: check if there isn't already a dot in the calc
895+ onReleased: formulaPush('.');
896+ }
897+
898+ KeyboardButton {
899+ objectName: "sinusButton"
900+ id: sinusButton
901+ x: (calcGridUnit*13)*4 + calcGridUnit
902+ y: (calcGridUnit*10)*4
903+ text: "sin"
904+ onReleased: formulaPush('sin(')
905+ }
906+
907+ KeyboardButton {
908+ objectName: "cosinusButton"
909+ id: cosinusButton
910+ x: (calcGridUnit*13)*5 + calcGridUnit
911+ y: (calcGridUnit*10)*4
912+ text: "cos"
913+ onReleased: formulaPush('cos(')
914+ }
915+
916+ KeyboardButton {
917+ objectName: "tangensButton"
918+ id: tangensButton
919+ x: (calcGridUnit*13)*6 + calcGridUnit
920+ y: (calcGridUnit*10)*4
921+ text: "tan"
922+ onReleased: formulaPush('tan(')
923+ }
924+
925+ KeyboardButton {
926+ objectName: "cotangensButton"
927+ id: cotangensButton
928+ x: (calcGridUnit*13)*7 + calcGridUnit
929+ y: (calcGridUnit*10)*4
930+ text: "ctg"
931+ onReleased: formulaPush('atan(')
932 }
933 }
934 }

Subscribers

People subscribed via source and target branches