Merge lp:~arashbm/cliffhanger/empty-fields into lp:~flashback-dev/cliffhanger/trunk
- empty-fields
- Merge into trunk
Proposed by
Arash Badie Modiri
Status: | Merged |
---|---|
Merged at revision: | 15 |
Proposed branch: | lp:~arashbm/cliffhanger/empty-fields |
Merge into: | lp:~flashback-dev/cliffhanger/trunk |
Diff against target: |
409 lines (+71/-47) 12 files modified
models/Movie.qml (+10/-10) models/Person.qml (+5/-5) models/PersonCast.qml (+4/-4) models/PersonCrew.qml (+5/-4) models/Season.qml (+5/-5) models/Show.qml (+6/-7) models/ShowSeasons.qml (+2/-1) ui/MoviePage.qml (+9/-2) ui/PersonPage.qml (+5/-2) ui/SeasonPage.qml (+4/-1) ui/TvPage.qml (+14/-4) ui/TvSeasons.qml (+2/-2) |
To merge this branch: | bzr merge lp:~arashbm/cliffhanger/empty-fields |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Nekhelesh Ramananthan | Approve | ||
Review via email: mp+196620@code.launchpad.net |
Commit message
Description of the change
this mp fixes the following:
* empty fields now hide whenever possible (fixes #1253039)
* fixes a problem with PersonCast, PersonCrew and ui/PersonPage which prevented TV shows from viewing and linking correctly
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'models/Movie.qml' |
2 | --- models/Movie.qml 2013-11-20 10:58:27 +0000 |
3 | +++ models/Movie.qml 2013-11-25 20:49:29 +0000 |
4 | @@ -9,9 +9,9 @@ |
5 | 'tagline': '', |
6 | 'overview': '', |
7 | 'releaseDate': '', |
8 | - 'runtime': '', |
9 | - 'voteAverage': '', |
10 | - 'voteCount': '', |
11 | + 'runtime': 0, |
12 | + 'voteAverage': 0.0, |
13 | + 'voteCount': 0, |
14 | 'genres': [], |
15 | 'thumb_url': '' |
16 | } |
17 | @@ -21,13 +21,13 @@ |
18 | attributes = { |
19 | 'id': ob.id, |
20 | 'title': ob.title, |
21 | - 'homepage': ob.homepage, |
22 | - 'tagline': ob.tagline, |
23 | - 'overview': ob.overview, |
24 | - 'releaseDate': ob.release_date, |
25 | - 'runtime': ob.runtime, |
26 | - 'voteAverage': ob.vote_average, |
27 | - 'voteCount': ob.vote_count, |
28 | + 'homepage': (ob.homepage || "") , |
29 | + 'tagline': (ob.tagline || ""), |
30 | + 'overview': (ob.overview || ""), |
31 | + 'releaseDate': (ob.release_date || ""), |
32 | + 'runtime': parseInt(ob.runtime), |
33 | + 'voteAverage': parseFloat(ob.vote_average), |
34 | + 'voteCount': parseInt(ob.vote_count), |
35 | 'genres': ob.genres, |
36 | 'thumb_url': thumbnail_url(ob.poster_path, "movie"), |
37 | 'creditsJson': JSON.stringify(ob.credits || {}), |
38 | |
39 | === modified file 'models/Person.qml' |
40 | --- models/Person.qml 2013-11-20 10:58:27 +0000 |
41 | +++ models/Person.qml 2013-11-25 20:49:29 +0000 |
42 | @@ -18,11 +18,11 @@ |
43 | attributes = { |
44 | 'id': ob.id, |
45 | 'name': ob.name, |
46 | - 'biography': ob.biography, |
47 | - 'birthday': ob.birthday, |
48 | - 'deathday': ob.deathday, |
49 | - 'homepage': ob.homepage, |
50 | - 'placeOfBirth': ob.place_of_birth, |
51 | + 'biography': ob.biography || "", |
52 | + 'birthday': ob.birthday || "", |
53 | + 'deathday': ob.deathday || "", |
54 | + 'homepage': ob.homepage || "", |
55 | + 'placeOfBirth': ob.place_of_birth || "", |
56 | 'thumb_url': thumbnail_url(ob.profile_path, "person"), |
57 | 'combinedCreditsJson': JSON.stringify(ob.combined_credits || {}) |
58 | }; |
59 | |
60 | === modified file 'models/PersonCast.qml' |
61 | --- models/PersonCast.qml 2013-11-20 10:58:27 +0000 |
62 | +++ models/PersonCast.qml 2013-11-25 20:49:29 +0000 |
63 | @@ -11,11 +11,11 @@ |
64 | var jo = objectArray[key]; |
65 | model.append({ |
66 | 'id': jo.id, |
67 | - 'title': jo.title, |
68 | - 'character': jo.character, |
69 | - 'releaseDate': jo.release_date, |
70 | + 'title': jo.title || jo.name || "", |
71 | + 'character': jo.character || "", |
72 | + 'releaseDate': jo.release_date || "", |
73 | 'mediaType': jo.media_type, |
74 | - 'thumb_url': thumbnail_url(jo.profile_path, "person") |
75 | + 'thumb_url': thumbnail_url(jo.poster_path, "person") |
76 | }); |
77 | } |
78 | } |
79 | |
80 | === modified file 'models/PersonCrew.qml' |
81 | --- models/PersonCrew.qml 2013-11-20 10:58:27 +0000 |
82 | +++ models/PersonCrew.qml 2013-11-25 20:49:29 +0000 |
83 | @@ -10,11 +10,12 @@ |
84 | var jo = objectArray[key]; |
85 | model.append({ |
86 | 'id': jo.id, |
87 | - 'title': jo.title, |
88 | - 'department': jo.department, |
89 | - 'releaseDate': jo.release_date, |
90 | + 'title': jo.title || jo.name || "", |
91 | + 'department': jo.department || "", |
92 | + 'job': jo.job || "", |
93 | + 'releaseDate': jo.release_date || "", |
94 | 'mediaType': jo.media_type, |
95 | - 'thumb_url': thumbnail_url(jo.profile_path, "person") |
96 | + 'thumb_url': thumbnail_url(jo.poster_path, "person") |
97 | }); |
98 | } |
99 | } |
100 | |
101 | === modified file 'models/Season.qml' |
102 | --- models/Season.qml 2013-11-20 12:24:35 +0000 |
103 | +++ models/Season.qml 2013-11-25 20:49:29 +0000 |
104 | @@ -6,17 +6,17 @@ |
105 | property variant attributes: { |
106 | 'name': '', |
107 | 'overview': '', |
108 | - 'air_date': '', |
109 | + 'airDate': '', |
110 | 'thumb_url': '' |
111 | } |
112 | |
113 | function updateJSONModel() { |
114 | var ob = JSON.parse(json); |
115 | attributes = { |
116 | - 'id': ob.id, |
117 | - 'name': ob.name, |
118 | - 'overview': ob.overview, |
119 | - 'air_date': ob.air_date, |
120 | + 'id': ob.id || "", |
121 | + 'name': ob.name || "", |
122 | + 'overview': ob.overview || "", |
123 | + 'airDate': ob.air_date || "", |
124 | 'thumb_url': thumbnail_url(ob.poster_path, "show"), |
125 | 'episodesJson': JSON.stringify(ob.episodes || {}) |
126 | }; |
127 | |
128 | === modified file 'models/Show.qml' |
129 | --- models/Show.qml 2013-11-20 11:37:49 +0000 |
130 | +++ models/Show.qml 2013-11-25 20:49:29 +0000 |
131 | @@ -9,10 +9,9 @@ |
132 | 'overview': '', |
133 | 'first_air_date': '', |
134 | 'episode_run_time': [], |
135 | - 'voteAverage': '', |
136 | - 'voteCount': '', |
137 | - 'in_production': '', |
138 | - 'number_of_seasons': '', |
139 | + 'voteAverage': 0.0, |
140 | + 'voteCount': 0, |
141 | + 'number_of_seasons': 0, |
142 | 'networks': [], |
143 | 'genres': [], |
144 | 'thumb_url': '' |
145 | @@ -27,10 +26,10 @@ |
146 | 'overview': ob.overview, |
147 | 'first_air_date': ob.first_air_date, |
148 | 'episode_run_time': ob.episode_run_time, |
149 | - 'voteAverage': ob.vote_average, |
150 | - 'voteCount': ob.vote_count, |
151 | + 'voteAverage': parseFloat(ob.vote_average), |
152 | + 'voteCount': parseInt(ob.vote_count), |
153 | 'in_production': ob.in_production, |
154 | - 'number_of_seasons': ob.number_of_seasons, |
155 | + 'number_of_seasons': parseInt(ob.number_of_seasons), |
156 | 'networks': ob.networks, |
157 | 'genres': ob.genres, |
158 | 'thumb_url': thumbnail_url(ob.poster_path, "show"), |
159 | |
160 | === modified file 'models/ShowSeasons.qml' |
161 | --- models/ShowSeasons.qml 2013-11-20 11:37:49 +0000 |
162 | +++ models/ShowSeasons.qml 2013-11-25 20:49:29 +0000 |
163 | @@ -10,7 +10,8 @@ |
164 | for ( var key in objectArray ) { |
165 | var jo = objectArray[key]; |
166 | model.append({ |
167 | - 'name': "Season " + jo.season_number, |
168 | + 'seasonNumber': parseInt(jo.season_number), |
169 | + 'airDate': jo.air_date || "", |
170 | 'thumb_url': thumbnail_url(jo.poster_path, "show") |
171 | }); |
172 | } |
173 | |
174 | === modified file 'ui/MoviePage.qml' |
175 | --- ui/MoviePage.qml 2013-11-22 15:50:53 +0000 |
176 | +++ ui/MoviePage.qml 2013-11-25 20:49:29 +0000 |
177 | @@ -104,6 +104,7 @@ |
178 | Label { |
179 | id: overview |
180 | text: movie.attributes.overview |
181 | + visible: movie.attributes.overview |
182 | fontSize: "medium" |
183 | width: movieColumn.width |
184 | height: movieColumn.height/2 |
185 | @@ -121,13 +122,14 @@ |
186 | image: Qt.resolvedUrl("../graphics/calendar.png") |
187 | size: units.gu(2) |
188 | label: movie.attributes.releaseDate.split('-')[0] |
189 | + visible: movie.attributes.releaseDate |
190 | } |
191 | |
192 | ImageLabel { |
193 | image: Qt.resolvedUrl("../graphics/duration.png") |
194 | size: units.gu(2) |
195 | label: movie.attributes.runtime + " minutes" |
196 | - visible: movie.attributes.runtime != '0' |
197 | + visible: movie.attributes.runtime > 0 |
198 | } |
199 | } |
200 | } |
201 | @@ -143,7 +145,9 @@ |
202 | } |
203 | |
204 | image: Qt.resolvedUrl("../graphics/star.png") |
205 | - label: JSON.stringify(movie.attributes.voteAverage).substring(0,3) + "\n" + movie.attributes.voteCount |
206 | + // minimum acceptable number of votes, currently set to 1 |
207 | + visible: movie.attributes.voteCount > 0 |
208 | + label: movie.attributes.voteAverage.toFixed()+"\n"+movie.attributes.voteCount |
209 | } |
210 | |
211 | // Movie Details - Release dates, genre, movie theme etc. |
212 | @@ -162,12 +166,14 @@ |
213 | id: genres |
214 | text: "Genres" |
215 | subText: movie.attributes.genres.map(function(o) { return o.name }).join(', ') |
216 | + visible: movie.attributes.genres.length > 0 |
217 | } |
218 | |
219 | Subtitled { |
220 | id: releaseDate |
221 | text: "Release Date" |
222 | subText: movie.attributes.releaseDate |
223 | + visible: movie.attributes.releaseDate |
224 | } |
225 | |
226 | Subtitled { |
227 | @@ -219,6 +225,7 @@ |
228 | Carousel { |
229 | id: similarMovies |
230 | dataModel: similarMoviesModel.model |
231 | + visible: similarMoviesModel.count > 0 |
232 | header: i18n.tr("Similar Movies") |
233 | onThumbClicked: pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": model.id}) |
234 | } |
235 | |
236 | === modified file 'ui/PersonPage.qml' |
237 | --- ui/PersonPage.qml 2013-11-16 20:52:42 +0000 |
238 | +++ ui/PersonPage.qml 2013-11-25 20:49:29 +0000 |
239 | @@ -89,6 +89,7 @@ |
240 | Label { |
241 | id: birthPlace |
242 | text: person.attributes.placeOfBirth |
243 | + visible: person.attributes.placeOfBirth |
244 | fontSize: "medium" |
245 | width: personColumn.width |
246 | elide: Text.ElideRight |
247 | @@ -118,6 +119,7 @@ |
248 | Label { |
249 | id: contact |
250 | text: person.attributes.homepage |
251 | + visible: person.attributes.homepage |
252 | fontSize: "medium" |
253 | width: personColumn.width |
254 | elide: Text.ElideRight |
255 | @@ -134,6 +136,7 @@ |
256 | Label { |
257 | id: biography |
258 | text: person.attributes.biography |
259 | + visible: person.attributes.biography |
260 | anchors { |
261 | top: personColumn.bottom |
262 | left: parent.left |
263 | @@ -176,7 +179,7 @@ |
264 | icon: thumb_url |
265 | text: title |
266 | subText: character |
267 | - onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie") |
268 | + onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : pageStack.push(Qt.resolvedUrl("TvPage.qml"), {"tv_id": id}) |
269 | } |
270 | } |
271 | |
272 | @@ -200,7 +203,7 @@ |
273 | icon: thumb_url |
274 | text: title |
275 | subText: department |
276 | - onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie") |
277 | + onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : pageStack.push(Qt.resolvedUrl("TvPage.qml"), {"tv_id": id}) |
278 | } |
279 | } |
280 | } |
281 | |
282 | === modified file 'ui/SeasonPage.qml' |
283 | --- ui/SeasonPage.qml 2013-11-21 11:11:54 +0000 |
284 | +++ ui/SeasonPage.qml 2013-11-25 20:49:29 +0000 |
285 | @@ -76,6 +76,7 @@ |
286 | maximumLineCount: 2 |
287 | elide: Text.ElideRight |
288 | wrapMode: Text.WordWrap |
289 | + visible: season.attributes.name |
290 | } |
291 | |
292 | Label { |
293 | @@ -90,6 +91,7 @@ |
294 | anchors.fill: parent |
295 | onClicked: pageStack.push(Qt.resolvedUrl("SummaryPage.qml"), {"overlayTitle": "Summary", "summary": season.attributes.overview, "background": thumb.source}) |
296 | } |
297 | + visible: season.attributes.overview |
298 | } |
299 | |
300 | Column { |
301 | @@ -97,7 +99,8 @@ |
302 | ImageLabel { |
303 | image: Qt.resolvedUrl("../graphics/calendar.png") |
304 | size: units.gu(2) |
305 | - label: season.attributes.air_date.split('-')[0] |
306 | + label: season.attributes.airDate.split('-')[0] |
307 | + visible: season.attributes.airDate |
308 | } |
309 | } |
310 | } |
311 | |
312 | === modified file 'ui/TvPage.qml' |
313 | --- ui/TvPage.qml 2013-11-22 15:50:53 +0000 |
314 | +++ ui/TvPage.qml 2013-11-25 20:49:29 +0000 |
315 | @@ -118,28 +118,33 @@ |
316 | Column { |
317 | spacing: units.gu(1) |
318 | ImageLabel { |
319 | + id: networks |
320 | image: Qt.resolvedUrl("../graphics/network.png") |
321 | size: units.gu(2) |
322 | label: show.attributes.networks.map(function(o) { return o.name }).join(', ') |
323 | + visible: show.attributes.networks.length > 0 |
324 | } |
325 | |
326 | ImageLabel { |
327 | + id: firstAir |
328 | image: Qt.resolvedUrl("../graphics/calendar.png") |
329 | size: units.gu(2) |
330 | label: show.attributes.first_air_date.split('-')[0] |
331 | + visible: show.attributes.first_air_date != '' |
332 | } |
333 | |
334 | ImageLabel { |
335 | image: Qt.resolvedUrl("../graphics/list.png") |
336 | size: units.gu(2) |
337 | label: show.attributes.number_of_seasons + " Seasons" |
338 | + visible: show.attributes.number_of_seasons > 0 |
339 | } |
340 | |
341 | ImageLabel { |
342 | image: Qt.resolvedUrl("../graphics/duration.png") |
343 | size: units.gu(2) |
344 | label: show.attributes.episode_run_time[0] + " minutes" |
345 | - visible: show.attributes.episode_run_time[0] != '0' |
346 | + visible: (show.attributes.episode_run_time.length > 0 && show.attributes.episode_run_time[0] != '0') |
347 | } |
348 | } |
349 | } |
350 | @@ -155,7 +160,9 @@ |
351 | } |
352 | |
353 | image: Qt.resolvedUrl("../graphics/star.png") |
354 | - label: JSON.stringify(show.attributes.voteAverage).substring(0,3) + "\n" + show.attributes.voteCount |
355 | + label: show.attributes.voteAverage.toFixed()+"\n"+show.attributes.voteCount |
356 | + // minimum acceptable number of votes, currently set to 1 |
357 | + visible: show.attributes.voteCount > 0 |
358 | } |
359 | |
360 | UbuntuShape { |
361 | @@ -165,7 +172,7 @@ |
362 | right: parent.right |
363 | rightMargin: units.gu(2) |
364 | } |
365 | - color: status.text === "<b>Continuing</b>" ? "#27AE60" : "#C0392B" |
366 | + color: show.attributes.in_production ? "#27AE60" : "#C0392B" |
367 | width: units.gu(10) |
368 | height: ratingsRow.height |
369 | |
370 | @@ -177,7 +184,8 @@ |
371 | } |
372 | text: show.attributes.in_production ? "<b>Continuing</b>" : "<b>Ended</b>" |
373 | } |
374 | - } |
375 | + visible: show.attributes.in_production !== undefined |
376 | + } |
377 | |
378 | // Tv Details - Release dates, genre, movie theme etc. |
379 | Column { |
380 | @@ -195,12 +203,14 @@ |
381 | id: genres |
382 | text: "Genres" |
383 | subText: show.attributes.genres.map(function(o) { return o.name }).join(', ') |
384 | + visible: show.attributes.genres.length > 0 |
385 | } |
386 | |
387 | Subtitled { |
388 | id: releaseDate |
389 | text: "First Air Date" |
390 | subText: show.attributes.first_air_date |
391 | + visible: show.attributes.first_air_date |
392 | } |
393 | |
394 | Header { text: "Casts" } |
395 | |
396 | === modified file 'ui/TvSeasons.qml' |
397 | --- ui/TvSeasons.qml 2013-11-20 12:24:35 +0000 |
398 | +++ ui/TvSeasons.qml 2013-11-25 20:49:29 +0000 |
399 | @@ -38,9 +38,9 @@ |
400 | clip: true |
401 | |
402 | delegate: Standard { |
403 | - text: name |
404 | + text: seasonNumber == 0 ? "Season Specials" : "Season " + seasonNumber |
405 | icon: thumb_url |
406 | - onClicked: pageStack.push(Qt.resolvedUrl("SeasonPage.qml"), {"tv_id": tv_id, "season_number": name.split(' ')[1]}) |
407 | + onClicked: pageStack.push(Qt.resolvedUrl("SeasonPage.qml"), {"tv_id": tv_id, "season_number": seasonNumber}) |
408 | } |
409 | } |
410 |
nice work! It now works more reliably thanks to your effort!