Merge lp:~michihenning/unity-scopes-api/doc-fix into lp:unity-scopes-api/devel

Proposed by Michi Henning
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 654
Merged at revision: 652
Proposed branch: lp:~michihenning/unity-scopes-api/doc-fix
Merge into: lp:unity-scopes-api/devel
Diff against target: 49 lines (+9/-5)
2 files modified
src/scopes/CategoryRenderer.cpp (+6/-2)
src/scopes/PreviewWidget.cpp (+3/-3)
To merge this branch: bzr merge lp:~michihenning/unity-scopes-api/doc-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Paweł Stołowski (community) Approve
Review via email: mp+283001@code.launchpad.net

Commit message

Doc updates to clarify semantics of fallback images.

Description of the change

Doc updates to clarify semantics of fallback images.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

"If a result does not specify a fallback image and the actual image is empty or cannot be loaded, Unity substitutes a generic fallback image."

We don't do that at the moment, i.e. we just show nothing, but one could argue that the "no image" is our "generic fallback image" for the moment :D

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
654. By Michi Henning

Consistency fix.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Looks good, +1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scopes/CategoryRenderer.cpp'
2--- src/scopes/CategoryRenderer.cpp 2015-01-07 22:36:31 +0000
3+++ src/scopes/CategoryRenderer.cpp 2016-01-18 19:50:40 +0000
4@@ -49,8 +49,12 @@
5
6 As specified by the \c "category-layout" key of the \c "template" dictionary, Unity will render results associated with this category in a grid layout. The \c "components" dictionary specifies which result fields are used by Unity. In case of this definition, each tile of the grid will map the "title" field from the result (set also by the call to unity::scopes::Result::set_title()) as title for the grid tile, and "art" field from the result (see unity::scopes::Result::set_art()) as the icon for the grid tile.
7
8-To sum up, the \c "template" dictionary contains information to determine the correct renderer and its parameters, and the \c "components" dictionary contains mapping specifying which fields of the results are used by the renderer, where keys of the dictionary are understood by Unity and values specify either field name of the results directly (<tt>{"title": "album_name"}</tt> would mean that Unity will use <tt>result["album_name"]</tt> as a title for the grid tile), or the value can specify extra hints for the renderer as well as the result field name and a fallback image
9-(<tt>{"art": {"field": "icon", "aspect-ratio": 1.3, "fallback": "file:///path_to_fallback_image}}</tt>).
10+To sum up, the \c "template" dictionary contains information to determine the correct renderer and its parameters, and the \c "components" dictionary contains a mapping that specifies which fields of the results are used by the renderer.
11+The keys of the dictionary are understood by Unity and the values specify a field name of the results. For example, <tt>{"title": "album_name"}</tt> means that Unity will use <tt>result["album_name"]</tt> as a title for the grid tile.r
12+
13+A value also can specify extra hints for the renderer, such as the result field name and a fallback image. For example,
14+<tt>{"art": {"field": "icon", "aspect-ratio": 1.3, "fallback": "file:///path_to_fallback_image}}</tt>.
15+The fallback image is shown by Unity if no image URL is provided by the result, but the card requires an image. The fallback image is also shown if the result provides an empty URL for an image, the image does not load due to an error, or if loading results in an empty image. If a result does not specify a fallback image and the actual image is empty or cannot be loaded, Unity substitutes a generic fallback image.
16
17 \section jsonschema1 JSON structure (v1)
18
19
20=== modified file 'src/scopes/PreviewWidget.cpp'
21--- src/scopes/PreviewWidget.cpp 2015-12-10 16:26:30 +0000
22+++ src/scopes/PreviewWidget.cpp 2016-01-18 19:50:40 +0000
23@@ -158,7 +158,7 @@
24
25 \arg \c source A URI pointing to the image
26 \arg \c zoomable A boolean specifying whether the image is zoomable (default: \c false)
27-\arg \c fallback A fallback image to be used if the image URI cannot be retrieved (default: none)
28+\arg \c fallback A fallback image to be used if the image URI is empty or cannot be retrieved (default: none)
29 \arg \c share-data An optional dictionary for making this image shareable with Content Hub. See \link contentsharing content sharing\endlink below.
30
31 \code{.cpp}
32@@ -178,7 +178,7 @@
33 List of attributes:
34
35 \arg \c sources An array of image URIs
36-\arg \c fallback A fallback image to be used if an image URI cannot be resolved (default: none)
37+\arg \c fallback A fallback image to be used if an image URI is empty or cannot be retrieved (default: none)
38
39 \code{.cpp}
40 {
41@@ -203,7 +203,7 @@
42 \arg \c title A string specifying the title
43 \arg \c subtitle A string specifying the subtitle
44 \arg \c mascot A URI specifying the mascot
45-\arg \c fallback A fallback image to be used if the mascot URI cannot be retrieved (default: none)
46+\arg \c fallback A fallback image to be used if the mascot URI is empty or cannot be retrieved (default: none)
47 \arg \c emblem A URI specifying the emblem
48
49 \code{.cpp}

Subscribers

People subscribed via source and target branches

to all changes: