Merge lp:~kevin-wright-1/u1db-qt/qdoc-examples-april-23-2013-i into lp:u1db-qt

Proposed by Kevin Wright
Status: Merged
Approved by: Cris Dywan
Approved revision: 78
Merged at revision: 79
Proposed branch: lp:~kevin-wright-1/u1db-qt/qdoc-examples-april-23-2013-i
Merge into: lp:u1db-qt
Diff against target: 382 lines (+48/-50)
7 files modified
documentation/concepts.qdoc (+0/-2)
examples/u1db-qt-example-1/u1db-qt-example-1.qdoc (+1/-1)
examples/u1db-qt-example-2/u1db-qt-example-2.qdoc (+1/-1)
examples/u1db-qt-example-2b/u1db-qt-example-2b.qdoc (+1/-1)
examples/u1db-qt-example-3/u1db-qt-example-3.qdoc (+1/-1)
examples/u1db-qt-example-4/u1db-qt-example-4.qdoc (+1/-1)
examples/u1db-qt-example-5/u1db-qt-example-5.qdoc (+43/-43)
To merge this branch: bzr merge lp:~kevin-wright-1/u1db-qt/qdoc-examples-april-23-2013-i
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+160340@code.launchpad.net

Commit message

Modified example qml files to reduce number of warnings from qdoc. Changed each example's tutorial file from \example to \page and modified all \qml tags to \code tags.

Description of the change

