summaryrefslogtreecommitdiff
path: root/src/hmi/qml/NavigationSearchHistory.qml
blob: 76c26c2b3a4808bb0dc6338cd5fa7b1b54b93906 (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
97
98
99
100
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
*
* \file NavigationSearchHistory.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, creation of the new page
* <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:"NavigationSearchHistory"

    DBusIf {
        id:dbusIf
    }

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

		HMIList {
            id:view
            property real selectedEntry
			height:parent.height-back.height;
			width:parent.width;
			delegate: listDelegate
			next:back
			prev:back
            onSelected:{
                Genivi.data['description'] = what.text;
                Genivi.data['lat'] = Genivi.historyOfLastEnteredLat[what.index];
                Genivi.data['lon'] = Genivi.historyOfLastEnteredLon[what.index];
                routeMenu();
            }
        }
		StdButton {
			id:back
			text: "Back"
            onClicked:{leaveMenu();}
		}
	}
    Component.onCompleted: {
        var model=view.model;
        var array=Genivi.historyOfLastEnteredLocation;
        // display list of locations (fifo)
        var i = Genivi.historyOfLastEnteredLocationOut;
        while (i !== Genivi.historyOfLastEnteredLocationIn)
        {
            model.append({"name":Genivi.historyOfLastEnteredLocation[i],"number":(i)});
            if ((i+1) >= Genivi.historyOfLastEnteredLocationDepth)
                i=0;
            else
                i+=1;
        };
        view.forceActiveFocus();
    }
}