From a28f8a3e351cf54ad90d0e51deebf9d223916723 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Wed, 11 Jan 2012 16:59:03 +0100 Subject: [PATCH] Cleanup and restructure the main UI --- qml/MainPage.qml | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- qml/StationSheet.qml | 13 ---------- qml/main.qml | 18 ++++++-------- 3 files changed, 70 insertions(+), 28 deletions(-) diff --git a/qml/MainPage.qml b/qml/MainPage.qml index a14e48d..4d1947b 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -12,6 +12,10 @@ Page { //property alias stationSelect: stationSelector property variant nearbyStations + function search() { + lineSearchButton.clicked() + } + function refresh() { realtimeResult.refresh() } @@ -32,6 +36,47 @@ Page { stationSelector.open() } + Text { + visible: !parent.canRefresh + anchors.centerIn: parent + font.pixelSize: 30 + text: '

Welcome, traveller!

Press to search for
departure information.

Press for nearby stations.

Have a safe journey.

' + } + + Rectangle { + id: header + anchors { + top: parent.top + left: parent.left + right: parent.right + margins: -1 + } + border { + color: 'black' + width: 1 + } + + gradient: Gradient { + GradientStop { position: 0; color: '#777' } + GradientStop { position: 1; color: '#aaa' } + } + + height: 80 + color: 'white' + + Image { + id: logo + source: 'logo.png' + + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 10 + } + } + + } + PositionSource { id: positionSource updateInterval: 10000 @@ -63,6 +108,7 @@ Page { } TextField { + visible: false placeholderText: 'Line' id: gline @@ -100,6 +146,7 @@ Page { Button { id: lineSearchButton + visible: false anchors { top: gline.top @@ -120,6 +167,7 @@ Page { TextField { placeholderText: 'Station' id: gstation + visible: false anchors { top: gline.bottom @@ -133,6 +181,19 @@ Page { StationSheet { id: stationSheet + onAccepted: { + gstation.text = stationSheet.currentStation + + realtimeResult.gline = stationSheet.currentLine + realtimeResult.gstation = stationSheet.currentStation + realtimeResult.gdirection = stationSheet.currentDirection + realtimeResult.isStation = false + + realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation) + console.log('url to get: ' + realtimeResult.sourceUrl) + realtimeResult.refresh() + + } } Button { @@ -145,9 +206,7 @@ Page { rightMargin: 10 } - Behavior on opacity { PropertyAnimation { } } - - opacity: gline.text !== '' // XXX: Check if the line is valid + visible: false width: lineSearchButton.width * opacity //iconSource: 'image://theme/icon-m-common-location-picker' @@ -164,7 +223,7 @@ Page { anchors { margins: 10 - top: gstation.bottom + top: header.bottom left: parent.left bottom: parent.bottom right: parent.right diff --git a/qml/StationSheet.qml b/qml/StationSheet.qml index 6e58e76..d9f0b38 100644 --- a/qml/StationSheet.qml +++ b/qml/StationSheet.qml @@ -131,17 +131,4 @@ Sheet { platformStyle: BusyIndicatorStyle { size: 'large' } } } - - onAccepted: { - gstation.text = stationSheet.currentStation - - realtimeResult.gline = stationSheet.currentLine - realtimeResult.gstation = stationSheet.currentStation - realtimeResult.gdirection = stationSheet.currentDirection - realtimeResult.isStation = false - - realtimeResult.sourceUrl = itip.get_directions_url(stationSheet.currentLine, stationSheet.currentDirection, stationSheet.currentStation) - console.log('url to get: ' + realtimeResult.sourceUrl) - - } } diff --git a/qml/main.qml b/qml/main.qml index 0b34290..9e22346 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -32,6 +32,13 @@ PageStackWindow { ToolBarLayout { id: commonTools + + ToolIcon { + platformIconId: 'icon-m-toolbar-search' + anchors.left: parent.left + onClicked: mainPage.search() + } + ToolIcon { platformIconId: "toolbar-view-menu" anchors.right: parent.right @@ -45,17 +52,6 @@ PageStackWindow { onClicked: mainPage.refresh() } - Image { - id: logo - source: 'logo.png' - - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: 10 - } - } - Text { id: debugText text: '' -- 1.7.9.5