Debian Codegraph @

app/ui/Screen.qml

raw
1 /*
2 * Copyright (C) 2017-2019 UBports
3 * Copyright 2014-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 as published by
9 * the Free Software Foundation; version 3.
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 import QtQuick 2.4
20 import Lomiri.Components 1.3
21 import QtQuick.Controls.Suru 2.2
22
23 import "../upstreamcomponents"
24 import "../engine/formula.js" as Formula
25
26 ListItem {
27 id: root
28 objectName: "screenroot" + model.index
29
30 color: Suru.backgroundColor
31 Suru.textStyle: Suru.SecondaryText
32 height: units.gu(7)
33 divider.visible: false
34
35 Row {
36 id: calculationRow
37 objectName: "historyrow"
38
39 anchors {
40 fill: parent
41 rightMargin: units.gu(1)
42 leftMargin: units.gu(1)
43 }
44
45 layoutDirection: Qt.RightToLeft
46 spacing: units.gu(1)
47
48 Text {
49 id: result
50 objectName: "result" + model.index
51
52 anchors.verticalCenter: parent.verticalCenter
53
54 color: Suru.foregroundColor
55 text: Formula.returnFormulaToDisplay(model.result, i18n, mainView.decimalPoint)
56 textFormat: Text.PlainText
57 font.pixelSize: units.gu(2.5)
58 lineHeight: units.gu(2)
59 lineHeightMode: Text.FixedHeight
60 verticalAlignment: Text.AlignVCenter
61 }
62
63 Text {
64 id: formula
65 objectName: "formula" + model.index
66
67 anchors.verticalCenter: parent.verticalCenter
68 width: parent.width - result.width
69
70 color: Suru.foregroundColor
71 textFormat: Text.PlainText
72 text: Formula.returnFormulaToDisplay(model.formula, i18n, mainView.decimalPoint) + " ="
73 font.pixelSize: units.gu(2)
74
75 verticalAlignment: Text.AlignVCenter
76 horizontalAlignment: Text.AlignRight
77 }
78 }
79 }