10 import QtMultimediaKit 1.1
 
   11 import com.nokia.meego 1.0
 
   12 import org.kde.edu.marble 0.11
 
   17     tools: ToolBarLayout {
 
   19             iconSource: 
main.
icon( 
"actions/go-previous-view", 48 );
 
   20             onClicked: pageStack.pop()
 
   30         anchors.left: parent.left
 
   31         anchors.right: parent.right
 
   32         anchors.top: parent.top
 
   35         visible: !Marble.canExecute(
"monav-daemon") && !Marble.canExecute(
"MoNavD")
 
   39             anchors.verticalCenter: parent.verticalCenter
 
   40             iconSource: 
main.
icon( 
"status/task-attention", 48 );
 
   44             anchors.verticalCenter: parent.verticalCenter
 
   45              property string monavStoreUrl: 
"http://store.ovi.mobi/content/250322" 
   46             width: parent.width - statusIcon.width
 
   47             text: 
"Please install Monav Routing Daemon (free) to enable offline routing. <a href=\"" + monavStoreUrl + 
"\">Install now</a>." 
   50             onLinkActivated: Qt.openUrlExternally(link)
 
   56         anchors.top: monavStatus.visible ? monavStatus.bottom : parent.top
 
   60             offlineDataModel.setFilterFixedString(term)
 
   66         anchors.left: parent.left
 
   67         anchors.right: parent.right
 
   71         checkedButton: noFilter
 
   80             iconSource: 
"qrc:/icons/routing-motorcar.svg";
 
   86             iconSource: 
"qrc:/icons/routing-bike.svg";
 
   92             iconSource: 
"qrc:/icons/routing-pedestrian.svg";
 
   96         onCheckedButtonChanged: {
 
   97             offlineDataModel.setVehicleTypeFilter(
 
  108         model: offlineDataModel
 
  109         anchors.left: parent.left
 
  110         anchors.right: parent.right
 
  111         anchors.top: filterRow.bottom
 
  112         anchors.bottom: parent.bottom
 
  113         anchors.topMargin: 10
 
  115         delegate: dataDelegate
 
  117         highlightMoveDuration: 200
 
  119         section.property: 
"continent" 
  120         section.delegate: sectionDelegate
 
  126         flickableItem: dataView
 
  133             color: Qt.rgba(0/255, 102/255, 255/255, 1)
 
  134             width: dataView.width
 
  135             height: childrenRect.height
 
  142                 color: Qt.rgba(238/255, 238/255, 236/255, 1)
 
  154             property bool installing: transitioning
 
  155             property bool selected: ListView.view.currentIndex === idx
 
  156             property bool showDetails: selected || installing
 
  157             property int idx: index
 
  165                     anchors.verticalCenter: parent.verticalCenter
 
  168                     fillMode: Image.PreserveAspectFit
 
  169                     source: name.search(/Bicycle/) !== -1 ? 
"qrc:/icons/routing-bike.svg" : (name.search(/Pedestrian/) !== -1 ? 
"qrc:/icons/routing-pedestrian.svg" : 
"qrc:/icons/routing-motorcar.svg")
 
  174                     width: delegateRoot.width - row.spacing - previewIcon.width - 10
 
  175                     height: nameLabel.height + (delegateRoot.showDetails ? versionLabel.height + installButton.height + 15 : 0)
 
  181                         font.bold: upgradable
 
  187                         anchors.top: nameLabel.bottom
 
  189                         visible: delegateRoot.showDetails
 
  190                         property string localVersion: 
"<font size=\"-1\">Version installed: " + installedreleasedate + 
"</font>" 
  191                         property string displaySize: delegateRoot.showDetails && !settings.workOffline ? 
" (" + formatSize() + 
")" : 
"" 
  192                         text: 
"<font size=\"-1\">Version available: " + releasedate + displaySize + 
"</font>" + (installed ? 
"<br />" + localVersion : 
"")
 
  194                         function formatSize() {
 
  202                             for (var i=0; i<9 && length >= 1000; ++i) {
 
  208                             case 0: 
return length.toFixed(1) + 
" byte" 
  209                             case 1: 
return length.toFixed(1) + 
" kB" 
  210                             case 2: 
return length.toFixed(1) + 
" MB" 
  211                             case 3: 
return length.toFixed(1) + 
" GB" 
  212                             case 4: 
return length.toFixed(1) + 
" TB" 
  213                             case 5: 
return length.toFixed(1) + 
" PB" 
  214                             case 6: 
return length.toFixed(1) + 
" EB" 
  215                             case 7: 
return length.toFixed(1) + 
" ZB" 
  216                             case 8: 
return length.toFixed(1) + 
" YB" 
  223                         visible: delegateRoot.installing
 
  224                         anchors.top: versionLabel.bottom
 
  225                         width: parent.width - 50
 
  232                             target: offlineDataModel
 
  233                             onInstallationProgressed: {
 
  234                                 if (newstuffindex === delegateRoot.idx) {
 
  235                                     progressBar.indeterminate = 
false 
  236                                     progressBar.value = progress
 
  239                             onInstallationFinished: {
 
  240                                 if (newstuffindex === delegateRoot.idx) {
 
  241                                     delegateRoot.installing = 
false 
  244                             onInstallationFailed: {
 
  245                                 if (newstuffindex === delegateRoot.idx) {
 
  246                                     delegateRoot.installing = 
false 
  249                             onUninstallationFinished: {
 
  250                                 if (newstuffindex === delegateRoot.idx) {
 
  251                                     delegateRoot.installing = 
false 
  259                         onClicked: delegateRoot.ListView.view.currentIndex = delegateRoot.idx
 
  263                         anchors.left: progressBar.right
 
  264                         anchors.leftMargin: 5
 
  265                         anchors.verticalCenter: progressBar.verticalCenter
 
  266                         visible: delegateRoot.installing
 
  269                         iconSource: 
main.
icon( 
"actions/dialog-cancel", 32 );
 
  271                             progressBar.indeterminate = 
true 
  272                             offlineDataModel.cancel(delegateRoot.idx)
 
  278                         text: installed && upgradable ? 
"Upgrade" : 
"Install" 
  279                         enabled: !installed || upgradable
 
  280                         anchors.top: versionLabel.bottom
 
  281                         anchors.left: parent.left
 
  283                         width: parent.width / 2 - 5
 
  284                         visible: delegateRoot.selected && !delegateRoot.installing
 
  286                             progressBar.indeterminate = 
true 
  287                             delegateRoot.installing = 
true 
  288                             offlineDataModel.install(delegateRoot.idx)
 
  294                         anchors.top: versionLabel.bottom
 
  295                         anchors.right: parent.right
 
  296                         anchors.left: installButton.right
 
  298                         width: parent.width / 2 - 5
 
  299                         visible: delegateRoot.selected && !delegateRoot.installing
 
  302                             progressBar.indeterminate = 
true 
  303                             delegateRoot.installing = 
true 
  304                             offlineDataModel.uninstall(delegateRoot.idx)
 
static qreal radius(qreal zoom)