Modified example qml files to reduce number of warnings from qdoc. Changed each example's tutorial file from \example to \page and modified all \qml tags to \code tags.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Very sweet!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'documentation/concepts.qdoc'
2--- documentation/concepts.qdoc 2013-04-22 11:28:15 +0000
3+++ documentation/concepts.qdoc 2013-04-23 11:57:27 +0000
4@@ -17,8 +17,6 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8-
9-
10 /*!
11 \page concepts.html
12 \title Design Concepts
13
14=== modified file 'examples/u1db-qt-example-1/u1db-qt-example-1.qdoc'
15--- examples/u1db-qt-example-1/u1db-qt-example-1.qdoc 2013-04-08 10:32:14 +0000
16+++ examples/u1db-qt-example-1/u1db-qt-example-1.qdoc 2013-04-23 11:57:27 +0000
17@@ -19,6 +19,6 @@
18
19 /*!
20
21-\example u1db-qt-example-1
22+\page u1db-qt-tutorial-1.html
23
24 */
25
26=== modified file 'examples/u1db-qt-example-2/u1db-qt-example-2.qdoc'
27--- examples/u1db-qt-example-2/u1db-qt-example-2.qdoc 2013-04-08 10:32:14 +0000
28+++ examples/u1db-qt-example-2/u1db-qt-example-2.qdoc 2013-04-23 11:57:27 +0000
29@@ -19,6 +19,6 @@
30
31 /*!
32
33-\example u1db-qt-example-2
34+\page u1db-qt-tutorial-2.html
35
36 */
37
38=== modified file 'examples/u1db-qt-example-2b/u1db-qt-example-2b.qdoc'
39--- examples/u1db-qt-example-2b/u1db-qt-example-2b.qdoc 2013-04-08 10:32:14 +0000
40+++ examples/u1db-qt-example-2b/u1db-qt-example-2b.qdoc 2013-04-23 11:57:27 +0000
41@@ -19,6 +19,6 @@
42
43 /*!
44
45-\example u1db-qt-example-2b
46+\page u1db-qt-tutorial-2b.html
47
48 */
49
50=== modified file 'examples/u1db-qt-example-3/u1db-qt-example-3.qdoc'
51--- examples/u1db-qt-example-3/u1db-qt-example-3.qdoc 2013-04-08 10:32:14 +0000
52+++ examples/u1db-qt-example-3/u1db-qt-example-3.qdoc 2013-04-23 11:57:27 +0000
53@@ -19,6 +19,6 @@
54
55 /*!
56
57-\example u1db-qt-example-3
58+\page u1db-qt-tutorial-3.html
59
60 */
61
62=== modified file 'examples/u1db-qt-example-4/u1db-qt-example-4.qdoc'
63--- examples/u1db-qt-example-4/u1db-qt-example-4.qdoc 2013-04-08 10:32:14 +0000
64+++ examples/u1db-qt-example-4/u1db-qt-example-4.qdoc 2013-04-23 11:57:27 +0000
65@@ -19,6 +19,6 @@
66
67 /*!
68
69-\example u1db-qt-example-4
70+\page u1db-qt-tutorial-4.html
71
72 */
73
74=== modified file 'examples/u1db-qt-example-5/u1db-qt-example-5.qdoc'
75--- examples/u1db-qt-example-5/u1db-qt-example-5.qdoc 2013-04-12 08:06:46 +0000
76+++ examples/u1db-qt-example-5/u1db-qt-example-5.qdoc 2013-04-23 11:57:27 +0000
77@@ -1,6 +1,6 @@
78 /*!
79
80-\example u1db-qt-example-5
81+\page u1db-qt-tutorial-5.html
82
83 \title U1Db-Qt Index Tutorial
84
85@@ -20,12 +20,12 @@
86
87 A Database is very simple to create. It only needs an id and a path where the file will be created. A Database is a model, which can be used by elements, such as the ListView further in this example.
88
89-\qml
90+\code
91 U1db.Database {
92 id: aDatabase
93 path: "aDatabase4"
94 }
95-\endqml
96+\endcode
97
98 \section1 The Document Element
99
100@@ -37,39 +37,39 @@
101
102 This example of a very simple Document will not initially do anything, until more properties are added and defined:
103
104-\qml
105+\code
106 U1db.Document {
107 id: aDocument1
108 docId: 'helloworld1'
109 }
110-\endqml
111+\endcode
112
113 A basic but still practical Document definition contains several essential properties. In addition to 'id' and 'docId' (discussed above), the 'database', 'create', and 'defaults' properties are also very important, and are introduced below.
114
115 The 'database' property ensures that the Document is attached to an already defined (or possibly soon to be defined one) identified by its id (in this case 'aDatabase'). For example:
116
117-\qml
118+\code
119 U1db.Document {
120 id: aDocument1
121 database: aDatabase
122 docId: 'helloworld1'
123 }
124-\endqml
125+\endcode
126
127 Should the Database not already contain a Document with the same docId ('hellowworld1' in this example) when a 'create' property is present and set to true it will be generated. For example:
128
129-\qml
130+\code
131 U1db.Document {
132 id: aDocument1
133 database: aDatabase
134 docId: 'helloworld1'
135 create: true
136 }
137-\endqml
138+\endcode
139
140 However, the Document still requires some data to be useful, which is what the 'defaults' property provides. The value of 'defaults' is a map of data that will be stored in the database (again when the create property is et to true). It contain key:value pairs, where the value can be a string, number, or nested object (e.g. additional fields, lists). For example:
141
142-\qml
143+\code
144 U1db.Document {
145 id: aDocument1
146 database: aDatabase
147@@ -77,11 +77,11 @@
148 create: true
149 defaults:{"hello": { "world": { "message":"Hello World", "id": 1 } } }
150 }
151-\endqml
152+\endcode
153
154 As mentioned above, lists can also be nested in Document data. Lists provide a convenient method for producing multiple instances of the same key (AKA 'field' or 'sub-field'). The example code below shows valid use of the 'message' and 'id' sub-fields multiple times within the same object.
155
156-\qml
157+\code
158 U1db.Document {
159 id: aDocument2
160 database: aDatabase
161@@ -92,11 +92,11 @@
162 { "message":"Hello World", "id": 2.5 }
163 ] } }
164 }
165-\endqml
166+\endcode
167
168 When the default Javascript Object Notation itself is formatted with appropriate line breaks and indentation, it becomes easier to visualize an embedded list, containing sub-fields 'message' and 'id' (and their respective values):
169
170-\qml
171+\code
172 {"hello":
173 { "world":
174 [
175@@ -105,14 +105,14 @@
176 ]
177 }
178 }
179-\endqml
180+\endcode
181
182 In dot notation these sub-fields are represented by 'hello.world.message' and 'hello.world.id' respectively. Later in this tutorial these will be utilized within the 'expression' property of U1Db-Qt's Index element, in close collaboration with a QML ListView's delegates.
183
184
185 Normally when a docId already exists in a database, and when the set flag is set to true, the value in 'defaults' will be ignored (and the existing data in the database will remain untouched). Sometimes a developer needs to easily overwrite the data in an existing document. The 'contents' property can be used for just that purpose. When 'contents' is defined, its value will replace existing data in the database, for the document identified by the docId. In addition, 'contents' can be used to add new documents, in the same way as the 'create: true' + 'defaults' combination does; in other words, if the document defined by 'docId' does not exist it will be created.
186
187-\qml
188+\code
189 U1db.Document {
190 id: aDocument3
191 database: aDatabase
192@@ -123,11 +123,11 @@
193 { "message":"Hello World", "id": 3.66 }
194 ] } }
195 }
196-\endqml
197+\endcode
198
199 If 'defaults' exists, 'create' is set to 'true' (or 'false' for that matter) and 'contents' is also defined, it is the latter that takes precidence. In other words, 'create' and 'defaults' will be ignored. The following example demonstrates this scenario:
200
201-\qml
202+\code
203 U1db.Document {
204 id: aDocument3
205 database: aDatabase
206@@ -140,18 +140,18 @@
207 { "message":"Hello World", "id": 3.66 }
208 ] } }
209 }
210-\endqml
211+\endcode
212
213 This snippet simply represents the absence of the 'create' property, which is synonymous with 'create: false'. The Document can still be recognized within the application, but until applicable properties (such as those outlined above) are added and/or modified then nothing will be added or modified in the database, and this instance may have very little practical value.
214
215-\qml
216+\code
217 U1db.Document {
218 id: aDocument4
219 database: aDatabase
220 docId: 'helloworld4'
221 defaults:{"hello": { "world": { "message":"Hello World", "id": 4 } } }
222 }
223-\endqml
224+\endcode
225
226 \section3 Samples of Stored Documents
227
228@@ -237,33 +237,33 @@
229
230 The Index element requires both a unique 'id' and a pointer to a 'database' in order to begin becoming useful, as demonstrated here:
231
232-\qml
233+\code
234 U1db.Index{
235 database: aDatabase
236 id: by_helloworld
237 }
238-\endqml
239+\endcode
240
241 In the future, the Index element will support on disk storage of appropriate results / data. At the present time only in memory indexing is done, but once the storing capability is implemented, defining and identifying it is as simple as using the 'name' property (which will be stored in the database along with the relvent data that goes with it). The snippet below shows the use of the 'name' property:
242
243-\qml
244+\code
245 U1db.Index{
246 database: aDatabase
247 id: by_helloworld
248 //name: "by-helloworld"
249 }
250-\endqml
251+\endcode
252
253 The Index element describes, using dot notation, the fields and sub-fields where the developer expects to find information. That information is defined in a list, and added as the value for the 'expression' property. The list can contain one or more entries, as exemplified here (the property is commented out due to its current status):
254
255-\qml
256+\code
257 U1db.Index{
258 database: aDatabase
259 id: by_helloworld
260 //name: "by-helloworld"
261 expression: ["hello.world.id","hello.world.message"]
262 }
263-\endqml
264+\endcode
265
266 \section2 The QueryElement
267
268@@ -273,43 +273,43 @@
269
270 In order to fulfil its duties as a bridge to an Index (and Database), the 'index' property must point to an Index element, identified by its 'id'. For example:
271
272-\qml
273+\code
274 U1db.Query{
275 id: aQuery
276 index: by_helloworld
277 }
278-\endqml
279+\endcode
280
281 While Index helps to filter data based on 'where' it is located (e.g. field.sub-field), Query helps determine the additional set of criteria for 'what' is being searched for. The intent of the 'query' property is to provide the mechanism for defnining the search criteria, but at the time of writing that functionality is not yet available. However, once the implementation is in place, using it is only requires defining the property's value (e.g. "Hello World"). Wild card searches using '*' are supported, which is the default query (i.e. if 'query' is not set it is assumed to be '*'). For example (the property is commented out due to its current status):
282
283-\qml
284+\code
285 U1db.Query{
286 id: aQuery
287 index: by_helloworld
288 //query: "*"
289 }
290-\endqml
291+\endcode
292
293 When the 'query' property becomes available, only wildcard search definitions for "starts with" will be suppoprted. Thus the following would be supported:
294
295-\qml
296+\code
297 U1db.Query{
298 id: aQuery
299 index: by_helloworld
300 //query: "Hello*"
301 }
302-\endqml
303+\endcode
304
305
306 But this would not:
307
308-\qml
309+\code
310 U1db.Query{
311 id: aQuery
312 index: by_helloworld
313 //query: "*World"
314 }
315-\endqml
316+\endcode
317
318 Note: again, the 'query' property is commented out in the above two snippets due to its current status
319
320@@ -321,19 +321,19 @@
321
322 This simple snippet represents how to attach a ListModel to a ListView. In this instance the model 'aQuery' is representative of the Query + Index combination defined earlier:
323
324-\qml
325+\code
326 ListView {
327 width: units.gu(45)
328 height: units.gu(80)
329 model: aQuery
330 }
331-\endqml
332+\endcode
333
334 \section4 Data and Delegates
335
336 How a model and ListView + delegates work together is a common QML concept, and not specific to U1Db-Qt. However, the asynchronous nature of this relationship is important to understand. When using QML ListView, delegates will be created based on particular properties such as the size of the application window, ListView, and delegate itself (amongst other factors). Each delegate can then represent a Document retrieved from the Database based on the record's index. This example demonstrates some of the property definitions that contribute to determining the number of delegates a ListView will contain:
337
338-\qml
339+\code
340 ListView {
341 width: units.gu(45)
342 height: units.gu(80)
343@@ -344,7 +344,7 @@
344 }
345
346 }
347-\endqml
348+\endcode
349
350
351 When the number of Documents is less than or equal to the number of delegates then there is a one to one mapping of index to delegate (e.g. the first delegate will represent the Document with an index = 0; the second, index = 1; and so on).
352@@ -353,7 +353,7 @@
353
354 The following snippet, which modifies the above delegate definition, could demonstrate this effect if there were enough Documents to do so (i.e. some number greater than the number of delegates):
355
356-\qml
357+\code
358 ListView {
359 width: units.gu(45)
360 height: units.gu(80)
361@@ -365,11 +365,11 @@
362 }
363
364 }
365-\endqml
366+\endcode
367
368 The object called 'contents' contains one or more properties. This example demonstrates the retrieval of data based on the U1db.Index defined earlier (id: by-helloworld). In this instance the Index contained two expressions simultaniously, "hello.world.id" and "hello.world.message"
369
370-\qml
371+\code
372 ListView {
373 width: units.gu(45)
374 height: units.gu(80)
375@@ -381,6 +381,6 @@
376 }
377
378 }
379-\endqml
380+\endcode
381
382 */

Subscribers

People subscribed via source and target branches

to all changes: