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
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.2
import QtQuick.Layouts 1.1
import QtQuick.XmlListModel 2.0
import TalkSchedule 1.0
Rectangle {
id: homeScreenWindow
height: window.height - header.height
width: window.width
objectName: "homeScreen"
property var idx
property var ids
property int counter: 0
function linkForEntity(entity)
{
return (entity.url ? entity.url : entity.expanded_url)
}
function textForEntity(entity)
{
return (entity.display_url ? entity.display_url : entity.expanded_url)
}
function insertLinks(text, entities)
{
if (typeof text !== 'string')
return "";
if (!entities)
return text;
var links = []
links = entities.media ? entities.urls.concat(entities.media) : entities.urls
links.sort(function(a, b) { return b.indices[0] - a.indices[0] })
for (var i = 0; i < links.length; i++) {
var offset = links[i].url ? 0 : 1
text = text.substring(0, links[i].indices[0] + offset) +
'<a href=\"' + linkForEntity(links[i]) + '\">' +
textForEntity(links[i]) + '</a>' +
text.substring(links[i].indices[1])
}
return text.replace(/\n/g, '<br>');
}
Text {
visible: ModelsSingleton.conferenceId === ""
text: "Error: " + ModelsSingleton.errorMessage
anchors.centerIn: parent
font.pointSize: Theme.fonts.eight_pt
}
Column {
spacing: 0
visible: ModelsSingleton.conferenceId !== ""
Item {
// upcoming
id: upcomingItem
width: homeScreenWindow.width
height: homeScreenWindow.height / 3
property string visibleDate: ""
property string formatDate: "ddd d.MM"
SortFilterModel {
id: sortModelNextEvents
sortRole: "start"
filterRole: "fromNow"
maximumCount: 7
model: ModelsSingleton.eventModel
Component.onCompleted: {
if (sortModelNextEvents.rowCount() > 0)
upcomingItem.visibleDate = Qt.formatDate(sortModelNextEvents.get(0, "start"), upcomingItem.formatDate)
}
}
Text {
id: labelUpcoming
text: Theme.text.upcoming.arg(ModelsSingleton.conferenceTitle).arg(upcomingItem.visibleDate)
width: parent.width
height: Theme.sizes.homeTitleHeight
z: 1
font.pointSize: Theme.fonts.seven_pt
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.capitalization: Font.AllUppercase
Rectangle {
anchors.fill: parent
z: -1
color: Theme.colors.smokewhite
}
}
ListView {
id: homeScreenListView
anchors.top: labelUpcoming.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: Theme.margins.ten
model: sortModelNextEvents
clip: true
onVisibleChanged: {
if (visible) {
sortModelNextEvents.filter()
upcomingItem.visibleDate = Qt.formatDate(sortModelNextEvents.get(0, "start"), upcomingItem.formatDate)
}
}
spacing: Theme.margins.ten
delegate: RowLayout {
id: upcomingEventDelegate
width: parent.width
visible: Qt.formatDate(start, upcomingItem.formatDate) === upcomingItem.visibleDate
height: visible ? Theme.sizes.upcomingEventHeight : 0
Rectangle {
color: tracks.backgroundColor
Layout.fillHeight: true
Layout.preferredWidth: Theme.sizes.upcomingEventTimeWidth
Text {
anchors.fill: parent
anchors.leftMargin: Theme.margins.five
text: tracks.name
font.capitalization: Font.AllUppercase
color: Theme.colors.white
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pointSize: Theme.fonts.six_pt
}
}
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: mouseArea.pressed ? Theme.colors.smokewhite : Theme.colors.white
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: stack.push({
"item" : Qt.resolvedUrl("Event.qml"),
"properties" : {"eventId" : id}
})
}
ColumnLayout {
anchors.fill: parent
anchors.leftMargin: Theme.margins.twenty
Text {
Layout.fillWidth: true
text: topic
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
font.pointSize: Theme.fonts.seven_pt
}
Text {
Layout.fillWidth: true
text: Qt.formatTime(start, Qt.locale().timeFormat(Locale.ShortFormat)) + Theme.text.room_space.arg(location)
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
font.pointSize: Theme.fonts.seven_pt
color: Theme.colors.gray
}
}
}
}
}
}
Item {
// news
width: window.width
height: homeScreenWindow.height / 3
TweetModel {
id: tweetModel
}
Text {
id: labelNews
z: 1
text: Theme.text.news
width: parent.width
height: Theme.sizes.homeTitleHeight
font.pointSize: Theme.fonts.seven_pt
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.capitalization: Font.AllUppercase
Rectangle {
anchors.fill: parent
z: -1
color: Theme.colors.smokewhite
}
Image {
id: reloadNews
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Theme.margins.ten
source: Theme.images.loading
}
MouseArea {
anchors.fill: reloadNews
onClicked: tweetModel.reload()
}
}
Component {
id: tweetDelegate
Rectangle {
color: Theme.colors.smokewhite
height: tweetArea.height
width: window.width
Image {
id: placeHolder
anchors.verticalCenter: parent.verticalCenter
source: Theme.images.anonymous
visible: avatar.status != Image.Ready
}
Image {
id: avatar
anchors.fill: placeHolder
source: model.user.profile_image_url
}
Item {
id: tweetArea
width: parent.width - avatar.width
height: childrenRect.height
anchors.left: avatar.right
Text {
id: userName
anchors.left: parent.left
anchors.leftMargin: Theme.margins.ten
text: "<b>" + model.user.name + "</b>"
}
Text {
id: userScreenName
anchors.left: userName.right
anchors.leftMargin: Theme.margins.ten
text: "@" + model.user.screen_name
}
Text {
id: tweetContent
anchors.left: parent.left
anchors.top: userName.bottom
anchors.leftMargin: Theme.margins.ten
anchors.rightMargin: Theme.margins.ten
width: parent.width - Theme.margins.twenty
text: insertLinks(model.text, model.entities)
wrapMode: Text.WordWrap
textFormat: Text.RichText
onLinkActivated: Qt.openUrlExternally(link)
}
}
}
}
ListView {
id: listNews
anchors.top: labelNews.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Theme.margins.ten
clip: true
spacing: Theme.margins.ten
model: tweetModel.model
delegate: tweetDelegate
}
}
Item {
// useful info
// Todo: Content
width: window.width
height: homeScreenWindow.height / 3
Text {
id: labelInfo
z: 1
text: Theme.text.info
width: parent.width
height: Theme.sizes.homeTitleHeight
font.pointSize: Theme.fonts.seven_pt
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.capitalization: Font.AllUppercase
Rectangle {
anchors.fill: parent
z: -1
color: Theme.colors.smokewhite
}
}
Row {
anchors.top: labelInfo.bottom
spacing: Theme.margins.twenty
Image {
source: Theme.images.btnVenueMap
sourceSize.height: Theme.sizes.infoButtonSize
sourceSize.width: Theme.sizes.infoButtonSize
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("http://www.qtdeveloperdays.com/sites/default/files/files/bcc_map.pdf")
}
}
Image {
source: Theme.images.btnHotels
sourceSize.height: Theme.sizes.infoButtonSize
sourceSize.width: Theme.sizes.infoButtonSize
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("http://www.qtdeveloperdays.com/sites/default/files/files/bcc_hotels.pdf")
}
}
Image {
source: Theme.images.btnRestaurants
sourceSize.height: Theme.sizes.infoButtonSize
sourceSize.width: Theme.sizes.infoButtonSize
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("https://www.qtdeveloperdays.com/sites/default/files/files/BerlinAlexanderplatzRestaurants_1.pdf")
}
}
}
}
}
}
|