summaryrefslogtreecommitdiffstats
path: root/demos/declarative/twitter/twitter.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative/twitter/twitter.qml')
-rw-r--r--demos/declarative/twitter/twitter.qml74
1 files changed, 34 insertions, 40 deletions
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index 08cecb0..6d224a2 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -46,28 +46,18 @@ Item {
id: screen; width: 320; height: 480
property bool userView : false
property variant tmpStr
- function setMode(m){
- screen.userView = m;
- if(m == false){
- rssModel.tags='my timeline';
- rssModel.reload();
- toolBar.button2Label = "View others";
- } else {
- toolBar.button2Label = "Return home";
- }
- }
function setUser(str){hack.running = true; tmpStr = str}
- function reallySetUser(){rssModel.tags = tmpStr;}
-
+ function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""}
+ state:"searchquery"
//Workaround for bug 260266
Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack }
-
- //TODO: better way to return to the auth screen
- Keys.onEscapePressed: rssModel.authName=''
+ Keys.onEscapePressed: screen.state="searchquery"
+ Keys.onBacktabPressed: screen.state="searchquery"
Rectangle {
id: background
anchors.fill: parent; color: "#343434";
+ state:"searchquery"
Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
MouseArea {
@@ -90,8 +80,16 @@ Item {
y:60 //Below the title bars
height: 380
- Twitter.AuthView{
- id: authView
+ Text {
+ id:title
+ text: "Search Twitter"
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black"
+ opacity:0
+ }
+
+ Twitter.SearchView{
+ id: searchView
anchors.verticalCenter: parent.verticalCenter
width: parent.width; height: parent.height-60;
x: -(screen.width * 1.5)
@@ -110,31 +108,27 @@ Item {
//TODO: Use anchor changes instead of hard coding
y: screen.height - 40
width: parent.width; opacity: 0.9
- button1Label: "Update"
- button2Label: "View others"
- onButton1Clicked: rssModel.reload();
- onButton2Clicked:
+ button1Label: "New Search"
+ button2Label: "Update"
+ onButton1Clicked:
{
- if(screen.userView == true){
- screen.setMode(false);
- }else{
- rssModel.tags='';
- screen.setMode(true);
- }
+ screen.state="searchquery"
}
+ onButton2Clicked: rssModel.reload();
}
-
- states: [
- State {
- name: "unauthed"; when: rssModel.authName==""
- PropertyChanges { target: authView; x: 0 }
- PropertyChanges { target: mainView; x: -(parent.width * 1.5) }
- PropertyChanges { target: titleBar; y: -80 }
- PropertyChanges { target: toolBar; y: screen.height }
- }
- ]
- transitions: [
- Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } }
- ]
}
+ states: [
+ State {
+ name: "searchquery";
+ PropertyChanges { target: searchView; x: 0; focus:true}
+ PropertyChanges { target: mainView; x: -(parent.width * 1.5) }
+ PropertyChanges { target: titleBar; y: -80 }
+ PropertyChanges { target: toolBar; y: screen.height }
+ PropertyChanges { target: toolBar }
+ PropertyChanges { target: title; opacity:1}
+ }
+ ]
+ transitions: [
+ Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } }
+ ]
}