summaryrefslogtreecommitdiff
path: root/src/hmi/qml/NavigationRouteDescription.qml
blob: 8bae34163fbb85b73adf19247b4d5cceaa9802c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
*
* \file NavigationRouteDescription.qml
*
* \brief This file is part of the navigation hmi.
*
* \author Martin Schaller <martin.schaller@it-schaller.de>
* \author Philippe Colliot <philippe.colliot@mpsa.com>
*
* \version 1.1
*
* This Source Code Form is subject to the terms of the
* Mozilla Public License (MPL), v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For further information see http://www.genivi.org/.
*
* List of changes:
* 2014-03-05, Philippe Colliot, migration to the new HMI design
* <date>, <name>, <description of change>
*
* @licence end@
*/

import QtQuick 2.1 
import "Core"
import "Core/genivi.js" as Genivi;
import "Core/style-sheets/style-constants.js" as Constants;
import lbs.plugin.dbusif 1.0

HMIMenu {
	id: menu
    property string pagefile:"NavigationRouteDescription"

	Column {
        id:content
        anchors { fill: parent; topMargin: menu.hspc/2 }
	
        Component {
            id: listDelegate
            Text {
                width: 180;
                height: 20;
                id:text;
                text: name;
                font.pixelSize: 20;
                style: Text.Sunken;
                color: "white";
                styleColor: "black";
                smooth: true
            }
        }

		HMIList {
			property real selectedEntry
			height:parent.height-back.height;
			width:parent.width;
			id:view
			delegate: listDelegate
			next:back
			prev:back
		}
		StdButton {
			id:back
			pixelSize:Constants.MENU_ROUTE_DESCRIPTION_TEXT_PIXEL_SIZE;
			text: "Back"
            onClicked: {
                leaveMenu();
            }
		}
	}

	DBusIf {
        id:dbusIf
    }

    Component.onCompleted: {
        var res=Genivi.routing_GetRouteSegments(dbusIf,0,100,0)
        var array=res[3];
        var model=view.model;
        for (var i = 0 ; i < array.length ; i+=2) {
            var map=array[i+1];
            var mapresult=Array;
            for (var j = 0 ; j < map.length ; j+=4) {
                mapresult[map[j+1]]=map[j+3][3][1];
            }
            var text=Genivi.distance(mapresult[Genivi.NAVIGATIONCORE_DISTANCE])+" "+Genivi.time(mapresult[Genivi.NAVIGATIONCORE_TIME])+" "+mapresult[Genivi.NAVIGATIONCORE_ROAD_NAME];
            model.append({"name":text});
        }
    }
}