summaryrefstree
path: root/usr/bin/qml/Carlink/Carlink_Contacts_SMS_View.qml
blob: 77d786fa670b7ac4255ca72b22e87dd21e4fb449 (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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
import QtQuick 2.0
import "../eventsList.js" as EventsList
import "../com/neusoft/auto/widgets"
import "../layoutList.js" as Layout
import "../windowsList.js" as WindowsList
//import QtQuick.Controls 1.0
import Label 2.0
HMIWindow
{
    id:msg_View_Answer
    //y:128
    property int curMsgIndex: 0
    Component.onCompleted:
    {
        windowID = WindowsList.CARLINK_CONTACTS_SMS_VIEW

    }
    onVisibleChanged:
    {
        bFullWindow = true
        msglist.model=carlinkCtrl.getcarlinkContactsMsgDiaListModel()
        msglist.positionViewAtEnd()
        systemCtrl.setTextInputHandle(answerInput)
         answerInput.text = ""

        if(keyBoard.visible == true)
        {
            keyBoard.visible = false
        }
        if(input_bar.visible == true)
        {
            input_bar.visible = false
        }
        if(icon_Send.visible == true)
        {
            icon_Send.visible = false
        }
        if(answer_btn.visible == false)
        {
            answer_btn.visible = true
        }

    }
    Timer{
        id:listtimer
        interval: 1
        repeat : false
        running : true
        triggeredOnStart : false
        onTriggered:
        {
            msglist.positionViewAtEnd()
        }
    }
    HMILabel
    {
        x:24
        y:128-128
        width:700
        height:56
        text:"Interact"
        color: "white"
        font.pixelSize: 28
        verticalAlignment: Label.AlignVCenter
        horizontalAlignment: Label.AlignLeft
    }

    HMILabel
    {
        id:view_Name
        x:79
        y:20
        width:610
        height:62
        text:carlinkCtrl.carlinkselectContactsmsgphone+"  "+carlinkCtrl.carlinkselectContactsmsgname//"SMS List"
        color: "white"
        font.pixelSize: 28
        horizontalAlignment: horizontalAlignment
        verticalAlignment: verticalAlignment
    }
    HMIButton
    {
        id:icon_return
        x:689
        y:151-128
        width: 31
        height: 21
        btnImg:icon_return.pressed?("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK_P"+bgImageStyle):("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle)
        onClicked:
        {


            ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.CARLINK_CONTACTS_SMS_VIEW)
           ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_ALL_LIST)

        }
    }
    Item
    {
        id:readmsg
        x:24
        y:190-128
        width:700
        height: (keyBoard.visible == true)?180:640-6-3
        HMIListView
        {

            id:msglist
            anchors.fill: parent
            clip:true

            model:carlinkCtrl.getcarlinkContactsMsgDiaListModel()
            delegate: msg_View
            keyNavigationWraps: true
            orientation: ListView.Vertical
            highlightFollowsCurrentItem: true
            snapMode: ListView.SnapOneItem
            scrollBar:true
            scrollBar_edge:0
            scrollBar_width:4
            scrollBar_img:"qrc:MATERIAL/MATERIAL_M8X_SLIDER_BAR"+bgImageStyle
        }
        Component
        {
            id:msg_View
            Item
            {
               width: 700
               height: (60+msgtext.height)<160?160:(60+msgtext.height)
               HMILabel
               {
                   id:msgtime
                   x:79
                   y:0
                   width:610
                   height:60
                   text:model.modelData.ContactsDiaMsg_Date//carlinkCtrl.getContactsMsgDate()
                   color: "#545454"
                   font.pixelSize: 24
                   horizontalAlignment: horizontalAlignment
                   verticalAlignment: verticalAlignment
               }

               Rectangle
               {
                   id:msgpic
                   x:230-24//254-24//col2 == "0"?34-24:254-24
                   y:254-200
                   width: 470//480
                   height:(msgtext.height+10)<100?100:(msgtext.height+10)
                   color: "#8A0000"//(col2 == "0")?"#262626":"#8A0000"
               }
                Text
                {
                    id:msgtext
                    visible: false
                    x:254-24//col2 == "0"?34-24:254-24
                    y:254-188+4-13
                    width: 450//480
                    font.family: "方正兰亭黑简体"
                    font.pixelSize:24
                    text:model.modelData.ContactsDiaMsg_Content//col0
                    color:"white"
                    wrapMode:Label.WrapAnywhere
                }
                HMILabel
                {
                    id:msgLabel
                    x:msgtext.x
                    y:msgtext.y
                    width: msgtext.width
                    height: msgtext.height+6//*0.860
                    font.pixelSize:24
                    text:model.modelData.ContactsDiaMsg_Content//col0
                    color:"white"
                    wrapMode:Label.WrapAnywhere
                    verticalAlignment: Label.AlignTop
                    horizontalAlignment: Label.AlignLeft
                }

                Image
                {
                    id:sms_failed
                    x:128-34
                    y:254-200
                    width: 30
                    height: 30
                    visible:model.modelData.ContactsDiaMsg_Status == "0"//col1 == "0"?true:false//(((col1 == "1")&&(col4 == "0"))||(col1 == "1"))?true:false

                    source:"qrc:MATERIAL/MATERIAL_M8X_ICON_SMS-FALLURE"+bgImageStyle
                }

            }
        }

    }

    HMILabel
    {
        id:answer
        x:20
        y:250
        width:120
        height:60
        font.pixelSize: 24
        text:"Answer"
        visible: keyBoard.visible
    }
    Item
    {
        id:input_bar
        x:30
        y:254+20+50
        width: 698
        height: 126
        visible: keyBoard.visible
        HMIButton
        {
            x:24-30
            y:518-254-150-128
            btnImg: (keyBoard.visible == true)?("qrc:MATERIAL/MATERIAL_M8X_SMS_BK_WIDE700"+bgImageStyle)
                                              :("qrc:MATERIAL/MATERIAL_M8X_SMS_BK_WIDE700_HIGH382"+bgImageStyle)
        }
        Flickable
        {
             id: flick
             x:0
             y:254-90-128-50
             width: 698
             height: 126
             flickableDirection:Flickable.VerticalFlick
             contentWidth: answerInput.paintedWidth
             contentHeight: answerInput.paintedHeight
             clip: true

             function ensureVisible(r)
             {
                 if (contentX >= r.x)
                     contentX = r.x;
                 else if (contentX+width <= r.x+r.width)
                     contentX = r.x+r.width-width;
                 if (contentY >= r.y)
                     contentY = r.y;
                 else if (contentY+height <= r.y+r.height)
                     contentY = r.y+r.height-height;
             }
             TextEdit
             {
                 id: answerInput
                 width: 698
                 height: answerInput.contentHeight//flick.height
                 focus: true
                 font.pixelSize: 24
                 color:"white"
                 cursorVisible:true
                 wrapMode: TextEdit.Wrap
                 onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
                 onLengthChanged:
                 {
                     if(length > 80)
                     {
                         console.debug("lengthlengthlengthlengthlengthlengthlengthlength")
                         remove(80, 82)
                     }
                 }
             }
         }
    }





    /*---------------------------------------------Key Board Start----------------------------------------*/
    HMIKeyBoard
        {
            id:keyBoard
            x:0
            y:380+60
            visible: false
            iSerach: false
            onVisibleChanged:
            {
                msglist.positionViewAtEnd()
            }
            onClickspell:
            {
                if(!keyBoard.isPinyin)
                    systemCtrl.setKeyPress(spell)
            }
        }

    /*---------------------------------------------Key Board Over----------------------------------------*/


    Image{
        id:answer_btn
        x:60
        y:822-128
        width: 124
        height: 66
        visible:!keyBoard.visible
        source:icon_Answer.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle)
                                  :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle)
        HMILabel{
            color: "white"
            font.pixelSize: 28
            horizontalAlignment:horizontalAlignment
            verticalAlignment: verticalAlignment
            anchors.fill: parent
            text: "Answer"
        }
        HMIMouseArea{
            id:icon_Answer
            anchors.fill: parent
            onClicked:
            {

                    keyBoard.visible = true
                icon_Send.visible = true
                answer_btn.visible = false
                input_bar.visible = true

            }
        }
    }

    HMIButton
    {
        id:icon_Send
        x:60
        y:822-128
        width: 124//100
        height: 66
        labelText: "Send"
        btnImg:icon_Send.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle)
                                :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle)
        visible: false
        onClicked:
        {

                console.log("[Carlink_Contacts_SMS_View]---------icon_Send clicked")
            carlinkCtrl.carLinkContactsMsgSend(answerInput.text);
            carlinkCtrl.setDiaSend(true);
                answerInput.text = ""
                keyBoard.visible = false
            input_bar.visible = false
            answer_btn.visible = true
            icon_Send.visible = false

        }
    }



    Connections
    {
        target: carlinkCtrl
        onCarLinkselectContactsmsgnameChanged://onCarlinkselectmsgnameChanged:
        {
            console.debug("[Carlink_Contacts_SMS_View.qml]---------------------------onCarLinkselectContactsmsgnameChanged")
            view_Name.text = carlinkCtrl.carlinkselectContactsmsgphone+"  "+carlinkCtrl.carlinkselectContactsmsgname//carlinkselectmsgname()

        }

        onSigMsgFailedChanged:
        {
            sms_failed.visible = ture
        }
        onSigIsDiaSendOkChanged:
        {
            console.debug("----------------------------------------")
            msglist.model=carlinkCtrl.getcarlinkContactsMsgDiaListModel()
        }

    }


}