summaryrefslogtreecommitdiff
path: root/src/hmi/qml/Core/EntryField.qml
blob: 227a708ae7032b0ff5fe660d3cf7bd78b1133750 (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
101
102
103
104
105
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
*
* \file EntryField.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, remove text title from the entry field
* <date>, <name>, <description of change>
*
* @licence end@
*/
import QtQuick 2.1 

import "genivi.js" as Genivi;

Column {
    id: entryfield
    width: input.width
    height: input.height
    property alias text: input.text
	property alias criterion: input.criterion
	property alias textfocus: input.focus
	property alias next: input.next
	property alias prev: input.prev
	property string globaldata
	property bool disabled
	signal leave()
	opacity: disabled ? 0.2 : 1

	function takeFocus()
	{
		input.forceActiveFocus();
	}

	function callEntry()
	{
		entryfield.leave();
		Genivi.entryback=menu.pagefile;
		Genivi.entrydest=globaldata;
		Genivi.entrycriterion=criterion;
		if (criterion && criterion != Genivi.NAVIGATIONCORE_LOCATION_INPUT) {
			pageOpen("Entry"); 
		} else {
			pageOpen("EntrySimple"); 
		}
	}

    Rectangle {
        width: parent.width; height: parent.height; color: 'transparent'
        Row {
            width: parent.width; height: parent.height;
			TextInput {
                property real criterion
				property Item next
				property Item prev
				signal mclicked()
                id:input; width: parent.width*3/4; height: parent.height; color: 'white'; font.pixelSize: parent.height*0.75
				onMclicked: { callEntry(); }
                text: Genivi.data[globaldata]?Genivi.data[globaldata]:""
                wrapMode: Text.WordWrap
                clip: true
                MouseArea {
					anchors.fill: parent
					onClicked: {
						if (!entryfield.disabled) {
							if (!input.focus) {
								takeFocus();
							} else {
								callEntry();
							}
						}
					}
				}
				Keys.onReturnPressed: {
					accept(entryfield);
				}
			}
			StdButton {
                height: parent.height;
                width: parent.width/4;
                source:"images/keyboard.png";
				onClicked: {
					callEntry();
				}
			}
		}
	}
}