blob: 7ffb4c9470d84d53ee843cccfbf7c24a9f2e2f7c (
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
|
import QtQuick 2.0
import "../AppLink/Com"
import "../windowsList.js" as WindowsList
import "../layoutList.js" as Layout
import "../AppLink/settingLib.js" as SettingsType
HMIWindow
{
id: news_NewsClass
property bool bConnected : false//true
property bool bLoading : true //true,good false,bad
property bool bNeedReflesh:false
property int iShowTip: 0
title:qsTr("新闻") + applinkControl.qsEmptyString
//windowImgSource:imagePath + "M8X_full-screen_bk.png"
onVisibleChanged:{
if(news_NewsClass.visible == true)
{
applinkControl.QML_NotifyAppLinkDisplayOK()
bNeedReflesh = false
gridview.height = 800
applinkControl.QML_NIF_NET_DeleteImage()
if(!applinkControl.QML_GetNewsChannelcount()||gridview.model == "")
{
bLoading = true
bConnected = false
}
}
//gridview.model = applinkControl.news_GetchannelListModel
}
onSignal_returnClick:{
//applinkControl.QML_RemoveNewsChannel()
applinkControl.QML_NIF_NET_CancelRequest()
gridview.model = ""
ScreenManager.backward(Layout.APPLINK,WindowsList.APP_HOME)
}
Item {
visible:!bConnected && !bLoading
anchors.left: parent.left
anchors.leftMargin: 65
anchors.top: parent.top
anchors.topMargin: 81
width:830+10
height:1041-81//598+10+142+10
HMILabel{
id:lablereflesh
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
font.pixelSize: 26
text: qsTr("正在刷新,请稍候…") + applinkControl.qsEmptyString
width:SettingsType.SETTING_CONTENT_W
height:SettingsType.SETTING_CONTENT_Y
color: "white"
clip:true
visible: bNeedReflesh
}
/*HMILabel{
id:lablereflesh1
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
font.pixelSize: 26
text: "下拉可刷新"
width:SettingsType.SETTING_CONTENT_W
height:SettingsType.SETTING_CONTENT_Y
color: "white"
clip:true
visible: iShowTip == 1
z:-1
}
HMILabel{
id:lablereflesh2
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
font.pixelSize: 26
text: "松开以刷新"
width:SettingsType.SETTING_CONTENT_W
height:SettingsType.SETTING_CONTENT_Y
color: "white"
clip:true
visible: iShowTip == 2
z: -1
}*/
GridView{
id: gridview
clip: true
//anchors.fill: parent
anchors.top: parent.top
anchors.topMargin: bNeedReflesh ? SettingsType.SETTING_CONTENT_Y : 0
anchors.left: parent.left
anchors.leftMargin: 0//SettingsType.SETTING_CONTENT_X
cellWidth: 270+10
cellHeight: 142+10
width: 840
height: bNeedReflesh ? 1041-81-80:1041-81//720 : 800
snapMode:GridView.SnapOneRow
delegate:settinglistdelegate
boundsBehavior: Flickable.DragAndOvershootBounds
//model:channelslistmodel
onDragEnded: {
// 下拉刷新判断逻辑:已经到头了,还下拉一定距离
if (contentY < originY){
var dy = contentY - originY
if (dy < -80){
if(false == bNeedReflesh){
iShowTip = 0
bNeedReflesh = true
applinkControl.QML_NIF_NEWS_RequestNewsChannels()
}
}
}
}
onContentYChanged: {
if (contentY < originY){
var dy = contentY - originY
if (dy < -80){
iShowTip = 2
}
}
}
}
Component{
id:settinglistdelegate
Item{
width:gridview.cellWidth-10//270
height:gridview.cellHeight-10//142
HMIButton{
id:cell_id
btnImg: imagePath + "Common/M8X_Button_h142_w270.png"
btnImgOnPressed: imagePath + "Common/M8X_Button_h142_w270_p.png"
HMILabel{
id:cell_name
x: 5
y: 58
height: 26
width: 260
font.pixelSize: 26
text: col0
clip:true
}
onClicked: {
//console.log("---------lvchangxin------------------------------",index);
applinkControl.QML_NIF_NEWS_RequestNewsDetail(index,1)
ScreenManager.forward(Layout.APPLINK,WindowsList.APP_NEWSLIST)
}
}
}
}
HMIListViewBar{
id: listViewBar
anchors.left: gridview.right
anchors.leftMargin: 16
anchors.top: gridview.top
height: gridview.height
listView:gridview
scrollBarX:x
scrollBarY:y
visible: gridview.count<=15?false:true
clip:true
}
}
//底部动能栏
Row{
id: functionArea
y:1041-160
HMIButton{
id: quitBtn
btnImgOnPressed: imagePath +"Common/M8X_Function_close_Button_p.png"
btnImg: imagePath+"Common/M8X_Function_close_Button.png"
btnIcon: imagePath+"Common/M8X_icon_close.png"
onClicked:{
applinkControl.QML_CloseAppLink()
//ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.APP_NEWSCLASS)
}
}
HMIButton{
id: nosw
enabled: false
btnImgOnPressed: imagePath +"M8X_Function_1_Button_NoSwitch_p.png"
btnImg: imagePath+"M8X_Function_1_Button_NoSwitch.png"
}
}
App_HMILoadFailed{
visible:bConnected
imagePath: news_NewsClass.imagePath
onSignal_refreshClick:{
//bConnected = !bConnected //just a test
bLoading = true
bConnected = false
applinkControl.QML_NIF_NEWS_RequestNewsChannels()
}
}
App_Loading{
id:loadingIcon
loadingPath: imagePath+"Common/Loading_60/"
surname: "M8X_Loading_60_"
anchors.horizontalCenter:parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 450
visible:bLoading
}
Connections{
target:applinkControl
onSignal_GetChannelsDataEnd:{
if(news_NewsClass.visible == true)
{
//console.log("-----qml--------lvchangxin----------------onSignal_GetChannelsDataEnd----------------")
bNeedReflesh = false
gridview.model = applinkControl.news_GetchannelListModel
bLoading = false
bConnected = false
//applinkControl.QML_NIF_NET_GetImage("http://n.sinaimg.cn/news/transform/20161026/ojfu-fxwztru7195793.jpg", 67)
//applinkControl.QML_NIF_NET_GetImage("http://fdfs.xmcdn.com/group12/M0A/23/9B/wKgDW1bqDkaxrMLjAASp9W8aGkc534_web_meduim.jpg", 85)
}
}
onSignal_GetChannelsDataNoRes:{
if(news_NewsClass.visible == true)
{
//console.log("-----qml--------lvchangxin----------------onSignal_GetChannelsDataNoRes----------------")
bNeedReflesh = false
bLoading = false
bConnected = true
}
}
}
}
|