|
@@ -19,204 +19,29 @@ Rectangle {
|
19
|
19
|
width: 450; height: 600
|
20
|
20
|
anchors {right: parent.right; rightMargin: 20; top: parent.top; topMargin: 20}
|
21
|
21
|
}
|
22
|
|
- Item {
|
23
|
|
- anchors {left: parent.left; leftMargin: 10; top: parent.top; topMargin: 10}
|
24
|
|
-
|
25
|
|
- Column {
|
26
|
|
- spacing: 8
|
27
|
|
-
|
28
|
|
- Row {
|
29
|
|
- spacing: 5
|
30
|
|
-
|
31
|
|
- Text {
|
32
|
|
- text: "Mass of ground coffee: "
|
33
|
|
- }
|
34
|
|
- TextInput {
|
35
|
|
- id: groundMass
|
36
|
|
-
|
37
|
|
- width: 30
|
38
|
|
- validator: DoubleValidator {
|
39
|
|
- bottom: 0
|
40
|
|
- decimals: 2
|
41
|
|
- notation: DoubleValidator.StandardNotation
|
42
|
|
- }
|
43
|
|
- KeyNavigation.tab: brewedMass
|
44
|
|
-
|
45
|
|
- Line {
|
46
|
|
- x1: -3; y1: groundMass.height
|
47
|
|
- x2: 33; y2: y1
|
48
|
|
- penWidth: 1
|
49
|
|
- color: "black"
|
50
|
|
- }
|
51
|
|
- }
|
52
|
|
- }
|
53
|
|
- Row {
|
54
|
|
- spacing: 5
|
55
|
|
-
|
56
|
|
- Text {
|
57
|
|
- text: "Mass of brewed coffee:"
|
58
|
|
- }
|
59
|
|
- TextInput {
|
60
|
|
- id: brewedMass
|
61
|
|
-
|
62
|
|
- width: 30
|
63
|
|
- validator: DoubleValidator {
|
64
|
|
- bottom: 0
|
65
|
|
- decimals: 2
|
66
|
|
- notation: DoubleValidator.StandardNotation
|
67
|
|
- }
|
68
|
|
- KeyNavigation.backtab: groundMass
|
69
|
|
- KeyNavigation.tab: ptds
|
70
|
|
-
|
71
|
|
- Line {
|
72
|
|
- x1: -3; y1: brewedMass.height
|
73
|
|
- x2: 33; y2: y1
|
74
|
|
- penWidth: 1
|
75
|
|
- color: "black"
|
76
|
|
- }
|
77
|
|
- }
|
78
|
|
- }
|
79
|
|
- Row {
|
80
|
|
- spacing: 56
|
81
|
|
-
|
82
|
|
- Text {
|
83
|
|
- text: "Percent TDS:"
|
84
|
|
- }
|
85
|
|
- TextInput {
|
86
|
|
- id: ptds
|
87
|
|
-
|
88
|
|
- width: 30
|
89
|
|
- validator: DoubleValidator {
|
90
|
|
- bottom: 0
|
91
|
|
- top: 100
|
92
|
|
- decimals: 2
|
93
|
|
- notation: DoubleValidator.StandardNotation
|
94
|
|
- }
|
95
|
|
- KeyNavigation.backtab: brewedMass
|
96
|
|
-
|
97
|
|
- Line {
|
98
|
|
- x1: -3; y1: ptds.height
|
99
|
|
- x2: 33; y2: y1
|
100
|
|
- penWidth: 1
|
101
|
|
- color: "black"
|
102
|
|
- }
|
103
|
|
- }
|
104
|
|
- }
|
105
|
|
- Row {
|
106
|
|
- spacing: 87
|
107
|
|
-
|
108
|
|
- Text {
|
109
|
|
- id: colorlabel
|
110
|
|
-
|
111
|
|
- text: "Color:"
|
112
|
|
- }
|
113
|
|
- ColorPicker {
|
114
|
|
- id: colorpicker
|
|
22
|
+ ListView {
|
|
23
|
+ spacing: 3
|
|
24
|
+ height: 400
|
|
25
|
+ width: 100
|
|
26
|
+ z: -1
|
|
27
|
+ contentHeight: dataViewModel.count * 35
|
|
28
|
+
|
|
29
|
+ model: ListModel {
|
|
30
|
+ id: dataViewModel
|
|
31
|
+ }
|
|
32
|
+ delegate: Row {
|
|
33
|
+ spacing: 3
|
115
|
34
|
|
116
|
|
- width: 37; height: colorlabel.height
|
117
|
|
- }
|
|
35
|
+ Rectangle {
|
|
36
|
+ width: 30; height: 30
|
|
37
|
+ color: dataViewModel.get(index).color
|
118
|
38
|
}
|
119
|
|
- Row {
|
120
|
|
- id: lsfrow
|
121
|
|
-
|
122
|
|
- visible: false
|
123
|
|
- spacing: 1
|
124
|
|
-
|
|
39
|
+ Column {
|
125
|
40
|
Text {
|
126
|
|
- id: fitcolorlabel
|
127
|
|
-
|
128
|
|
- text: "Least Squares Fit Color:"
|
129
|
|
- }
|
130
|
|
- ColorPicker {
|
131
|
|
- id: fitcolorpicker
|
132
|
|
-
|
133
|
|
- width: 37; height: colorlabel.height
|
134
|
|
-
|
135
|
|
- onColorChanged: {
|
136
|
|
- graph.setFitColor(color)
|
137
|
|
- }
|
|
41
|
+ text: "Strength: " + dataViewModel.get(index).ptds + "% TDS"
|
138
|
42
|
}
|
139
|
|
- }
|
140
|
|
- Rectangle {
|
141
|
|
- id: plotButton
|
142
|
|
-
|
143
|
|
- z: 0
|
144
|
|
- anchors.horizontalCenter: parent.horizontalCenter
|
145
|
|
- height: buttonText.height + 20; width: buttonText.width + 40
|
146
|
|
- border.color: "black"
|
147
|
|
- radius: 10
|
148
|
|
-
|
149
|
43
|
Text {
|
150
|
|
- id: buttonText
|
151
|
|
-
|
152
|
|
- text: "Plot This Brew"
|
153
|
|
- anchors {horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter}
|
154
|
|
- }
|
155
|
|
- MouseArea {
|
156
|
|
- anchors.fill: parent
|
157
|
|
-
|
158
|
|
- onClicked: {
|
159
|
|
- var extraction = (brewedMass.text * (ptds.text / 100)) / groundMass.text
|
160
|
|
- graph.plotPoint(extraction, (ptds.text / 100), colorpicker.color)
|
161
|
|
- dataViewModel.append({"color": colorpicker.color, "ptds": ptds.text, "extraction": extraction})
|
162
|
|
- root.n += 1
|
163
|
|
- root.sumy += (ptds.text / 100)
|
164
|
|
- root.sumx += extraction
|
165
|
|
- root.sumxy += ((ptds.text / 100) * extraction)
|
166
|
|
- root.sumxsq += Math.pow(extraction, 2)
|
167
|
|
- if(root.n > 1) {
|
168
|
|
- var a = ((root.sumy * root.sumxsq)-(root.sumx * root.sumxy))/((root.n * root.sumxsq)-Math.pow(root.sumx, 2))
|
169
|
|
- var b = ((root.n * root.sumxy)-(root.sumx * root.sumy))/((root.n * root.sumxsq) - Math.pow(root.sumx, 2))
|
170
|
|
- var x1 = 0.14
|
171
|
|
- var x2 = 0.26
|
172
|
|
- var y1 = a + (b * x1)
|
173
|
|
- var y2 = a + (b * x2)
|
174
|
|
- if(y1 < 0.008) {
|
175
|
|
- x1 = (0.008 - a) / b
|
176
|
|
- y1 = 0.008
|
177
|
|
- }
|
178
|
|
- if(y2 < 0.008) {
|
179
|
|
- x2 = (0.008 - a) / b
|
180
|
|
- y2 = 0.008
|
181
|
|
- }
|
182
|
|
- if(y1 > 0.016) {
|
183
|
|
- x1 = (0.016 - a) / b
|
184
|
|
- y1 = 0.016
|
185
|
|
- }
|
186
|
|
- if(y2 > 0.016) {
|
187
|
|
- x2 = (0.016 - a) / b
|
188
|
|
- y2 = 0.016
|
189
|
|
- }
|
190
|
|
- graph.setFit(x1, y1, x2, y2);
|
191
|
|
- }
|
192
|
|
- }
|
193
|
|
- }
|
194
|
|
- }
|
195
|
|
- ListView {
|
196
|
|
- spacing: 3
|
197
|
|
- height: 400
|
198
|
|
- width: 100
|
199
|
|
- z: -1
|
200
|
|
- contentHeight: dataViewModel.count * 35
|
201
|
|
-
|
202
|
|
- model: ListModel {
|
203
|
|
- id: dataViewModel
|
204
|
|
- }
|
205
|
|
- delegate: Row {
|
206
|
|
- spacing: 3
|
207
|
|
-
|
208
|
|
- Rectangle {
|
209
|
|
- width: 30; height: 30
|
210
|
|
- color: dataViewModel.get(index).color
|
211
|
|
- }
|
212
|
|
- Column {
|
213
|
|
- Text {
|
214
|
|
- text: "Strength: " + dataViewModel.get(index).ptds + "% TDS"
|
215
|
|
- }
|
216
|
|
- Text {
|
217
|
|
- text: "Extraction: " + Number(dataViewModel.get(index).extraction * 100).toFixed(2) + "%"
|
218
|
|
- }
|
219
|
|
- }
|
|
44
|
+ text: "Extraction: " + Number(dataViewModel.get(index).extraction * 100).toFixed(2) + "%"
|
220
|
45
|
}
|
221
|
46
|
}
|
222
|
47
|
}
|