Flesh out UI, provide journey data model
[harbour-pedalo.git] / qml / pages / MainPage.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3
4 Page {
5     id: page
6     property bool cycling: false
7
8     // The effective value will be restricted by ApplicationWindow.allowedOrientations
9     allowedOrientations: Orientation.All
10
11     // To enable PullDownMenu, place our content in a SilicaFlickable
12     SilicaFlickable {
13         anchors.fill: parent
14
15         // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
16         PullDownMenu {
17             MenuItem {
18                 text: qsTr("Show Page 2")
19                 onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
20             }
21         }
22
23         // Tell SilicaFlickable the height of its content.
24         contentHeight: column.height
25
26         // Place our content in a Column.  The PageHeader is always placed at the top
27         // of the page, followed by our content.
28         Column {
29             id: column
30
31             width: page.width
32             spacing: Theme.paddingLarge
33             PageHeader {
34                 title: qsTr("Pedalo")
35             }
36
37             SectionHeader {
38                 text: qsTr("Cycle!")
39             }
40
41             Button {
42                 anchors.horizontalCenter: parent.horizontalCenter
43                 text: cycling ? qsTr("Finish") : qsTr("Start a journey")
44                 onClicked: {
45                     if (cycling) {
46                         var dialog = pageStack.push(Qt.resolvedUrl("AddJourney.qml"))
47
48                         dialog.accepted.connect(function() {
49                             cycling = false
50                         })
51                     }
52                     else {
53                         cycling = true
54                     }
55                 }
56             }
57
58             SectionHeader {
59                 text: qsTr("Add a journey")
60             }
61
62             Button {
63                 anchors.horizontalCenter: parent.horizontalCenter
64                 text: qsTr("Enter journey")
65                 onClicked: pageStack.push(Qt.resolvedUrl("AddJourney.qml"))
66             }
67
68             SectionHeader {
69                 text: qsTr("Latest stats")
70             }
71
72             Button {
73                 anchors.horizontalCenter: parent.horizontalCenter
74                 text: qsTr("View stats")
75                 onClicked: pageStack.push(Qt.resolvedUrl("Stats.qml"))
76             }
77
78             SectionHeader {
79                 text: qsTr("Previous journeys")
80             }
81
82             Button {
83                 anchors.horizontalCenter: parent.horizontalCenter
84                 text: qsTr("View journeys")
85                 onClicked: pageStack.push(Qt.resolvedUrl("JourneyList.qml"))
86             }
87
88         }
89     }
90 }