X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fqml%2FMarketsTodayLegacyApp.qml;h=fad35c532d8770502f92edad788d160ad2ada261;hb=0f8d4b44f550d528c2b6b09fb0f6a8c7821caf9f;hp=9c78ac8c6630a7ee7f7b31e466eb8952509c2af1;hpb=02a83307f38137e27fbbc7cf0c146f62bbcff37e;p=marketstoday diff --git a/src/qml/MarketsTodayLegacyApp.qml b/src/qml/MarketsTodayLegacyApp.qml index 9c78ac8..fad35c5 100644 --- a/src/qml/MarketsTodayLegacyApp.qml +++ b/src/qml/MarketsTodayLegacyApp.qml @@ -1,5 +1,5 @@ /* -@version: 0.2 +@version: 0.5 @author: Sudheer K. @license: GNU General Public License */ @@ -9,6 +9,7 @@ import Qt 4.7 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 @@ -18,8 +19,8 @@ Item { signal showConfigInNewWindow signal showStockDetails(string strSymbol) signal quoteRefreshStarted - signal quoteRefreshCompleted - signal quoteRefreshFailed(string strMessage) + signal quoteRefreshCompleted(bool success, string strMessage) + signal newsReloadCompleted(bool success, string strMessage) signal checkNetworkStatus property int itemHeight: 50 @@ -29,9 +30,9 @@ Item { 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() @@ -50,8 +51,8 @@ Item { } else{ DBUtility.initialize(); - CoreLib.initialize(); uiLoader.sourceComponent = stockQuotesUIComponent; + CoreLib.initialize(); } } @@ -102,34 +103,17 @@ Item { id: wrapper; width: mainPage.componentWidth; height: mainPage.itemHeight Item { Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: wrapper.height - 2; width: wrapper.width; y: 1 - Image{ - id: informationIcon - width: 32 - height: 32 - z: 10 - anchors {right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter} - visible: false - source: "Library/images/information.png" - MouseArea{ - anchors.fill: parent; - onPressed: { - //console.log("Image clicked"); - mainPage.selectedSymbol = symbol; - uiLoader.sourceComponent = stockDetailsComponent; - titleBar.buttonType = "Back"; - titleBar.displayMenu = false; - toolBar.displayIcons = false; - } - } - } - MouseArea { anchors.fill: parent - onPressed:{ - informationIcon.visible = true; - //console.log("Rectangle clicked"); + onDoubleClicked: { + mainPage.selectedSymbol = symbol; + uiLoader.sourceComponent = stockDetailsComponent; + titleBar.buttonType = "Back"; + titleBar.displayMenu = false; + toolBar.displayIcons = false; } } + } Row { @@ -140,7 +124,7 @@ Item { 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";} + color: change >= 0 ? "#00ff00":"#ff0000"; 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" } @@ -173,7 +157,7 @@ Item { } MouseArea{ anchors.fill: parent - onClicked: Qt.openUrlExternally(link); + onDoubleClicked: Qt.openUrlExternally(link); } } } @@ -260,7 +244,7 @@ Item { id: listViewWrapper width: parent.width anchors.top: parent.top - anchors.bottom: footerText.top + anchors.bottom: footerTextArea.top color: "#343434" ListView { @@ -274,25 +258,75 @@ Item { } } + Rectangle { + id: stockStatusMsgArea + height: 100 + color: "#343434" + anchors {left: parent.left; leftMargin: 15; right: parent.right; rightMargin: 15; + verticalCenter: parent.verticalCenter} + visible: false + + Text { + id: stockStatusText + anchors.fill: parent + text: "Loading quotes.." + horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter + width: parent.width; font.pixelSize: 16; elide: Text.ElideNone; + color: "#cccccc" + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + style: Text.Raised; styleColor: "black" + + Connections { + target: mainPage + onQuoteRefreshCompleted: { + if (success){ + stockStatusMsgArea.visible = false; + listViewWrapper.visible = true; + } + else{ + stockStatusText.text = strMessage; + listViewWrapper.visible = false; + stockStatusMsgArea.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: mainPage.lastUpdatedTimeStamp horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter width: parent.width; font.pixelSize: 12; elide: Text.ElideRight; color: "#cccccc" - style: Text.Raised; styleColor: "black" + style: Text.Raised; styleColor: "black" + } - Connections { - target: mainPage - onQuoteRefreshCompleted:{ - timeStamp.text = mainPage.lastUpdatedTimeStamp; + Timer { + id: footerMessageTimer + interval: 10000 + repeat: false + onTriggered: { + footerMessage.text = mainPage.lastUpdatedTimeStamp; + } + } + + Connections { + target: mainPage + onQuoteRefreshCompleted:{ + if (success){ + footerMessage.text = "Double-tap on a row to display more details."; + footerMessageTimer.start(); + } + else{ + footerMessage.text = mainPage.lastUpdatedTimeStamp; } } } @@ -312,6 +346,7 @@ Item { id: newsComponent Item { Rectangle{ + id: newsViewArea width: parent.width anchors.top: parent.top anchors.bottom: parent.bottom @@ -327,6 +362,41 @@ Item { snapMode: ListView.SnapToItem } } + + Rectangle { + id: newsStatusMsgArea + height: 100 + color: "#343434" + anchors {left: parent.left; leftMargin: 15; right: parent.right; rightMargin: 15; + verticalCenter: parent.verticalCenter} + visible: false + + Text { + id: newsStatusText + anchors.fill: parent + text: "Loading news.." + horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter + width: parent.width; font.pixelSize: 16; elide: Text.ElideNone; + color: "#cccccc" + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + style: Text.Raised; styleColor: "black" + + Connections { + target: mainPage + onNewsReloadCompleted: { + if (success){ + newsStatusMsgArea.visible = false; + newsViewArea.visible = true; + } + else{ + newsStatusText.text = strMessage; + newsViewArea.visible = false; + newsStatusMsgArea.visible = true; + } + } + } + } + } } }