summaryrefstree
path: root/usr/bin/qml/com/neusoft/auto/widgets/HMIMouseArea.qml
blob: fdec726d92c9c93e910f6b902499d7a9b4968bcf (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import QtQuick 2.0
import "../../../../windowsList.js" as WindowsList
import "../../../../layoutList.js" as Layout
MouseArea
{
    id:mouseArea
    property real timerCount: 1000   //default 2s trigger
    property int preMouseX: 0        //mouse Limit
    property int preMouseY: 0        //mouse Limit
    signal longPress()
    signal longClicked()
    property bool bBeep: true
    property int usbformId:0
    property int mtpformId:0
    property bool longPressFlag: false
    property bool forward_or_backward:false

    function mouseAreaMask()
    {
        if(true == mouseArea.visible)
        {
            mouseArea.visible = false
            mouseArea.visible = true
        }
    }

    Timer{
        id:timer
        running: false
        interval: timerCount
        repeat:false
        onTriggered:
        {
            console.log("***llll****mouseArea***longPress*1")
            longPress()
        }
        onIntervalChanged:
        {
            if(timerCount != 0)
            {
                console.log("***llll****mouseArea***longPress*2")
                if(true == timer.running)
                    timer.stop()
            }
        }
    }
    onMouseXChanged:
    {
        if(Math.abs(mouseX - preMouseX) <= 20)   //offset 20
        {
            if( (mouseX > mouseArea.width) ||
                    (mouseX < 0) )     //exit
            {
                if(timerCount != 0)
                {
                    if(true == timer.running)
                        timer.stop()
                }

            }
        }
        preMouseX = mouseX
    }
    onMouseYChanged:
    {
        if(Math.abs(mouseY - preMouseY) <= 20)
        {
            if( (mouseY > mouseArea.height) ||
                    (mouseY < 0) )            //exit
            {
                if(timerCount != 0)
                {
                    if(true == timer.running)
                        timer.stop()
                }
            }
        }
        preMouseY = mouseY
    }
    onPressed: {
        console.log("***llll****mouseArea***onPressed*1")
        systemCtrl.lastKey_interrupt_currentKey();
        //systemCtrl.hideHMIBottom()
        longPressFlag=false
        preMouseX = mouse.x
        if (bBeep)
        {
            console.log("***llll****mouseArea***onPressed*2")

            systemCtrl.touchBeep(0)
            systemCtrl.closeOverLay();
        }
        if(timerCount != 0)
        {
            console.log("***llll****mouseArea***onPressed*3")

            if(true == timer.running)
                timer.stop()
            timer.restart()
        }
		/*
        if(forward_or_backward == false)
        {
			console.log("ipod_playstatus00000000000000000000000000000000")
            if(ipodCtrl.ipod_playstatus == 4)
            {
                ipodCtrl.ipod_prevNextLongPressedEnd(2)

            }
            radioCtrl.reqCheckSeekState()
			//ADD #H0028 2016/11/28 yx Start
			USBControl1.usbPrevNextLongPressedEnd(2)
			//ADD #H0028 2016/11/28 yx End
        }
		*/
    }
    onReleased: {
        console.log("***llll****mouseArea***onReleased*1")
        if(timerCount != 0)
        {
            console.log("***llll****mouseArea***onReleased*2")
            if(true == timer.running)
            {
                console.log("***llll****mouseArea***onReleased*3")
                timer.stop()
                longClicked()
            }
            else
            {
                //do nothing
            }
        }
    }
    onCanceled: {
        console.log("***llll****mouseArea***onCanceled*1")
        if(timerCount != 0)
        {
            console.log("***llll****mouseArea***onCanceled*1")
            if(true == timer.running)
                timer.stop()
        }
    }
    Connections
    {
        target: ScreenManager
        onFormchange:
        {
            if(formStatus)
            {
                mouseAreaMask();
            }
        }
    }
    Connections
    {
        target:acCtrl
        onCvbsStatusOn:
        {
            mouseAreaMask()
        }
    }
//ADD 163233 163229 2017/4/6 ld begin	
    Connections
    {
        target:ScreenManager
//        onExchangeStateChanged:
//        {
//            if(exchangeState)
//            {
//                mouseArea.enabled = false
//            }else{
//                mouseArea.enabled = true
//            }
//        }
    }
//ADD 163233 163229 2017/4/6 ld end
 //ADD----------------------------  #119575 2016/10/0 xbw begin------------------------------------------
    Connections
    {
        target:systemCtrl
        onPowercheckHIGH:
        {
            console.log("***llll****mouseArea***onPowercheckHIGH")

            mouseAreaMask()
        }
        onPowercheckLOW:
        {
            console.log("***llll****mouseArea***onPowercheckLOW")
            mouseAreaMask()
        }
        onPowerIGNOff:
        {
            console.log("***llll****mouseArea***onPowerIGNOff")
            mouseAreaMask()
        }
        onHkNoseEncoderPressed:
        {
            console.log("***llll****mouseArea***onHkNoseEncoderPressed")
            if(Layout.HMI_SHORT_PRESS == keyStat)
            {
                mouseAreaMask()


            }
        }
	//ADD 163233 163229 2017/4/6 ld begin
        onHkNoseEncoderRotated:{
            mouseAreaMask()
        }
	//ADD 163233 163229 2017/4/6 ld end
        //add by lium for 318739 20190201 begin
        onPowerNotice:
        {
            mouseAreaMask()
        }
        //add by lium for 318739 20190201 end
    }
//ADD---------------------------- #119575 2016/10/09 xbw end------------------------------------------
}