Merge branch 'fontsizechanges'
[marketstoday] / src / qml / StockDetailsComponent.qml
index ede381b..359d9e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-@version: 0.4
+@version: 0.5
 @author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
@@ -15,7 +15,10 @@ Item {
 
     id: stockDetailsScreen
     property int componentWidth: width
-    property int itemHeight: 50
+    property int itemHeight: 75
+    property int newsItemHeight: 50
+    property int fontSizeMed: 24
+    property int fontSizeSmall: 20
     property string symbol: "YHOO"
     property string stockName: ""
     property string lastTradedPrice: ""
@@ -180,13 +183,13 @@ Item {
             id: stockNewsDelegate
 
             Item {
-                id: newsWrapper; width: stockDetailsLoader.width; height: itemHeight
+                id: newsWrapper; width: stockDetailsLoader.width; height: newsItemHeight
                 Item {
                     anchors.fill: parent
                     Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: newsWrapper.height - 2; width: newsWrapper.width; y: 1 }
                     Text {
                         anchors {verticalCenter: parent.verticalCenter;left: parent.left;leftMargin: 10;right: parent.right}
-                        text: title; font.pixelSize: 14
+                        text: title; font.pixelSize: stockDetailsScreen.fontSizeSmall
                         font.bold: false;
                         verticalAlignment: Text.AlignVCenter
                         horizontalAlignment: Text.AlignLeft
@@ -218,10 +221,11 @@ Item {
                     id: stockNameLabel
                     anchors.top: parent.top
                     width: parent.width
+                    z: 5
                     anchors.horizontalCenter: parent.horizontalCenter
-                    height: 30
+                    height: stockDetailsScreen.fontSizeMed + 15
                     horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter
-                    font.pixelSize: 18; font.bold: true; elide: Text.ElideMiddle; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
+                    font.pixelSize: stockDetailsScreen.fontSizeMed; font.bold: true; elide: Text.ElideMiddle; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
                     text: (stockName != "")? (stockName +" ("+symbol+")"):symbol
                 }
 
@@ -232,38 +236,47 @@ Item {
                     border.color: "#BFBFBF"
                     color:"#2E2E2E"
                     anchors {top: stockNameLabel.bottom;left: parent.left;right: parent.right}
-                    height: 125
+                    z: 5
+                    height: (stockDetailsScreen.width > stockDetailsScreen.height)? 105:155
                     radius: 15
 
                     Column{
                         id: stockDetailsColumn
-                        anchors {top: parent.top; left: parent.left; leftMargin: 10}
-                        width: parent.width
+                        anchors {top: parent.top; left: parent.left; leftMargin: 10; right: parent.right; rightMargin: 10}
+                        //spacing: 10
+                        //width: parent.width
 
                         StockDetailsRow{
                             label1: "Last Traded"
                             value1: lastTradedPrice
                             cell1Width: stockDetailsColumn.width/2
+                            multilineLabel1: false
+                            landscape: (stockDetailsScreen.width > stockDetailsScreen.height)
 
                             label2: "Day's Range"
                             value2: daysRange
                             cell2Width: stockDetailsColumn.width/2
+                            multilineLabel2: true
                         }
 
                         StockDetailsRow{
                             label1: "Last Trade Time"
                             value1: lastTradedDateTime
                             cell1Width: stockDetailsColumn.width/2
+                            multilineLabel1: true
+                            landscape: (stockDetailsScreen.width > stockDetailsScreen.height)
 
                             label2: "52w Range"
                             value2: yearRange
                             cell2Width: stockDetailsColumn.width/2
+                            multilineLabel2: true
                         }
 
                         StockDetailsRow{
                             label1: "Change"
                             value1: ((change != "" && changePercentage != "")? change + " ("+changePercentage+")":"")
                             cell1Width: stockDetailsColumn.width/2
+                            landscape: (stockDetailsScreen.width > stockDetailsScreen.height)
 
                             label2: "Volume"
                             value2: marketVolume
@@ -274,6 +287,7 @@ Item {
                             label1: "Prev. Close"
                             value1: prevClose
                             cell1Width: stockDetailsColumn.width/2
+                            landscape: (stockDetailsScreen.width > stockDetailsScreen.height)
 
                             label2: "Market Cap"
                             value2: marketCap
@@ -287,7 +301,7 @@ Item {
                     border.color: "#BFBFBF"
                     color:"#2E2E2E"
                     width: parent.width
-                    anchors {top: stockDetailsSection.bottom;topMargin: 5;
+                    anchors {top: stockDetailsSection.bottom;topMargin: 10;
                              bottom: parent.bottom;
                              left: parent.left;
                              right: parent.right}
@@ -418,7 +432,7 @@ Item {
                         width: 130
                         spacing: 20
                         anchors {top: parent.top; topMargin: 40; bottom: parent.bottom;
-                                 right: chartAreaLand.right;rightMargin: 10}
+                                 right: chartAreaLand.right;rightMargin: 60}
 
                         Row {
                             height: 40
@@ -427,14 +441,14 @@ Item {
                             Library.Button {
                                 text:  "1d"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("1d");
                             }
 
                             Library.Button {
                                 text:  "5d"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("5d");
                             }
                         }
@@ -446,14 +460,14 @@ Item {
                             Library.Button {
                                 text:  "3m"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("3m");
                             }
 
                             Library.Button {
                                 text:  "6m"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("6m");
                             }
                         }
@@ -464,14 +478,14 @@ Item {
                             Library.Button {
                                 text:  "1y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("1y");
                             }
 
                             Library.Button {
                                 text:  "2y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("2y");
                             }
                         }
@@ -482,14 +496,14 @@ Item {
                             Library.Button {
                                 text:  "5y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("5y");
                             }
 
                             Library.Button {
                                 text:  "max"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("my");
                             }
                         }
@@ -558,7 +572,7 @@ Item {
                     Column {
                         width: 280
                         spacing: 20
-                        anchors {verticalCenter: parent.verticalCenter;verticalCenterOffset: 80; horizontalCenter: parent.horizontalCenter}
+                        anchors {verticalCenter: parent.verticalCenter;verticalCenterOffset: 100; horizontalCenter: parent.horizontalCenter}
 
                         Row {
                             height: 40
@@ -567,28 +581,28 @@ Item {
                             Library.Button {
                                 text:  "1d"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("1d");
                             }
 
                             Library.Button {
                                 text:  "5d"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("5d");
                             }
 
                             Library.Button {
                                 text:  "3m"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("3m");
                             }
 
                             Library.Button {
                                 text:  "6m"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("6m");
                             }
                         }
@@ -600,28 +614,28 @@ Item {
                             Library.Button {
                                 text:  "1y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("1y");
                             }
 
                             Library.Button {
                                 text:  "2y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("2y");
                             }
 
                             Library.Button {
                                 text:  "5y"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("5y");
                             }
 
                             Library.Button {
                                 text:  "max"
                                 anchors { verticalCenter: parent.verticalCenter}
-                                width: 50; height: 32
+                                width: 75; height: 40
                                 onClicked: loadChart("my");
                             }
                         }