3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
14 id: stockDetailsComponent
15 property int itemHeight: 50
16 property string symbol: "YHOO"
17 property string stockName: "Yahoo"
18 property string lastTradedPrice: ""
19 property string lastTradedTime: ""
20 property string change: ""
21 property string changePercentage: ""
22 property string dayLow: ""
23 property string dayHigh: ""
24 property string fiftyTwoWeekLow: ""
25 property string fiftyTwoWeekHigh: ""
26 property string marketVolume: ""
27 property string prevClose: ""
28 property string marketCap: ""
29 property string chartURL: ""
31 signal logRequest(string strMessage)
37 Component.onCompleted: {
40 chartURL = "http://chart.finance.yahoo.com/z?t=1d&q=&l=&z=m&p=s&a=v&p=s&lang=en-US®ion=US&s="+symbol;
41 stockDetailsLoader.sourceComponent = stockChartComponent;
42 console.log(stockDetailsLoader.width + " x "+ stockDetailsLoader.height);
46 function loadDetails(){
47 if (symbol === "") return;
53 anchors.top: parent.top
55 anchors.horizontalCenter: parent.horizontalCenter
57 horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
58 font.pixelSize: 18; font.bold: true; elide: Text.ElideMiddle; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
59 text: (stockName != "")? (stockName +" ("+symbol+")"):symbol
63 id: stockDetailsSection
65 border.color: "#BFBFBF"
67 anchors {top: stockNameLabel.bottom;left: parent.left;leftMargin: 40;right: parent.right;rightMargin: 40}
72 id: stockDetailsColumn
73 anchors {top: parent.top; left: parent.left; leftMargin: 10}
74 width: (parent.width - 10)
78 value1: lastTradedPrice
79 cell1Width: stockDetailsColumn.width/2
82 value2: ((dayHigh != "" && dayLow != "")? (dayLow + " - " + dayHigh) : "")
83 cell2Width: stockDetailsColumn.width/2
87 label1: "Last Trade Time"
88 value1: lastTradedTime
89 cell1Width: stockDetailsColumn.width/2
92 value2: ((fiftyTwoWeekHigh != "" && fiftyTwoWeekLow != "")? (fiftyTwoWeekLow + " - " + fiftyTwoWeekHigh) : "")
93 cell2Width: stockDetailsColumn.width/2
98 value1: ((change != "" && changePercentage != "")? change + " ("+changePercentage+")":"")
99 cell1Width: stockDetailsColumn.width/2
103 cell2Width: stockDetailsColumn.width/2
107 label1: "Prev. Close"
109 cell1Width: stockDetailsColumn.width/2
113 cell2Width: stockDetailsColumn.width/2
119 id: stockDetailsLoader
120 anchors {top: stockDetailsSection.bottom;bottom: parent.bottom; horizontalCenter: parent.horizontalCenter}
121 //width: parent.width
126 id: stockChartComponent
130 border.color: "#BFBFBF"
132 anchors {top: parent.top;topMargin: 5;bottom: parent.bottom; left: parent.left;leftMargin: 40;right: parent.right;rightMargin: 40}
138 fillMode: Image.PreserveAspectFit