| 1 | import QtQuick 1.1 |
|---|
| 2 | import com.nokia.meego 1.0 |
|---|
| 3 | import com.nokia.extras 1.0 |
|---|
| 4 | //import QtMobility.sensors 1.1 |
|---|
| 5 | //import QtMobility.location 1.1 |
|---|
| 6 | //import QtMobility.systeminfo 1.1 |
|---|
| 7 | |
|---|
| 8 | PageStackWindow { |
|---|
| 9 | property string theme : options.get("currentTheme", "default") |
|---|
| 10 | id: rWin |
|---|
| 11 | showStatusBar : false |
|---|
| 12 | initialPage : MapPage { |
|---|
| 13 | id: mapPage |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | MenuPage { |
|---|
| 17 | id : mainMenu |
|---|
| 18 | } |
|---|
| 19 | OptionsMenuPage { |
|---|
| 20 | id : optionsMenu |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | InfoMenuPage { |
|---|
| 24 | id : infoMenu |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | MapMenuPage { |
|---|
| 28 | id : mapMenu |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | /* looks like object ids can't be stored in ListElements, |
|---|
| 32 | so we need this function to return corresponding menu pages |
|---|
| 33 | for names given by a string |
|---|
| 34 | */ |
|---|
| 35 | |
|---|
| 36 | property variant pages : { |
|---|
| 37 | "mainMenu" : mainMenu, |
|---|
| 38 | "optionsMenu" : optionsMenu, |
|---|
| 39 | "infoMenu" : infoMenu, |
|---|
| 40 | "mapMenu" : mapMenu |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | function getPage(name) { |
|---|
| 44 | return pages[name] |
|---|
| 45 | /* TODO: some pages are not so often visited pages so they could |
|---|
| 46 | be loaded dynamically from their QML files ? |
|---|
| 47 | -> also, a loader pool might be used as a rudimentary page cache, |
|---|
| 48 | but this might not be needed if the speed is found to be adequate */ |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | property string layer: "mapnik" |
|---|
| 52 | |
|---|
| 53 | function setLayer(name) { |
|---|
| 54 | layer = name |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | /** global notification handling **/ |
|---|
| 58 | function notify(text, msTimeout) { |
|---|
| 59 | notification.text = text |
|---|
| 60 | notification.timerShowTime = msTimeout |
|---|
| 61 | notification.show() |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | InfoBanner { |
|---|
| 66 | id: notification |
|---|
| 67 | timerShowTime : 5000 |
|---|
| 68 | height : rWin.height/5.0 |
|---|
| 69 | // prevent overlapping with status bar |
|---|
| 70 | y : rWin.showStatusBar ? rWin.statusBarHeight + 8 : 8 |
|---|
| 71 | |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | /* |
|---|
| 75 | // compass |
|---|
| 76 | Compass { |
|---|
| 77 | id: compass |
|---|
| 78 | onReadingChanged: {azimuth = compass.reading.azimuth; calibration = compass.reading.calibrationLevel; } |
|---|
| 79 | property real azimuth: 0 |
|---|
| 80 | property real calibration: 0 |
|---|
| 81 | active: true |
|---|
| 82 | dataRate: 10 |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | // temporary position source |
|---|
| 87 | PositionSource { |
|---|
| 88 | id: gpsSource |
|---|
| 89 | active: true |
|---|
| 90 | updateInterval: 1000 |
|---|
| 91 | onPositionChanged: { |
|---|
| 92 | console.log("lat: " + position.coordinate.latitude + "lon: " + position.coordinate.longitude ) |
|---|
| 93 | controller.positionChanged(position.latitudeValid, position.coordinate.latitude, position.coordinate.longitude, position.altitudeValid, position.coordinate.altitude, position.speedValid, position.speed, position.horizontalAccuracy, position.timestamp); |
|---|
| 94 | } |
|---|
| 95 | } |
|---|
| 96 | */ |
|---|
| 97 | |
|---|
| 98 | Component.onCompleted : { |
|---|
| 99 | } |
|---|
| 100 | } |
|---|