/*
-@version: 0.2
+@version: 0.4
@author: Sudheer K. <scifi1947 at gmail.com>
@license: GNU General Public License
*/
import "Library" as Library
import "Library/js/ISODate.js" as DateLib
import "Library/js/DBUtility.js" as DBUtility
+import "Library/js/CSVUtility.js" as CSVUtility
import "Library/js/Common.js" as Common
import "Library/js/CoreLogic.js" as CoreLib
property int autoUpdateInterval: 300000
property bool updateWeekDaysOnly: false
property bool updateOnSavedNetworksOnly: false
+ property bool isDesktopWidget: false
property string rssURL: "http://finance.yahoo.com/rss/topfinstories"
property string lastUpdatedTimeStamp
- property bool isDesktopWidget
//property string selectedSymbol:"YHOO"
property string selectedSymbol:sharedContext.getStockSymbol()
Page {
id: mainPage
- property int itemHeight: 50
+ property int itemHeight: 75
property int titleBarHeight: 60
property int toolBarHeight: 40
+ property int fontSizeMed: 24
+ property int fontSizeSmall: 20
+ property int colSpacing: 4
property int componentWidth: mainPage.width
function reloadData(){
}
Row {
- x: 30;y: 15;
+ x: 30;y: (wrapper.height - mainPage.fontSizeMed)/2;
width: mainPage.componentWidth - 60;
spacing: 5
- Text { text: stockName; width: parent.width * 30/100; font.pixelSize: 18; font.bold: true; elide: Text.ElideRight; color: "white"; style: Text.Raised; styleColor: "black" }
- Text { text: lastTradedPrice; width: parent.width * 15/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
- Text { text: change !== ""? (change + " ("+changePercentage+")"):""; width: parent.width * 25/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight
- color: if(change >= 0){"green";} else {"red";}
- style: Text.Raised; styleColor: "black" }
- Text { text: volume; width: parent.width * 15/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
- Text { text: marketCap; width: parent.width * 15/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: stockName; width: parent.width * 30/100; font.pixelSize: mainPage.fontSizeMed; font.bold: true; elide: Text.ElideRight; color: "white"; style: Text.Raised; styleColor: "black" }
+ Text { text: lastTradedPrice; width: parent.width * 15/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: change !== ""? (change + " ("+changePercentage+")"):""; width: parent.width * 25/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight
+ color: change >= 0 ? "#00ff00":"#ff0000"; style: Text.Raised; styleColor: "black"}
+ Text { text: volume; width: parent.width * 18/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: marketCap; width: parent.width * 12/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
}
}
}
}
Row {
- x: 10;y: 15;
+ x: 10;y: (wrapperItem.height - mainPage.fontSizeMed)/2;
width: mainPage.componentWidth - 5;
spacing: 3
- Text { text: stockName; width: parent.width * 42/100; font.pixelSize: 18; font.bold: true; elide: Text.ElideRight; color: "white"; style: Text.Raised; styleColor: "black" }
- Text { text: lastTradedPrice; width: parent.width * 20/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: stockName; width: parent.width * 42/100; font.pixelSize: mainPage.fontSizeMed; font.bold: true; elide: Text.ElideRight; color: "white"; style: Text.Raised; styleColor: "black"}
+ Text { text: lastTradedPrice; width: parent.width * 20/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black"}
Column {
- y: -15;
+ y: (wrapperItem.height - mainPage.colSpacing - mainPage.fontSizeSmall*2)/2 - (wrapperItem.height - mainPage.fontSizeMed)/2;
width: parent.width * 18/100; height: parent.height
- spacing: 2
- Text { text: change; font.pixelSize: 16; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight
- color: if(change >= 0){"green";} else {"red";}
+ spacing: mainPage.colSpacing
+ Text { text: change; font.pixelSize: mainPage.fontSizeSmall; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight
+ color: change >= 0 ? "#00ff00":"#ff0000";
style: Text.Raised; styleColor: "black" }
- Text { text: changePercentage; font.pixelSize: 16; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight;
- color: if(change >= 0){"green";} else {"red";}
+ Text { text: changePercentage; font.pixelSize: mainPage.fontSizeSmall; horizontalAlignment: Text.AlignLeft; elide: Text.ElideRight;
+ color: change >= 0 ? "#00ff00":"#ff0000";
style: Text.Raised; styleColor: "black" }
}
- Text { text: volume; width: parent.width * 20/100; font.pixelSize: 18; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: volume !== ''? Common.abbreviateNumber(volume,2) :''; width: parent.width * 20/100; font.pixelSize: mainPage.fontSizeMed; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black"}
}
}
}
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
- text: title; font.pixelSize: 18
+ text: title; font.pixelSize: mainPage.fontSizeSmall
font.bold: false;
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
}
MouseArea{
anchors.fill: parent
- onClicked: Qt.openUrlExternally(link);
+ onDoubleClicked: Qt.openUrlExternally(link);
}
}
}
id: listViewWrapper
width: parent.width
anchors.top: parent.top
- anchors.bottom: footerText.top
+ anchors.bottom: footerTextArea.top
color: "#343434"
ListView {
onQuoteRefreshCompleted: {
if (success){
stockStatusMsgArea.visible = false;
+ listViewWrapper.visible = true;
}
else{
stockStatusText.text = strMessage;
stockStatusMsgArea.visible = true;
+ listViewWrapper.visible = true;
}
}
}
}
Rectangle{
- id: footerText
+ id: footerTextArea
width: parent.width
height: 25
color: "#343434"
anchors.bottom: parent.bottom
Text {
- id: timeStamp
+ id: footerMessage
anchors.fill: parent
text: lastUpdatedTimeStamp
horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
width: parent.width; font.pixelSize: 12; elide: Text.ElideRight;
color: "#cccccc"
style: Text.Raised; styleColor: "black"
+ }
- Connections {
- target: appWindow
- onQuoteRefreshCompleted:{
- timeStamp.text = lastUpdatedTimeStamp;
+ Timer {
+ id: footerMessageTimer
+ interval: 10000
+ repeat: false
+ onTriggered: {
+ footerMessage.text = appWindow.lastUpdatedTimeStamp;
+ }
+ }
+
+ Connections {
+ target: appWindow
+ onQuoteRefreshCompleted:{
+ if (success){
+ footerMessage.text = "Double-tap on a row to display more details.";
+ footerMessageTimer.start();
+ }
+ else{
+ footerMessage.text = appWindow.lastUpdatedTimeStamp;
}
}
}