From 0fb9807613291cec289e542d1aa2cbddbd22c5ab Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 Sep 2009 16:49:21 +1000 Subject: Close dialogs if they press new game Also only has one dialog shown when you win. --- demos/declarative/samegame/content/samegame.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index 9914edb..0a3a4db 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -34,6 +34,10 @@ function initBoard() maxY = Math.floor(gameCanvas.height/tileSize); maxIndex = maxY*maxX; + //Close dialogs + scoreName.forceClose(); + dialog.forceClose(); + //Initialize Board board = new Array(maxIndex); gameCanvas.score = 0; @@ -144,10 +148,11 @@ function victoryCheck() gameCanvas.score += 500; //Checks for game over if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ - dialog.show("Game Over. Your score is " + gameCanvas.score); timer = new Date() - timer; if(scoresURL != "") - scoreName.show("Please enter your name: "); + scoreName.show("You've won! Please enter your name: "); + else + dialog.show("Game Over. Your score is " + gameCanvas.score); } } -- cgit v0.12 From 00857aeee742c3c05d5286854de98820d2f5042e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 Sep 2009 16:49:50 +1000 Subject: Differentiate between loading and error states. --- demos/declarative/twitter/twitter.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 566832b..78fa47e 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -31,7 +31,13 @@ Item { Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 } Twitter.RssModel { id: RssModel } - Common.Loading { anchors.centerIn: parent; visible: RssModel.status && state!='unauthed'} + Common.Loading { anchors.centerIn: parent; visible: RssModel.status==XmlListModel.Loading && state!='unauthed'} + Text { + width: 180 + text: "Could not access twitter using this screen name and password pair."; + color: "white"; color: "#cccccc"; style: "Raised"; styleColor: "black"; wrap: true + visible: RssModel.status==XmlListModel.Error; anchors.centerIn: parent + } Item { id: Views -- cgit v0.12 From 4caad879cd9a71b26690728e338ad090fa6591d6 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 Sep 2009 16:53:14 +1000 Subject: Better default behaviour for twitter demo. --- demos/declarative/twitter/twitter.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 78fa47e..e467f82 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -72,6 +72,7 @@ Item { if(Screen.userView == true){ Screen.setMode(false); }else{ + RssModel.tags=''; Screen.setMode(true); } } -- cgit v0.12 From 2ed054843498b703becf099e885aadc925d85195 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 3 Sep 2009 17:55:24 +1000 Subject: Fix some twitter demo bugs Includes making the update button work and clearing the post box on post --- demos/declarative/twitter/content/AuthView.qml | 2 +- demos/declarative/twitter/content/HomeTitleBar.qml | 17 +++++++++-------- demos/declarative/twitter/twitter.qml | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml index 6bd98b9..9ca4d88 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/content/AuthView.qml @@ -85,7 +85,7 @@ Item { height: 32 id: guest text: "Guest" - onClicked: RssModel.authName='inv' + onClicked: {RssModel.authName='-'; Screen.setMode(true);} } } } diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml index 878a83e..5cb8bea 100644 --- a/demos/declarative/twitter/content/HomeTitleBar.qml +++ b/demos/declarative/twitter/content/HomeTitleBar.qml @@ -3,7 +3,7 @@ import "../../flickr/mobile" import "../../flickr/common" Item { - id: TitleBar + id: titleBar signal update() onYChanged: state="" //When switching titlebars @@ -23,12 +23,13 @@ Item { postman.open("POST", "http://twitter.com/statuses/update.xml", true, RssModel.authName, RssModel.authPass); postman.onreadystatechange = function() { if (postman.readyState == postman.DONE) { - TitleBar.update(); + titleBar.update(); } } postman.send(postData); - TitleBar.state = "" + Editor.text = "" + titleBar.state = "" } } @@ -57,15 +58,15 @@ Item { } Button { - id: TagButton; x: TitleBar.width - 90; width: 85; height: 32; text: "New Post..." + id: TagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." anchors.verticalCenter: parent.verticalCenter; - onClicked: if (TitleBar.state == "Posting") accept(); else TitleBar.state = "Posting" + onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting" } Text { id: charsLeftText; anchors.horizontalCenter: TagButton.horizontalCenter; anchors.top: TagButton.bottom; anchors.topMargin: 2 - text: {140 - Editor.text.length;} visible: TitleBar.state == "Posting" + text: {140 - Editor.text.length;} visible: titleBar.state == "Posting" font.pointSize: 10; font.bold: true; color: "white"; style: "Raised"; styleColor: "black" } Item { @@ -101,7 +102,7 @@ Item { Item { id: ReturnKey Keys.onReturnPressed: accept() - Keys.onEscapePressed: TitleBar.state = "" + Keys.onEscapePressed: titleBar.state = "" } } } @@ -109,7 +110,7 @@ Item { State { name: "Posting" PropertyChanges { target: Container; x: -TagButton.x + 5 } - PropertyChanges { target: TitleBar; height: 80 } + PropertyChanges { target: titleBar; height: 80 } PropertyChanges { target: TagButton; text: "OK" } PropertyChanges { target: TagButton; width: 28 } PropertyChanges { target: TagButton; height: 24 } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index e467f82..14075bf 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -67,6 +67,7 @@ Item { width: parent.width; opacity: 0.9 button1Label: "Update" button2Label: "View others" + onButton1Clicked: RssModel.reload(); onButton2Clicked: { if(Screen.userView == true){ -- cgit v0.12