forked from IgorYbema/tscSettings
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathChangeTariffScreen.qml
More file actions
111 lines (93 loc) · 2.84 KB
/
Copy pathChangeTariffScreen.qml
File metadata and controls
111 lines (93 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import QtQuick 2.1
import qb.components 1.0
import qb.base 1.0
import BxtClient 1.0
Screen {
id: tscChangeTariffScreen
isSaveCancelDialog: true
screenTitle: "Change electra and gas tariff"
property bool firstShown: true; // we need this because exiting a keyboard will load onShown again. Without this the input will be overwritten with the app settings again
onSaved: {
app.setTariff(tariffElec.inputText, tariffElecLow.inputText, tariffElecDualToggle.isSwitchedOn, tariffGas.inputText);
}
onShown: {
if (firstShown) {
tariffElec.inputText = app.billingInfos["elec"].price
tariffElecLow.inputText = app.billingInfos["elec"].lowPrice
tariffElecDualToggle.isSwitchedOn = app.billingInfos["elec"].rate === 1
tariffGas.inputText = app.billingInfos["gas"].price
firstShown = false;
}
}
Text {
id: bodyText
width: Math.round(650 * app.nxtScale)
wrapMode: Text.WordWrap
text: "Set custom tariffs for your energy provider. See your contract for details."
color: "#000000"
font.pixelSize: qfont.bodyText
font.family: qfont.regular.name
anchors {
top: parent.top
topMargin: isNxt ? Math.round(10 * 1.28) : 10
horizontalCenter: parent.horizontalCenter
}
}
EditTextLabel {
id: tariffElec
width: isNxt ? 300 : 250
leftText: "Elec normal:"
inputHints: Qt.ImhDigitsOnly
anchors {
top: bodyText.bottom
topMargin : 10
left: parent.left
leftMargin: isNxt ? 60 : 50
}
}
Text {
id: tariffElecDualToggleText
anchors {
left: tariffElec.right
leftMargin: 20
top: tariffElec.top
topMargin: 10
}
font.pixelSize: 16
font.family: qfont.semiBold.name
text: "Dual tariff"
}
OnOffToggle {
id: tariffElecDualToggle
height: 40
anchors.left: tariffElecDualToggleText.right
anchors.leftMargin: 10
anchors.top: tariffElecDualToggleText.top
leftIsSwitchedOn: false
}
EditTextLabel {
id: tariffElecLow
width: isNxt ? 300 : 250
leftText: "Elec low:"
inputHints: Qt.ImhDigitsOnly
visible: tariffElecDualToggle.isSwitchedOn
anchors {
top: bodyText.bottom
topMargin : 10
left: tariffElecDualToggle.right
leftMargin: 20
}
}
EditTextLabel {
id: tariffGas
width: isNxt ? 300 : 250
leftText: "Gas:"
inputHints: Qt.ImhDigitsOnly
anchors {
top: tariffElec.bottom
topMargin : 10
left: parent.left
leftMargin: isNxt ? 60 : 50
}
}
}