summaryrefstree
path: root/usr/bin/qml/Carlink/CarLink_ChatInteraction.qml
blob: fd97e5b75a5e84045d5a71addae11f3a91187d2b (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
import QtQuick 2.0
import "../com/neusoft/auto/widgets"
import "../eventsList.js" as EventsList
import "../layoutList.js" as Layout
import "../windowsList.js" as WindowsList
import Label 2.0

HMIWindow{
    id:main_window

    property int pyeventx: 15

    Component.onCompleted:
    {
        windowID = WindowsList.CARLINK_CHATINTERACTION
    }

    onVisibleChanged:
    {
        bMainWindow = false
        msg_list.model = carlinkCtrl.getAutoGroupList();
    }

    HMILabel {
        id : text_titled
        x : 51 -pyeventx
        y : 148-131
        height : 27
		width :  250
        font.pixelSize:27
        horizontalAlignment: Label.AlignLeft
        text : qsTr("AutoGroup")+systemCtrl.emptyString
	}

    HMIButton{
            id:back
            x:689 -pyeventx
            y:151-131
            width:31
            height:21
            btnImg:back.pressed?"qrc:MATERIAL/MATERIAL_M8X_ICON_BACK_P"+bgImageStyle
                            :"qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle
            onClicked: {
                ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_MAIN)
            }
    }
    HMIButton{
            id : clean
            x:630 -pyeventx
            y:193-131
            labelText: qsTr("Clear")+systemCtrl.emptyString
            labelPixelSize: 23
            btnImg:clean.pressed ?"qrc:MATERIAL/MATERIAL_M8X_POPUP_BUTTON_PUSHED"+bgImageStyle
                                               :"qrc:MATERIAL/MATERIAL_M8X_POPUP_BUTTON"+bgImageStyle
            onClicked: {
                if ( carlinkCtrl.getAllMsgCount() !== 0){
                     pop.popvisible = true;
                }
            }
    }

    Component{
		id:model_delegate   	
		Item{
            x:0
            y:0
            height:62
            width:700

            HMIButton{
                id : itemBtn
                btnImg:itemBtn.pressed? "qrc:MATERIAL/MATERIAL_M8X_LIST_P"+bgImageStyle
                                                           : "qrc:MATERIAL/MATERIAL_M8X_LIST"+bgImageStyle

                Image                //head portrait
                {
                    x:9; y:8
                    sourceSize.height:46
                    sourceSize.width:46
                    //source: "qrc:MATERIAL/MATERIAL_M8X_DEFAULT_AVATAR"+bgImageStyle
                    source:model.modelData.Icon_Path
                }

                Image
                {
                    x:4 ; y:3
                    source: "qrc:MATERIAL/MATERIAL_M8X_LIST_DEFAULT_UNREAD_1"+bgImageStyle
                    visible: model.modelData.Unread ==="0"?false:true
                }

                HMILabel         //friend nickname
                {
                    id : f_name
                    x:65 ; y:262-254
                    width:200 ; height:28
                    font.pixelSize:20
                    horizontalAlignment: Label.AlignLeft
                    text:model.modelData.User_Name
                }

                HMILabel        //friend message
                {
                    id : message
                    x:99-34 ; y: 292-254
                    height:18 ; width:280
                    font.pixelSize:13
                    elide: message.contentWidth >280?Label.ElideRight:Label.ElideNone
                    horizontalAlignment: Label.AlignLeft
                    text : (model.modelData.Msg_Type==="1")? model.modelData.Msg_Content:
                                                              (model.modelData.Msg_Type==="2")?"[语音]":
                                                              (model.modelData.Msg_Type==="3")?"[图片]":
                                                              ""
                }
                HMILabel
                {
                    id: msg_time
                    x : 401-34 ; y:263-254
                    height:16 ; width:199
                    font.pixelSize:16
                    horizontalAlignment: Label.AlignRight
                    text : model.modelData.Msg_Date
                }
                HMIButton{
                    id:del
                    x:630-34 ; y:257-254
                    labelText: qsTr("Delete")+systemCtrl.emptyString
                    labelPixelSize: 23
                    btnImg:del.pressed?"qrc:MATERIAL/MATERIAL_M8X_POPUP_BUTTON_PUSHED"+bgImageStyle
                                    :"qrc:MATERIAL/MATERIAL_M8X_POPUP_BUTTON"+bgImageStyle
                    onClicked: {
                        carlinkCtrl.deleteMsgforId(index, model.modelData.User_Id);
                    }
                }
                onClicked: {

                    carlinkCtrl.updateMsgTblforReaded(model.modelData.User_Id);
                    if ("1"=== model.modelData.User_Type){
                        carlinkCtrl.selAutoGroupListforId(model.modelData.User_Id);
                    }
                    else if ("3" === model.modelData.User_Type ){
                        carlinkCtrl.selAutoGroupListforGroup(model.modelData.User_Id);
                    }
                    else{
                        //do nothing
                    }

                    carlinkCtrl.setCurrentUseId(model.modelData.User_Id);
                    carlinkCtrl.setCurrentDialogId(model.modelData.User_Id);
                    carlinkCtrl.setCurrentDialogName(model.modelData.User_Name);
                    carlinkCtrl.setCurrentDialogtype(model.modelData.User_Type);

                    ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_DIALOGBOX)
                    ScreenManager.changeForm(Layout.FM_CLOSE,windowID)
                }
            }
        }
    }

    HMIListView{
        id:msg_list
        x:34 -pyeventx
        y:254-131
        width: 700+20
        height: bMaxWindow?580:62*3
        model: carlinkCtrl.getAutoGroupList();
        delegate: model_delegate
        spacing: 2
        showBar:true
        scrollBar:true
    }
    HMIButton{
        id:chat_interaction
        x:70-pyeventx
        y:bMaxWindow?828-131-3:444-131-3
        labelPixelSize:23
        labelText: qsTr("Chats")+systemCtrl.emptyString
        btnImg:chat_interaction.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle
                                                            :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_C"+bgImageStyle
    }
    HMIButton{
        id:auto_list
        x:192-pyeventx
        y:bMaxWindow?828-131-3:444-131-3
        labelPixelSize:23
        labelText: qsTr("Contacts")+systemCtrl.emptyString
        btnImg:auto_list.pressed?"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4_P"+bgImageStyle
                        :"qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_4"+bgImageStyle
        onClicked: {
            ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_MYLIST)
        }
    }
    
    CarLink_AutoGrpPop{
        id : pop
        popimageY : bMaxWindow ? 424-131 : 65
        mask_height : bMaxWindow ? 695 : 310
        pop_tex:"Are you sure to clear the chats?"
        popvisible : false
        pop_type:1
    }
    Connections {
        target: carlinkCtrl
        onSigAutoGroupMsgListChanged : {
            console.log("autogrouplist  changed---------->>>")
            msg_list.model = carlinkCtrl.getAutoGroupList();
        }
        onSigAutoGroupMsgListReceiveUpdate : {
            console.log("auto group MsgRecv  changed---------->>>")
            msg_list.model = carlinkCtrl.getAutoGroupListForUpdate();
        }
    }
}