~popey/stock-ticker-mobile-app/fix-1288885

« back to all changes in this revision

Viewing changes to Stock_Component_Detail.qml

  • Committer: Robert Steckroth
  • Date: 2013-07-02 15:37:23 UTC
  • Revision ID: robertsteckroth@gmail.com-20130702153723-yfps89fsaqkasg9a
Fix to graph date printing. Update to design.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
Rectangle {
20
20
    id: stockComponentRect
21
 
    width: parent.width-units.gu(2)
22
 
    anchors.horizontalCenter: parent.horizontalCenter
23
 
    height: children[0].height// newComponentText.height // I would rather use childrenRect.height
24
 
    // This avoids this error (kudos to anyone who can explain it to me). --> stock-ticker-mobile-app/Current_details_page.qml:35:19: QML Stock_Component_Detail: Binding loop detected for property "height"
 
21
    width: parent.width
25
22
    radius: 6
26
23
    color: current_index === index ? "#e7e4bd" : "#e1e1e1";
27
 
    property int detailRowSize: units.gu(36)
 
24
    height: childrenRect.height
28
25
    Column {
29
 
        width: parent.width - units.gu(1)
30
 
        anchors.verticalCenter: parent.verticalCenter
 
26
        width: parent.width
 
27
        property int borderSize: 20
31
28
        Item {
32
 
            width: parent.width
 
29
            width: childrenRect.width
33
30
            height: childrenRect.height
34
 
            // cmpy_name
 
31
            anchors.horizontalCenter: parent.horizontalCenter
35
32
            Row {
36
 
                anchors.horizontalCenter: parent.horizontalCenter
37
 
                spacing: units.gu(1)
 
33
                spacing: 12
38
34
                Text {
39
35
                    text: i18n.tr(cmpy_name)
40
36
                    font.bold: true
42
38
                    color: "blue"
43
39
                }
44
40
                Text {
45
 
                    anchors.verticalCenter: parent.verticalCenter
46
41
                    text: i18n.tr(tick)
47
42
                    font.bold: false
48
43
                    font.pixelSize: FontUtils.sizeToPixels("meduim")
50
45
                }
51
46
            }
52
47
        }
53
 
        // Close/Open
54
48
        Item {
55
 
            width: detailRowSize
 
49
            width: parent.width -  parent.borderSize
56
50
            height: childrenRect.height
57
51
            anchors.horizontalCenter: parent.horizontalCenter
58
52
            Text {
59
 
                anchors.left: parent.left
60
 
                text: i18n.tr("Close"+(open !== "N/A" ? "/Open:" : ":") )
61
 
                font.bold: true
62
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
63
 
                color: "blue"
 
53
               anchors.left: parent.left
 
54
               text: i18n.tr("Close"+(open !== "N/A" ? "/Open:" : ":") )
 
55
               font.bold: true
 
56
               font.pixelSize: FontUtils.sizeToPixels("medium")
 
57
               color: "blue"
64
58
            }
65
59
            Text {
66
60
                anchors.right: parent.right
70
64
                color: "black"
71
65
            }
72
66
        }
73
 
        // ask/buy:
74
67
        Item {
75
 
            visible: { if ( ask === "N/A" && buy === "N/A" ) false
76
 
                       else true }
77
 
            width: detailRowSize
 
68
            visible: ask !== "N/A" && buy !== "N/A"
 
69
            width: parent.width - parent.borderSize
78
70
            height: childrenRect.height
79
71
            anchors.horizontalCenter: parent.horizontalCenter
80
72
            Text {
92
84
                color: "black"
93
85
            }
94
86
        }
95
 
        // 52 Week low/high:
96
 
        Item {
97
 
            width: detailRowSize
98
 
            height: childrenRect.height
99
 
            anchors.horizontalCenter: parent.horizontalCenter
100
 
            Text {
101
 
                anchors.left: parent.left
102
 
                text: i18n.tr("52 Week low/high:")
103
 
                font.bold: true
104
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
105
 
                color: "blue"
106
 
            }
107
 
            Text {
108
 
                anchors.right: parent.right
109
 
                text: i18n.tr(low_52_week+"/"+high_52_week)
110
 
                font.bold: true
111
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
112
 
                color: "black"
113
 
            }
114
 
        }
115
 
        // Todays low/high:
116
 
        Item {
117
 
            visible: low_day === "N/A" ? false : true
118
 
            width: detailRowSize
119
 
            height: childrenRect.height
120
 
            anchors.horizontalCenter: parent.horizontalCenter
121
 
            Text {
122
 
                anchors.left: parent.left
123
 
                text: i18n.tr("Todays low/high:")
124
 
                font.bold: true
125
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
126
 
                color: "blue"
127
 
            }
128
 
            Text {
129
 
                anchors.right: parent.right
130
 
                text: i18n.tr(low_day+"/"+high_day)
131
 
                font.bold: true
132
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
133
 
                color: "black"
134
 
            }
135
 
        }
136
 
        // Dividend Per Share:
137
 
        Item {
138
 
            visible: dividend === "N/A" ? false : true
139
 
            width: detailRowSize
140
 
            height: childrenRect.height
141
 
            anchors.horizontalCenter: parent.horizontalCenter
142
 
            Text {
143
 
                anchors.left: parent.left
144
 
                text: i18n.tr("Dividend Per Share:")
145
 
                font.bold: true
146
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
147
 
                color: "blue"
148
 
            }
149
 
            Text {
150
 
                anchors.right: parent.right
151
 
                text: i18n.tr(dividend)
152
 
                font.bold: true
153
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
154
 
                color: "black"
155
 
            }
156
 
        }
157
 
        // Volume:
158
 
        Item {
159
 
            visible: volume === "N/A" ? false : true
160
 
            width: detailRowSize
161
 
            height: childrenRect.height
162
 
            anchors.horizontalCenter: parent.horizontalCenter
163
 
            Text {
164
 
                anchors.left: parent.left
165
 
                text: i18n.tr("Volume:")
166
 
                font.bold: true
167
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
168
 
                color: "blue"
169
 
            }
170
 
            Text {
171
 
                anchors.right: parent.right
172
 
                text: i18n.tr(addCommas(volume))
173
 
                font.bold: true
174
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
175
 
                color: "black"
176
 
            }
177
 
        }
178
 
        // After hours:
179
 
        Item {
180
 
            visible: after_hours === "N/A - N/A" ? false : true
181
 
            width: detailRowSize
182
 
            height: childrenRect.height
183
 
            anchors.horizontalCenter: parent.horizontalCenter
184
 
            Text {
185
 
                anchors.left: parent.left
186
 
                text: i18n.tr("After hours:")
187
 
                font.bold: true
188
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
189
 
                color: "blue"
190
 
            }
191
 
            Text {
192
 
                anchors.right: parent.right
193
 
                text: i18n.tr(after_hours)
194
 
                font.bold: true
195
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
196
 
                color: "black"
197
 
            }
198
 
        }
199
 
        // P/E Ration:
200
 
        Item {
201
 
            visible: pe_ratio === "N/A" ? false : true
202
 
            width: detailRowSize
203
 
            height: childrenRect.height
204
 
            anchors.horizontalCenter: parent.horizontalCenter
205
 
            Text {
206
 
                anchors.left: parent.left
207
 
                text: i18n.tr("P/E Ratio:")
208
 
                font.bold: true
209
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
210
 
                color: "blue"
211
 
            }
212
 
            Text {
213
 
                anchors.right: parent.right
214
 
                text: i18n.tr(pe_ratio)
215
 
                font.bold: true
216
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
217
 
                color: "black"
218
 
            }
219
 
        }
220
 
        // EPS:
221
 
        Item {
222
 
            visible: eps === "N/A - N/A" ? false : true
223
 
            width: detailRowSize
224
 
            height: childrenRect.height
225
 
            anchors.horizontalCenter: parent.horizontalCenter
226
 
            Text {
227
 
                anchors.left: parent.left
228
 
                text: i18n.tr("EPS (current year):")
229
 
                font.bold: true
230
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
231
 
                color: "blue"
232
 
            }
233
 
            Text {
234
 
                anchors.right: parent.right
235
 
                text: i18n.tr(eps)
236
 
                font.bold: true
237
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
238
 
                color: "black"
239
 
            }
240
 
        }
241
 
        // After hours:
242
 
        Item {
243
 
            visible: market_cap === "N/A - N/A" ? false : true
244
 
            width: detailRowSize
245
 
            height: childrenRect.height
246
 
            anchors.horizontalCenter: parent.horizontalCenter
247
 
            Text {
248
 
                anchors.left: parent.left
249
 
                text: i18n.tr("Market Cap")
250
 
                font.bold: true
251
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
252
 
                color: "blue"
253
 
            }
254
 
            Text {
255
 
                anchors.right: parent.right
256
 
                text: i18n.tr(market_cap)
257
 
                font.bold: true
258
 
                font.pixelSize: FontUtils.sizeToPixels("medium")
259
 
                color: "black"
260
 
            }
261
 
        }
 
87
        Item {
 
88
             width: parent.width - parent.borderSize
 
89
             height: childrenRect.height
 
90
             anchors.horizontalCenter: parent.horizontalCenter
 
91
             Text {
 
92
                 anchors.left: parent.left
 
93
                 text: i18n.tr("52 Week low/high:")
 
94
                 font.bold: true
 
95
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
96
                 color: "blue"
 
97
             }
 
98
             Text {
 
99
                 anchors.right: parent.right
 
100
                 text: i18n.tr(low_52_week+"/"+high_52_week)
 
101
                 font.bold: true
 
102
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
103
                 color: "black"
 
104
             }
 
105
         }
 
106
         Item {
 
107
             visible: low_day !== "N/A"
 
108
             width: parent.width - parent.borderSize
 
109
             height: childrenRect.height
 
110
             anchors.horizontalCenter: parent.horizontalCenter
 
111
             Text {
 
112
                 anchors.left: parent.left
 
113
                 text: i18n.tr("Todays low/high:")
 
114
                 font.bold: true
 
115
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
116
                 color: "blue"
 
117
             }
 
118
             Text {
 
119
                 anchors.right: parent.right
 
120
                 text: i18n.tr(low_day+"/"+high_day)
 
121
                 font.bold: true
 
122
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
123
                 color: "black"
 
124
             }
 
125
         }
 
126
         Item {
 
127
             visible: dividend !== "N/A"
 
128
             width: parent.width - parent.borderSize
 
129
             height: childrenRect.height
 
130
             anchors.horizontalCenter: parent.horizontalCenter
 
131
             Text {
 
132
                 anchors.left: parent.left
 
133
                 text: i18n.tr("Dividend Per Share:")
 
134
                 font.bold: true
 
135
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
136
                 color: "blue"
 
137
             }
 
138
             Text {
 
139
                 anchors.right: parent.right
 
140
                 text: i18n.tr(dividend)
 
141
                 font.bold: true
 
142
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
143
                 color: "black"
 
144
             }
 
145
         }
 
146
         Item {
 
147
             visible: volume !== "N/A"
 
148
             width: parent.width - parent.borderSize
 
149
             height: childrenRect.height
 
150
             anchors.horizontalCenter: parent.horizontalCenter
 
151
             Text {
 
152
                 anchors.left: parent.left
 
153
                 text: i18n.tr("Volume:")
 
154
                 font.bold: true
 
155
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
156
                 color: "blue"
 
157
             }
 
158
             Text {
 
159
                 anchors.right: parent.right
 
160
                 text: i18n.tr(addCommas(volume))
 
161
                 font.bold: true
 
162
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
163
                 color: "black"
 
164
             }
 
165
         }
 
166
         Item {
 
167
              visible: after_hours !== "N/A"
 
168
              width: parent.width - parent.borderSize
 
169
              height: childrenRect.height
 
170
              anchors.horizontalCenter: parent.horizontalCenter
 
171
              Text {
 
172
                  anchors.left: parent.left
 
173
                  text: i18n.tr("After hours:")
 
174
                  font.bold: true
 
175
                  font.pixelSize: FontUtils.sizeToPixels("medium")
 
176
                  color: "blue"
 
177
              }
 
178
              Text {
 
179
                  anchors.right: parent.right
 
180
                  text: i18n.tr(after_hours)
 
181
                  font.bold: true
 
182
                  font.pixelSize: FontUtils.sizeToPixels("medium")
 
183
                  color: "black"
 
184
              }
 
185
          }
 
186
         // P/E Ration:
 
187
         Item {
 
188
             visible: pe_ratio !== "N/A"
 
189
             width: parent.width - parent.borderSize
 
190
             height: childrenRect.height
 
191
             anchors.horizontalCenter: parent.horizontalCenter
 
192
             Text {
 
193
                 anchors.left: parent.left
 
194
                 text: i18n.tr("P/E Ratio:")
 
195
                 font.bold: true
 
196
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
197
                 color: "blue"
 
198
             }
 
199
             Text {
 
200
                 anchors.right: parent.right
 
201
                 text: i18n.tr(pe_ratio)
 
202
                 font.bold: true
 
203
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
204
                 color: "black"
 
205
             }
 
206
         }
 
207
         Item {
 
208
             visible: eps !== "N/A - N/A"
 
209
             width: parent.width - parent.borderSize
 
210
             height: childrenRect.height
 
211
             anchors.horizontalCenter: parent.horizontalCenter
 
212
             Text {
 
213
                 anchors.left: parent.left
 
214
                 text: i18n.tr("EPS (current year):")
 
215
                 font.bold: true
 
216
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
217
                 color: "blue"
 
218
             }
 
219
             Text {
 
220
                 anchors.right: parent.right
 
221
                 text: i18n.tr(eps)
 
222
                 font.bold: true
 
223
                 font.pixelSize: FontUtils.sizeToPixels("medium")
 
224
                 color: "black"
 
225
             }
 
226
         }
 
227
         Item {
 
228
              visible: market_cap !== "N/A - N/A"
 
229
              width: parent.width - parent.borderSize
 
230
              height: childrenRect.height
 
231
              anchors.horizontalCenter: parent.horizontalCenter
 
232
              Text {
 
233
                  anchors.left: parent.left
 
234
                  text: i18n.tr("Market Cap")
 
235
                  font.bold: true
 
236
                  font.pixelSize: FontUtils.sizeToPixels("medium")
 
237
                  color: "blue"
 
238
              }
 
239
              Text {
 
240
                  anchors.right: parent.right
 
241
                  text: i18n.tr(market_cap)
 
242
                  font.bold: true
 
243
                  font.pixelSize: FontUtils.sizeToPixels("medium")
 
244
                  color: "black"
 
245
              }
 
246
          }
 
247
 
262
248
    }
 
249
 
 
250
 
 
251
 
263
252
}