Cleanup and restructure the main UI
[pywienerlinien] / qml / main.qml
1 import QtQuick 1.1
2 import com.nokia.meego 1.0
3 import QtMobility.location 1.1
4
5 PageStackWindow {
6     id: appWindow
7
8     initialPage: mainPage
9     showToolBar: aboutBox.opacity == 0
10
11     MainPage {
12         id: mainPage
13
14         AboutBox {
15             id: aboutBox
16             anchors.fill: parent
17
18             appName: aboutInfo.getAppName()
19             websiteURL: aboutInfo.getWebsiteURL()
20             copyright: aboutInfo.getCopyright()
21             license: aboutInfo.getLicense()
22             iconFilename: 'gotovienna-about-logo.png'
23         }
24     }
25
26     PositionSource {
27         id: positionSource
28         updateInterval: 15000
29
30         active: !(position.longitudeValid && position.latitudeValid)
31     }
32
33     ToolBarLayout {
34         id: commonTools
35
36         ToolIcon {
37             platformIconId: 'icon-m-toolbar-search'
38             anchors.left: parent.left
39             onClicked: mainPage.search()
40         }
41
42         ToolIcon {
43             platformIconId: "toolbar-view-menu"
44             anchors.right: parent.right
45             onClicked: menu.open()
46         }
47
48         ToolIcon {
49               visible: mainPage.canRefresh
50               platformIconId: 'icon-m-toolbar-refresh'
51               anchors.centerIn: parent
52               onClicked: mainPage.refresh()
53         }
54
55         Text {
56             id: debugText
57             text: ''
58
59             anchors {
60                 bottomMargin: 10
61                 bottom: parent.bottom
62                 left: logo.right
63                 leftMargin: 10
64                 top: logo.top
65             }
66             font.pixelSize: 16
67         }
68     }
69
70     Menu {
71         id: menu
72
73         MenuLayout {
74             MenuItem {
75                 text: 'Nearby stations'
76                 onClicked: mainPage.showNearby()
77             }
78             MenuItem {
79                 text: 'About gotoVienna'
80                 onClicked: aboutBox.show()
81             }
82         }
83     }
84 }