blob: f86388e998a7eae4a1f4616ece8e8b36ebb603f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
import Qt 4.7
import "TwitterCore" 1.0 as Twitter
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;}
//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=''
Rectangle {
id: background
anchors.fill: parent; color: "#343434";
Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
Twitter.RssModel { id: rssModel }
Twitter.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: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap
visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent
}
Item {
id: views
x: 2; width: parent.width - 4
y:60 //Below the title bars
height: 380
Twitter.AuthView{
id: authView
anchors.verticalCenter: parent.verticalCenter
width: parent.width; height: parent.height-60;
x: -(screen.width * 1.5)
}
Twitter.FatDelegate { id: fatDelegate }
ListView {
id: mainView; model: rssModel.model; delegate: fatDelegate;
width: parent.width; height: parent.height; x: 0; cacheBuffer: 100;
}
}
Twitter.MultiTitleBar { id: titleBar; width: parent.width }
Twitter.ToolBar { id: toolBar; height: 40;
//anchors.bottom: parent.bottom;
//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:
{
if(screen.userView == true){
screen.setMode(false);
}else{
rssModel.tags='';
screen.setMode(true);
}
}
}
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 } }
]
}
}
|