a189babaae57e00617ccc2bd1e083b0340713ce3
[qtrapids] / src / qml-client / qml / MainPage.qml
1 import QtQuick 1.1
2 import Qt.labs.components 1.0
3 import com.nokia.meego 1.0
4 import com.meego 1.0
5 import com.nokia.extras 1.0
6
7 import QtRapids 1.0
8
9 Page {
10     id: tabbarPage
11
12     property bool busy: Boolean(tabGroup.currentTab.busy)
13     anchors.margins: rootWindow.pageMargin
14
15     tools: ToolBarLayout {
16         ToolIcon { iconId: "toolbar-back"; onClicked: pageStack.pop(); }
17         ButtonRow {
18             platformStyle: TabButtonStyle { }
19             TabButton {
20                 text: "Downloads"
21                 tab: downloads
22             }
23             TabButton {
24                 text: "Seeds"
25                 tab: seeds
26             }
27         }
28         ToolIcon { iconId: "toolbar-view-menu"; onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close() }
29     }
30 //  Text {
31 //      text: "Hello World!"
32 //      font.family: "Helvetica"
33 //      font.pointSize: 24
34 //      color: "red"
35 //     anchors.fill: parent
36 //  }
37
38     ListView {
39         width: 200; height: 400
40 /*
41         DownloadListModel {
42             id: downloadModel
43             // TODO: Does not work like this. Need properties to set from QML?
44             // Try setting test data from C++ side and view here..
45             /*
46             ListElement {
47                 Hash: "QMLHASH1"
48                 Size: "Size1"
49                 Status: "DONE1"
50             }
51             ListElement {
52                 Hash: "QMLHASH2"
53                 Size: "Size2"
54                 Status: "DONE2"
55             }
56             ListElement {
57                 Hash: "QMLHASH3"
58                 Size: "Size3"
59                 Status: "DONE3"
60             }
61         }
62 */
63         Component {
64             id: downloadDelegate
65             Item {
66                 height: 40
67                 width: parent.width
68                 Text {
69                     id: hashText
70                     text: hash
71                 }
72                 Text {
73                     id: nameText
74                     anchors.leftMargin: 10
75                     anchors.left: hashText.right
76                     text: name
77                 }
78                 Text {
79                     id: seedsText
80                     anchors.leftMargin: 10
81                     anchors.left: nameText.right
82                     text: seeds
83                 }
84                 Text {
85                     id: leechesText
86                     anchors.leftMargin: 10
87                     anchors.left: seedsText.right
88                     text: leeches
89                 }
90             }
91         }
92
93         // downloadModel is from rootContext, set in main.cpp
94         model: downloadModel
95         delegate: downloadDelegate
96     }
97
98     /*
99     ListModel {
100         id: pagesModel
101         ListElement {
102             page: "CountBubble.qml"
103             title: "CountBubble"
104             subtitle: "Indicates current count"
105         }
106         ListElement {
107             page: "NetPromoterScore.qml"
108             title: "NetPromoterScore"
109             subtitle: "Shows net promotion query page"
110         }
111         ListElement {
112             page: "PageIndicator.qml"
113             title: "PageIndicator"
114             subtitle: "Indicates total & current pages"
115         }
116         ListElement {
117             page: "RatingIndicator.qml"
118             title: "RatingIndicator"
119             subtitle: "Indicates ratings"
120         }
121         ListElement {
122             page: "ListDelegates.qml"
123             title: "List Delegates"
124             subtitle: "Various List Delegates"
125         }
126         ListElement {
127             page: "MoreIndicator.qml"
128             title: "MoreIndicator"
129             subtitle: "Indicates that there are more contents"
130         }
131         ListElement {
132             page: "StyledButtons.qml"
133             title: "StyledButtons"
134             subtitle: "Buttons with different styles"
135         }
136     }
137     ListView {
138         id: listview
139         anchors.fill: parent
140         model: pagesModel
141
142         delegate: ListDelegate {
143             Image {
144                 source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
145                 anchors.right: parent.right;
146                 anchors.verticalCenter: parent.verticalCenter
147             }
148
149             subtitleColor: "#cc6633"
150             onClicked: { openFile(model.page); }
151         }
152     }
153 */
154     TabGroup {
155         id: tabGroup
156
157         currentTab: downloads
158
159         PageStack {
160             id: downloads
161         }
162         PageStack {
163             id: seeds
164         }
165         Page {
166             id: tab3
167             Column {
168                 spacing: 10
169
170                 Text {
171                     text: "This is a single page"
172                 }
173             }
174         }
175     }
176
177 }