Merge lp:~timeout-scope-team/timeout-scope/timeout_ready_for_publish into lp:timeout

Proposed by Victor Tuson Palau
Status: Needs review
Proposed branch: lp:~timeout-scope-team/timeout-scope/timeout_ready_for_publish
Merge into: lp:timeout
Diff against target: 3215 lines (+3000/-0) (has conflicts)
40 files modified
.bzrignore (+14/-0)
CMakeLists.txt (+48/-0)
COPYING.txt (+674/-0)
NOTICE.txt (+16/-0)
README.org (+65/-0)
apparmor/confined.json (+7/-0)
apparmor/unconfined.json (+4/-0)
data/CMakeLists.txt (+25/-0)
data/renderer/carousel.json (+12/-0)
data/renderer/horizontal-list.json (+12/-0)
data/renderer/large-grid.json (+12/-0)
data/renderer/medium-grid.json (+12/-0)
data/renderer/vjournal.json (+15/-0)
data/renderer/wide-art.json (+13/-0)
data/timeout.ini.in (+13/-0)
manifest.json.in (+15/-0)
push.sh (+8/-0)
run.sh (+24/-0)
security.json (+5/-0)
src/CMakeLists.txt (+22/-0)
src/TimeOut-client.cpp (+372/-0)
src/TimeOut-client.h (+101/-0)
src/TimeOut-preview.cpp (+413/-0)
src/TimeOut-preview.h (+46/-0)
src/TimeOut-query.cpp (+491/-0)
src/TimeOut-query.h (+69/-0)
src/TimeOut-scope.cpp (+62/-0)
src/TimeOut-scope.h (+51/-0)
src/TimeOut-scope.h.autosave (+50/-0)
src/com.canonical.scopes.timeout_timeout.ini (+13/-0)
src/com.canonical.scopes.timeout_timeout_automoc.cpp (+2/-0)
src/config.h.in (+47/-0)
src/timeout.ini (+13/-0)
src/timeout_automoc.cpp (+2/-0)
test/CMakeLists.txt (+24/-0)
test/files/CMakeLists.txt (+1/-0)
test/test-timeout-client.cpp (+16/-0)
timeout-scope.json (+6/-0)
timeout.cbp (+199/-0)
timeout.json (+6/-0)
Conflict adding file src.  Moved existing file to src.moved.
To merge this branch: bzr merge lp:~timeout-scope-team/timeout-scope/timeout_ready_for_publish
Reviewer Review Type Date Requested Status
Michał Karnicki optional Pending
Review via email: mp+235686@code.launchpad.net
To post a comment you must log in.
16. By Victor Tuson Palau

fixed bug with canned queries

Unmerged revisions

16. By Victor Tuson Palau

fixed bug with canned queries

15. By Victor Tuson Palau

changes: multi-city surfacing, location awareness, html formating, preview implementations, and confinment

14. By Michał Karnicki

Comment out main block of TimeOut-client.

13. By Michał Karnicki

Merge refactored Victor's improvements to image sizes.

12. By Michał Karnicki

Bump version to 0.4.1.

11. By Michał Karnicki

Fetch smaller images, 312x208.

10. By Michał Karnicki

Bump version to 0.4

9. By Michał Karnicki

Fetch smaller images for better speed.

8. By Michał Karnicki

Fix background and header foreground colors.

7. By Michał Karnicki

Remove cache directory.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file '.bzrignore'
--- .bzrignore 1970-01-01 00:00:00 +0000
+++ .bzrignore 2014-09-24 10:37:38 +0000
@@ -0,0 +1,14 @@
1build
2build/*
3*.click
4click
5click/*
6src/config.h
7manifest.json
8CMakeLists.txt.user
9CMakeCache.txt
10CMakeFiles
11Makefile
12cmake_install.cmake
13install_manifest.txt
14ignore
015
=== added file '.excludes'
=== added file 'CMakeLists.txt'
--- CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ CMakeLists.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,48 @@
1set(SCOPE_PACKAGE "com.canonical.scopes.timeout")
2set(SCOPE_TITLE "TimeOut")
3set(SCOPE_ICON "icon.png")
4 # FYI SCOPE_LOGO currently doesn't work in unity-scope-tool
5set(SCOPE_LOGO "logo.png")
6set(SCOPE_COLOR "color:///#000000")
7set(BG_COLOR "color:///#000000")
8set(FG_COLOR "#FFFFFF")
9set(SCOPE_BG_COLOR "#FFFFFF")
10set(SCOPE_AUTHOR "Canonical")
11set(SCOPE_MAINTAINER "Time Out Group Ltd")
12set(SCOPE_DESC "TimeOut scope")
13set(SCOPE_NAME "timeout")
14
15set(ARCH "armhf")
16set(FRAMEWORK "ubuntu-sdk-14.10-dev2")
17
18# ***
19
20# workaround for bug lp:1340135
21SET(SCOPE_PATH "/opt/click.ubuntu.com/${SCOPE_PACKAGE}/current")
22
23project(timeout CXX)
24cmake_minimum_required(VERSION 2.8.10)
25
26set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall -Wextra")
27set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
28
29include(GNUInstallDirs)
30include(FindPkgConfig)
31pkg_check_modules(UNITY_SCOPES libunity-scopes>=0.4.0 REQUIRED)
32
33set(INI_INSTALLDIR "/${SCOPE_NAME}")
34set(SCOPE_INSTALLDIR "/${SCOPE_NAME}")
35
36configure_file(
37 "${CMAKE_CURRENT_SOURCE_DIR}/manifest.json.in"
38 "${CMAKE_CURRENT_SOURCE_DIR}/manifest.json"
39)
40
41add_subdirectory(src)
42add_subdirectory(data)
43#enable_testing()
44#add_subdirectory(test)
45#add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V --output-on-failure)
46
47install(FILES manifest.json DESTINATION "/")
48install(FILES "security.json" DESTINATION "/")
049
=== added file 'COPYING.txt'
--- COPYING.txt 1970-01-01 00:00:00 +0000
+++ COPYING.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,674 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 3, 29 June 2007
3
4 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5 Everyone is permitted to copy and distribute verbatim copies
6 of this license document, but changing it is not allowed.
7
8 Preamble
9
10 The GNU General Public License is a free, copyleft license for
11software and other kinds of works.
12
13 The licenses for most software and other practical works are designed
14to take away your freedom to share and change the works. By contrast,
15the GNU General Public License is intended to guarantee your freedom to
16share and change all versions of a program--to make sure it remains free
17software for all its users. We, the Free Software Foundation, use the
18GNU General Public License for most of our software; it applies also to
19any other work released this way by its authors. You can apply it to
20your programs, too.
21
22 When we speak of free software, we are referring to freedom, not
23price. Our General Public Licenses are designed to make sure that you
24have the freedom to distribute copies of free software (and charge for
25them if you wish), that you receive source code or can get it if you
26want it, that you can change the software or use pieces of it in new
27free programs, and that you know you can do these things.
28
29 To protect your rights, we need to prevent others from denying you
30these rights or asking you to surrender the rights. Therefore, you have
31certain responsibilities if you distribute copies of the software, or if
32you modify it: responsibilities to respect the freedom of others.
33
34 For example, if you distribute copies of such a program, whether
35gratis or for a fee, you must pass on to the recipients the same
36freedoms that you received. You must make sure that they, too, receive
37or can get the source code. And you must show them these terms so they
38know their rights.
39
40 Developers that use the GNU GPL protect your rights with two steps:
41(1) assert copyright on the software, and (2) offer you this License
42giving you legal permission to copy, distribute and/or modify it.
43
44 For the developers' and authors' protection, the GPL clearly explains
45that there is no warranty for this free software. For both users' and
46authors' sake, the GPL requires that modified versions be marked as
47changed, so that their problems will not be attributed erroneously to
48authors of previous versions.
49
50 Some devices are designed to deny users access to install or run
51modified versions of the software inside them, although the manufacturer
52can do so. This is fundamentally incompatible with the aim of
53protecting users' freedom to change the software. The systematic
54pattern of such abuse occurs in the area of products for individuals to
55use, which is precisely where it is most unacceptable. Therefore, we
56have designed this version of the GPL to prohibit the practice for those
57products. If such problems arise substantially in other domains, we
58stand ready to extend this provision to those domains in future versions
59of the GPL, as needed to protect the freedom of users.
60
61 Finally, every program is threatened constantly by software patents.
62States should not allow patents to restrict development and use of
63software on general-purpose computers, but in those that do, we wish to
64avoid the special danger that patents applied to a free program could
65make it effectively proprietary. To prevent this, the GPL assures that
66patents cannot be used to render the program non-free.
67
68 The precise terms and conditions for copying, distribution and
69modification follow.
70
71 TERMS AND CONDITIONS
72
73 0. Definitions.
74
75 "This License" refers to version 3 of the GNU General Public License.
76
77 "Copyright" also means copyright-like laws that apply to other kinds of
78works, such as semiconductor masks.
79
80 "The Program" refers to any copyrightable work licensed under this
81License. Each licensee is addressed as "you". "Licensees" and
82"recipients" may be individuals or organizations.
83
84 To "modify" a work means to copy from or adapt all or part of the work
85in a fashion requiring copyright permission, other than the making of an
86exact copy. The resulting work is called a "modified version" of the
87earlier work or a work "based on" the earlier work.
88
89 A "covered work" means either the unmodified Program or a work based
90on the Program.
91
92 To "propagate" a work means to do anything with it that, without
93permission, would make you directly or secondarily liable for
94infringement under applicable copyright law, except executing it on a
95computer or modifying a private copy. Propagation includes copying,
96distribution (with or without modification), making available to the
97public, and in some countries other activities as well.
98
99 To "convey" a work means any kind of propagation that enables other
100parties to make or receive copies. Mere interaction with a user through
101a computer network, with no transfer of a copy, is not conveying.
102
103 An interactive user interface displays "Appropriate Legal Notices"
104to the extent that it includes a convenient and prominently visible
105feature that (1) displays an appropriate copyright notice, and (2)
106tells the user that there is no warranty for the work (except to the
107extent that warranties are provided), that licensees may convey the
108work under this License, and how to view a copy of this License. If
109the interface presents a list of user commands or options, such as a
110menu, a prominent item in the list meets this criterion.
111
112 1. Source Code.
113
114 The "source code" for a work means the preferred form of the work
115for making modifications to it. "Object code" means any non-source
116form of a work.
117
118 A "Standard Interface" means an interface that either is an official
119standard defined by a recognized standards body, or, in the case of
120interfaces specified for a particular programming language, one that
121is widely used among developers working in that language.
122
123 The "System Libraries" of an executable work include anything, other
124than the work as a whole, that (a) is included in the normal form of
125packaging a Major Component, but which is not part of that Major
126Component, and (b) serves only to enable use of the work with that
127Major Component, or to implement a Standard Interface for which an
128implementation is available to the public in source code form. A
129"Major Component", in this context, means a major essential component
130(kernel, window system, and so on) of the specific operating system
131(if any) on which the executable work runs, or a compiler used to
132produce the work, or an object code interpreter used to run it.
133
134 The "Corresponding Source" for a work in object code form means all
135the source code needed to generate, install, and (for an executable
136work) run the object code and to modify the work, including scripts to
137control those activities. However, it does not include the work's
138System Libraries, or general-purpose tools or generally available free
139programs which are used unmodified in performing those activities but
140which are not part of the work. For example, Corresponding Source
141includes interface definition files associated with source files for
142the work, and the source code for shared libraries and dynamically
143linked subprograms that the work is specifically designed to require,
144such as by intimate data communication or control flow between those
145subprograms and other parts of the work.
146
147 The Corresponding Source need not include anything that users
148can regenerate automatically from other parts of the Corresponding
149Source.
150
151 The Corresponding Source for a work in source code form is that
152same work.
153
154 2. Basic Permissions.
155
156 All rights granted under this License are granted for the term of
157copyright on the Program, and are irrevocable provided the stated
158conditions are met. This License explicitly affirms your unlimited
159permission to run the unmodified Program. The output from running a
160covered work is covered by this License only if the output, given its
161content, constitutes a covered work. This License acknowledges your
162rights of fair use or other equivalent, as provided by copyright law.
163
164 You may make, run and propagate covered works that you do not
165convey, without conditions so long as your license otherwise remains
166in force. You may convey covered works to others for the sole purpose
167of having them make modifications exclusively for you, or provide you
168with facilities for running those works, provided that you comply with
169the terms of this License in conveying all material for which you do
170not control copyright. Those thus making or running the covered works
171for you must do so exclusively on your behalf, under your direction
172and control, on terms that prohibit them from making any copies of
173your copyrighted material outside their relationship with you.
174
175 Conveying under any other circumstances is permitted solely under
176the conditions stated below. Sublicensing is not allowed; section 10
177makes it unnecessary.
178
179 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
181 No covered work shall be deemed part of an effective technological
182measure under any applicable law fulfilling obligations under article
18311 of the WIPO copyright treaty adopted on 20 December 1996, or
184similar laws prohibiting or restricting circumvention of such
185measures.
186
187 When you convey a covered work, you waive any legal power to forbid
188circumvention of technological measures to the extent such circumvention
189is effected by exercising rights under this License with respect to
190the covered work, and you disclaim any intention to limit operation or
191modification of the work as a means of enforcing, against the work's
192users, your or third parties' legal rights to forbid circumvention of
193technological measures.
194
195 4. Conveying Verbatim Copies.
196
197 You may convey verbatim copies of the Program's source code as you
198receive it, in any medium, provided that you conspicuously and
199appropriately publish on each copy an appropriate copyright notice;
200keep intact all notices stating that this License and any
201non-permissive terms added in accord with section 7 apply to the code;
202keep intact all notices of the absence of any warranty; and give all
203recipients a copy of this License along with the Program.
204
205 You may charge any price or no price for each copy that you convey,
206and you may offer support or warranty protection for a fee.
207
208 5. Conveying Modified Source Versions.
209
210 You may convey a work based on the Program, or the modifications to
211produce it from the Program, in the form of source code under the
212terms of section 4, provided that you also meet all of these conditions:
213
214 a) The work must carry prominent notices stating that you modified
215 it, and giving a relevant date.
216
217 b) The work must carry prominent notices stating that it is
218 released under this License and any conditions added under section
219 7. This requirement modifies the requirement in section 4 to
220 "keep intact all notices".
221
222 c) You must license the entire work, as a whole, under this
223 License to anyone who comes into possession of a copy. This
224 License will therefore apply, along with any applicable section 7
225 additional terms, to the whole of the work, and all its parts,
226 regardless of how they are packaged. This License gives no
227 permission to license the work in any other way, but it does not
228 invalidate such permission if you have separately received it.
229
230 d) If the work has interactive user interfaces, each must display
231 Appropriate Legal Notices; however, if the Program has interactive
232 interfaces that do not display Appropriate Legal Notices, your
233 work need not make them do so.
234
235 A compilation of a covered work with other separate and independent
236works, which are not by their nature extensions of the covered work,
237and which are not combined with it such as to form a larger program,
238in or on a volume of a storage or distribution medium, is called an
239"aggregate" if the compilation and its resulting copyright are not
240used to limit the access or legal rights of the compilation's users
241beyond what the individual works permit. Inclusion of a covered work
242in an aggregate does not cause this License to apply to the other
243parts of the aggregate.
244
245 6. Conveying Non-Source Forms.
246
247 You may convey a covered work in object code form under the terms
248of sections 4 and 5, provided that you also convey the
249machine-readable Corresponding Source under the terms of this License,
250in one of these ways:
251
252 a) Convey the object code in, or embodied in, a physical product
253 (including a physical distribution medium), accompanied by the
254 Corresponding Source fixed on a durable physical medium
255 customarily used for software interchange.
256
257 b) Convey the object code in, or embodied in, a physical product
258 (including a physical distribution medium), accompanied by a
259 written offer, valid for at least three years and valid for as
260 long as you offer spare parts or customer support for that product
261 model, to give anyone who possesses the object code either (1) a
262 copy of the Corresponding Source for all the software in the
263 product that is covered by this License, on a durable physical
264 medium customarily used for software interchange, for a price no
265 more than your reasonable cost of physically performing this
266 conveying of source, or (2) access to copy the
267 Corresponding Source from a network server at no charge.
268
269 c) Convey individual copies of the object code with a copy of the
270 written offer to provide the Corresponding Source. This
271 alternative is allowed only occasionally and noncommercially, and
272 only if you received the object code with such an offer, in accord
273 with subsection 6b.
274
275 d) Convey the object code by offering access from a designated
276 place (gratis or for a charge), and offer equivalent access to the
277 Corresponding Source in the same way through the same place at no
278 further charge. You need not require recipients to copy the
279 Corresponding Source along with the object code. If the place to
280 copy the object code is a network server, the Corresponding Source
281 may be on a different server (operated by you or a third party)
282 that supports equivalent copying facilities, provided you maintain
283 clear directions next to the object code saying where to find the
284 Corresponding Source. Regardless of what server hosts the
285 Corresponding Source, you remain obligated to ensure that it is
286 available for as long as needed to satisfy these requirements.
287
288 e) Convey the object code using peer-to-peer transmission, provided
289 you inform other peers where the object code and Corresponding
290 Source of the work are being offered to the general public at no
291 charge under subsection 6d.
292
293 A separable portion of the object code, whose source code is excluded
294from the Corresponding Source as a System Library, need not be
295included in conveying the object code work.
296
297 A "User Product" is either (1) a "consumer product", which means any
298tangible personal property which is normally used for personal, family,
299or household purposes, or (2) anything designed or sold for incorporation
300into a dwelling. In determining whether a product is a consumer product,
301doubtful cases shall be resolved in favor of coverage. For a particular
302product received by a particular user, "normally used" refers to a
303typical or common use of that class of product, regardless of the status
304of the particular user or of the way in which the particular user
305actually uses, or expects or is expected to use, the product. A product
306is a consumer product regardless of whether the product has substantial
307commercial, industrial or non-consumer uses, unless such uses represent
308the only significant mode of use of the product.
309
310 "Installation Information" for a User Product means any methods,
311procedures, authorization keys, or other information required to install
312and execute modified versions of a covered work in that User Product from
313a modified version of its Corresponding Source. The information must
314suffice to ensure that the continued functioning of the modified object
315code is in no case prevented or interfered with solely because
316modification has been made.
317
318 If you convey an object code work under this section in, or with, or
319specifically for use in, a User Product, and the conveying occurs as
320part of a transaction in which the right of possession and use of the
321User Product is transferred to the recipient in perpetuity or for a
322fixed term (regardless of how the transaction is characterized), the
323Corresponding Source conveyed under this section must be accompanied
324by the Installation Information. But this requirement does not apply
325if neither you nor any third party retains the ability to install
326modified object code on the User Product (for example, the work has
327been installed in ROM).
328
329 The requirement to provide Installation Information does not include a
330requirement to continue to provide support service, warranty, or updates
331for a work that has been modified or installed by the recipient, or for
332the User Product in which it has been modified or installed. Access to a
333network may be denied when the modification itself materially and
334adversely affects the operation of the network or violates the rules and
335protocols for communication across the network.
336
337 Corresponding Source conveyed, and Installation Information provided,
338in accord with this section must be in a format that is publicly
339documented (and with an implementation available to the public in
340source code form), and must require no special password or key for
341unpacking, reading or copying.
342
343 7. Additional Terms.
344
345 "Additional permissions" are terms that supplement the terms of this
346License by making exceptions from one or more of its conditions.
347Additional permissions that are applicable to the entire Program shall
348be treated as though they were included in this License, to the extent
349that they are valid under applicable law. If additional permissions
350apply only to part of the Program, that part may be used separately
351under those permissions, but the entire Program remains governed by
352this License without regard to the additional permissions.
353
354 When you convey a copy of a covered work, you may at your option
355remove any additional permissions from that copy, or from any part of
356it. (Additional permissions may be written to require their own
357removal in certain cases when you modify the work.) You may place
358additional permissions on material, added by you to a covered work,
359for which you have or can give appropriate copyright permission.
360
361 Notwithstanding any other provision of this License, for material you
362add to a covered work, you may (if authorized by the copyright holders of
363that material) supplement the terms of this License with terms:
364
365 a) Disclaiming warranty or limiting liability differently from the
366 terms of sections 15 and 16 of this License; or
367
368 b) Requiring preservation of specified reasonable legal notices or
369 author attributions in that material or in the Appropriate Legal
370 Notices displayed by works containing it; or
371
372 c) Prohibiting misrepresentation of the origin of that material, or
373 requiring that modified versions of such material be marked in
374 reasonable ways as different from the original version; or
375
376 d) Limiting the use for publicity purposes of names of licensors or
377 authors of the material; or
378
379 e) Declining to grant rights under trademark law for use of some
380 trade names, trademarks, or service marks; or
381
382 f) Requiring indemnification of licensors and authors of that
383 material by anyone who conveys the material (or modified versions of
384 it) with contractual assumptions of liability to the recipient, for
385 any liability that these contractual assumptions directly impose on
386 those licensors and authors.
387
388 All other non-permissive additional terms are considered "further
389restrictions" within the meaning of section 10. If the Program as you
390received it, or any part of it, contains a notice stating that it is
391governed by this License along with a term that is a further
392restriction, you may remove that term. If a license document contains
393a further restriction but permits relicensing or conveying under this
394License, you may add to a covered work material governed by the terms
395of that license document, provided that the further restriction does
396not survive such relicensing or conveying.
397
398 If you add terms to a covered work in accord with this section, you
399must place, in the relevant source files, a statement of the
400additional terms that apply to those files, or a notice indicating
401where to find the applicable terms.
402
403 Additional terms, permissive or non-permissive, may be stated in the
404form of a separately written license, or stated as exceptions;
405the above requirements apply either way.
406
407 8. Termination.
408
409 You may not propagate or modify a covered work except as expressly
410provided under this License. Any attempt otherwise to propagate or
411modify it is void, and will automatically terminate your rights under
412this License (including any patent licenses granted under the third
413paragraph of section 11).
414
415 However, if you cease all violation of this License, then your
416license from a particular copyright holder is reinstated (a)
417provisionally, unless and until the copyright holder explicitly and
418finally terminates your license, and (b) permanently, if the copyright
419holder fails to notify you of the violation by some reasonable means
420prior to 60 days after the cessation.
421
422 Moreover, your license from a particular copyright holder is
423reinstated permanently if the copyright holder notifies you of the
424violation by some reasonable means, this is the first time you have
425received notice of violation of this License (for any work) from that
426copyright holder, and you cure the violation prior to 30 days after
427your receipt of the notice.
428
429 Termination of your rights under this section does not terminate the
430licenses of parties who have received copies or rights from you under
431this License. If your rights have been terminated and not permanently
432reinstated, you do not qualify to receive new licenses for the same
433material under section 10.
434
435 9. Acceptance Not Required for Having Copies.
436
437 You are not required to accept this License in order to receive or
438run a copy of the Program. Ancillary propagation of a covered work
439occurring solely as a consequence of using peer-to-peer transmission
440to receive a copy likewise does not require acceptance. However,
441nothing other than this License grants you permission to propagate or
442modify any covered work. These actions infringe copyright if you do
443not accept this License. Therefore, by modifying or propagating a
444covered work, you indicate your acceptance of this License to do so.
445
446 10. Automatic Licensing of Downstream Recipients.
447
448 Each time you convey a covered work, the recipient automatically
449receives a license from the original licensors, to run, modify and
450propagate that work, subject to this License. You are not responsible
451for enforcing compliance by third parties with this License.
452
453 An "entity transaction" is a transaction transferring control of an
454organization, or substantially all assets of one, or subdividing an
455organization, or merging organizations. If propagation of a covered
456work results from an entity transaction, each party to that
457transaction who receives a copy of the work also receives whatever
458licenses to the work the party's predecessor in interest had or could
459give under the previous paragraph, plus a right to possession of the
460Corresponding Source of the work from the predecessor in interest, if
461the predecessor has it or can get it with reasonable efforts.
462
463 You may not impose any further restrictions on the exercise of the
464rights granted or affirmed under this License. For example, you may
465not impose a license fee, royalty, or other charge for exercise of
466rights granted under this License, and you may not initiate litigation
467(including a cross-claim or counterclaim in a lawsuit) alleging that
468any patent claim is infringed by making, using, selling, offering for
469sale, or importing the Program or any portion of it.
470
471 11. Patents.
472
473 A "contributor" is a copyright holder who authorizes use under this
474License of the Program or a work on which the Program is based. The
475work thus licensed is called the contributor's "contributor version".
476
477 A contributor's "essential patent claims" are all patent claims
478owned or controlled by the contributor, whether already acquired or
479hereafter acquired, that would be infringed by some manner, permitted
480by this License, of making, using, or selling its contributor version,
481but do not include claims that would be infringed only as a
482consequence of further modification of the contributor version. For
483purposes of this definition, "control" includes the right to grant
484patent sublicenses in a manner consistent with the requirements of
485this License.
486
487 Each contributor grants you a non-exclusive, worldwide, royalty-free
488patent license under the contributor's essential patent claims, to
489make, use, sell, offer for sale, import and otherwise run, modify and
490propagate the contents of its contributor version.
491
492 In the following three paragraphs, a "patent license" is any express
493agreement or commitment, however denominated, not to enforce a patent
494(such as an express permission to practice a patent or covenant not to
495sue for patent infringement). To "grant" such a patent license to a
496party means to make such an agreement or commitment not to enforce a
497patent against the party.
498
499 If you convey a covered work, knowingly relying on a patent license,
500and the Corresponding Source of the work is not available for anyone
501to copy, free of charge and under the terms of this License, through a
502publicly available network server or other readily accessible means,
503then you must either (1) cause the Corresponding Source to be so
504available, or (2) arrange to deprive yourself of the benefit of the
505patent license for this particular work, or (3) arrange, in a manner
506consistent with the requirements of this License, to extend the patent
507license to downstream recipients. "Knowingly relying" means you have
508actual knowledge that, but for the patent license, your conveying the
509covered work in a country, or your recipient's use of the covered work
510in a country, would infringe one or more identifiable patents in that
511country that you have reason to believe are valid.
512
513 If, pursuant to or in connection with a single transaction or
514arrangement, you convey, or propagate by procuring conveyance of, a
515covered work, and grant a patent license to some of the parties
516receiving the covered work authorizing them to use, propagate, modify
517or convey a specific copy of the covered work, then the patent license
518you grant is automatically extended to all recipients of the covered
519work and works based on it.
520
521 A patent license is "discriminatory" if it does not include within
522the scope of its coverage, prohibits the exercise of, or is
523conditioned on the non-exercise of one or more of the rights that are
524specifically granted under this License. You may not convey a covered
525work if you are a party to an arrangement with a third party that is
526in the business of distributing software, under which you make payment
527to the third party based on the extent of your activity of conveying
528the work, and under which the third party grants, to any of the
529parties who would receive the covered work from you, a discriminatory
530patent license (a) in connection with copies of the covered work
531conveyed by you (or copies made from those copies), or (b) primarily
532for and in connection with specific products or compilations that
533contain the covered work, unless you entered into that arrangement,
534or that patent license was granted, prior to 28 March 2007.
535
536 Nothing in this License shall be construed as excluding or limiting
537any implied license or other defenses to infringement that may
538otherwise be available to you under applicable patent law.
539
540 12. No Surrender of Others' Freedom.
541
542 If conditions are imposed on you (whether by court order, agreement or
543otherwise) that contradict the conditions of this License, they do not
544excuse you from the conditions of this License. If you cannot convey a
545covered work so as to satisfy simultaneously your obligations under this
546License and any other pertinent obligations, then as a consequence you may
547not convey it at all. For example, if you agree to terms that obligate you
548to collect a royalty for further conveying from those to whom you convey
549the Program, the only way you could satisfy both those terms and this
550License would be to refrain entirely from conveying the Program.
551
552 13. Use with the GNU Affero General Public License.
553
554 Notwithstanding any other provision of this License, you have
555permission to link or combine any covered work with a work licensed
556under version 3 of the GNU Affero General Public License into a single
557combined work, and to convey the resulting work. The terms of this
558License will continue to apply to the part which is the covered work,
559but the special requirements of the GNU Affero General Public License,
560section 13, concerning interaction through a network will apply to the
561combination as such.
562
563 14. Revised Versions of this License.
564
565 The Free Software Foundation may publish revised and/or new versions of
566the GNU General Public License from time to time. Such new versions will
567be similar in spirit to the present version, but may differ in detail to
568address new problems or concerns.
569
570 Each version is given a distinguishing version number. If the
571Program specifies that a certain numbered version of the GNU General
572Public License "or any later version" applies to it, you have the
573option of following the terms and conditions either of that numbered
574version or of any later version published by the Free Software
575Foundation. If the Program does not specify a version number of the
576GNU General Public License, you may choose any version ever published
577by the Free Software Foundation.
578
579 If the Program specifies that a proxy can decide which future
580versions of the GNU General Public License can be used, that proxy's
581public statement of acceptance of a version permanently authorizes you
582to choose that version for the Program.
583
584 Later license versions may give you additional or different
585permissions. However, no additional obligations are imposed on any
586author or copyright holder as a result of your choosing to follow a
587later version.
588
589 15. Disclaimer of Warranty.
590
591 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
600 16. Limitation of Liability.
601
602 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610SUCH DAMAGES.
611
612 17. Interpretation of Sections 15 and 16.
613
614 If the disclaimer of warranty and limitation of liability provided
615above cannot be given local legal effect according to their terms,
616reviewing courts shall apply local law that most closely approximates
617an absolute waiver of all civil liability in connection with the
618Program, unless a warranty or assumption of liability accompanies a
619copy of the Program in return for a fee.
620
621 END OF TERMS AND CONDITIONS
622
623 How to Apply These Terms to Your New Programs
624
625 If you develop a new program, and you want it to be of the greatest
626possible use to the public, the best way to achieve this is to make it
627free software which everyone can redistribute and change under these terms.
628
629 To do so, attach the following notices to the program. It is safest
630to attach them to the start of each source file to most effectively
631state the exclusion of warranty; and each file should have at least
632the "copyright" line and a pointer to where the full notice is found.
633
634 <one line to give the program's name and a brief idea of what it does.>
635 Copyright (C) <year> <name of author>
636
637 This program is free software: you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation, either version 3 of the License, or
640 (at your option) any later version.
641
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
646
647 You should have received a copy of the GNU General Public License
648 along with this program. If not, see <http://www.gnu.org/licenses/>.
649
650Also add information on how to contact you by electronic and paper mail.
651
652 If the program does terminal interaction, make it output a short
653notice like this when it starts in an interactive mode:
654
655 <program> Copyright (C) <year> <name of author>
656 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 This is free software, and you are welcome to redistribute it
658 under certain conditions; type `show c' for details.
659
660The hypothetical commands `show w' and `show c' should show the appropriate
661parts of the General Public License. Of course, your program's commands
662might be different; for a GUI interface, you would use an "about box".
663
664 You should also get your employer (if you work as a programmer) or school,
665if any, to sign a "copyright disclaimer" for the program, if necessary.
666For more information on this, and how to apply and follow the GNU GPL, see
667<http://www.gnu.org/licenses/>.
668
669 The GNU General Public License does not permit incorporating your program
670into proprietary programs. If your program is a subroutine library, you
671may consider it more useful to permit linking proprietary applications with
672the library. If this is what you want to do, use the GNU Lesser General
673Public License instead of this License. But first, please read
674<http://www.gnu.org/philosophy/why-not-lgpl.html>.
0675
=== added file 'NOTICE.txt'
--- NOTICE.txt 1970-01-01 00:00:00 +0000
+++ NOTICE.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,16 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
017
=== added file 'README.org'
--- README.org 1970-01-01 00:00:00 +0000
+++ README.org 2014-09-24 10:37:38 +0000
@@ -0,0 +1,65 @@
1TimeOut scope prototype.
2
3 * Contact
4
5 Michał Karnicki <michal.karnicki@canonical.com>
6
7 * Running on desktop
8
9 $ ./build.sh
10 $ ./run.sh
11
12 * Building on the device
13
14 $ ./drop.sh
15 adb# su - phablet
16 adb$ cd $SCOPE_NAME
17 adb$ ./build.sh
18 adb$ ./click.sh
19
20 * Tools
21
22 A bunch of scripts that should make your life easier!
23
24 ** ./build.sh
25 Builds the scope locally.
26
27 If you want to clean then build, run:
28 $ ./build.sh .
29
30 If you are building for the first time, you'll need to install dependencies:
31 sudo ./deps.sh
32 If you're doing that on the phone, you'll first need to:
33 # note this will make your system not delta-upgradeable!
34 $ sudo mount -o rw,remount /
35 $ sudo apt-get update
36 $ sudo ./deps.sh
37 Note that mounting your file system writable will prevent from delta-upgrading your system. That means, you'll need to later flash your phone with up-to-date Ubuntu if you want to receive delta-updates. However, if you're a developer, no need to worry, you probably already use ubuntu-device-flash to often update your device manually.
38
39** ./run.sh
40 Runs the scope with unity-scope-tool.
41 $ sudo apt-get install unity-scope-tool
42
43 To set up run.sh, run this once:
44 $ sudo ./run.sh .
45 This requires sudo, because it tricks a click installation on your desktop.
46 In case you update renderer/* files, re-run this setup command.
47
48** ./drop.sh
49 Pushes current directory to the device, excluding .bzr, drops into adb shell.
50
51** ./click.sh
52 Creates and installs the click package on the device, after you have successfully ran build.sh. If on desktop, this will only attempt to build the click package (host architecture package). To workaround temporary issue, please run in adb shell:
53 $ sudo chmod o+w /opt/click.ubuntu.com/$SCOPE_PACKAGE/current/cache
54 sudo password is: phablet
55
56** ./clean.sh
57 Removes build and click directories and cmake configured files.
58
59
60
61* Project tasks:
62** TODO i18n
63** TODO location (geoip, AGPS)
64** TODO make scope confined (mv apparmor/confined.json security.json)
65** TODO resolve the scope writable directory matter; update SCOPE_PATH in config.h.in
066
=== added directory 'apparmor'
=== added file 'apparmor/confined.json'
--- apparmor/confined.json 1970-01-01 00:00:00 +0000
+++ apparmor/confined.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,7 @@
1{
2 "template": "ubuntu-scope-network",
3 "policy_groups": [
4 "networking"
5 ],
6 "policy_version": 1.2
7}
08
=== added file 'apparmor/unconfined.json'
--- apparmor/unconfined.json 1970-01-01 00:00:00 +0000
+++ apparmor/unconfined.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,4 @@
1{
2 "template": "unconfined",
3 "policy_version": 1.2
4}
05
=== added directory 'data'
=== added file 'data/CMakeLists.txt'
--- data/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ data/CMakeLists.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,25 @@
1# Put the ini file in the build directory next to the scope
2# .so file so test tools can find both easily.
3configure_file(
4 timeout.ini.in
5 ${CMAKE_BINARY_DIR}/src/${SCOPE_PACKAGE}_${SCOPE_NAME}.ini)
6
7INSTALL(
8 FILES ${CMAKE_BINARY_DIR}/src/${SCOPE_PACKAGE}_${SCOPE_NAME}.ini
9 DESTINATION ${INI_INSTALLDIR}
10)
11
12INSTALL(
13 DIRECTORY "renderer"
14 DESTINATION "${INI_INSTALLDIR}"
15)
16
17INSTALL(
18 FILES "icon.png"
19 DESTINATION "${INI_INSTALLDIR}"
20)
21
22INSTALL(
23 FILES "./images/logo.png"
24 DESTINATION "${INI_INSTALLDIR}"
25)
026
=== added file 'data/icon.png'
1Binary files data/icon.png 1970-01-01 00:00:00 +0000 and data/icon.png 2014-09-24 10:37:38 +0000 differ27Binary files data/icon.png 1970-01-01 00:00:00 +0000 and data/icon.png 2014-09-24 10:37:38 +0000 differ
=== added directory 'data/images'
=== added file 'data/images/logo.png'
2Binary files data/images/logo.png 1970-01-01 00:00:00 +0000 and data/images/logo.png 2014-09-24 10:37:38 +0000 differ28Binary files data/images/logo.png 1970-01-01 00:00:00 +0000 and data/images/logo.png 2014-09-24 10:37:38 +0000 differ
=== added directory 'data/renderer'
=== added file 'data/renderer/carousel.json'
--- data/renderer/carousel.json 1970-01-01 00:00:00 +0000
+++ data/renderer/carousel.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,12 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "carousel",
5 "card-size": "medium",
6 "overlay": true
7 },
8 "components": {
9 "title": "title",
10 "art": "image"
11 }
12}
013
=== added file 'data/renderer/horizontal-list.json'
--- data/renderer/horizontal-list.json 1970-01-01 00:00:00 +0000
+++ data/renderer/horizontal-list.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,12 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "horizontal-list",
5 "card-size": "medium",
6 "overlay": true
7 },
8 "components": {
9 "title": "title",
10 "art": "image"
11 }
12}
013
=== added file 'data/renderer/large-grid.json'
--- data/renderer/large-grid.json 1970-01-01 00:00:00 +0000
+++ data/renderer/large-grid.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,12 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "grid",
5 "card-size": "large",
6 "collapsed-rows": 1
7 },
8 "components": {
9 "art": "image-large",
10 "title": "title"
11 }
12}
013
=== added file 'data/renderer/medium-grid.json'
--- data/renderer/medium-grid.json 1970-01-01 00:00:00 +0000
+++ data/renderer/medium-grid.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,12 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "grid",
5 "card-size": "small",
6 "collapsed-rows": 1
7 },
8 "components": {
9 "art": { "field": "image", "aspect-ratio": 1 },
10 "title": "title"
11 }
12}
013
=== added file 'data/renderer/vjournal.json'
--- data/renderer/vjournal.json 1970-01-01 00:00:00 +0000
+++ data/renderer/vjournal.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,15 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "vertical-journal",
5 "card-layout": "horizontal",
6 "card-size": "medium",
7 "collapsed-rows": 1
8 },
9 "components": {
10 "mascot": "image-small",
11 "title": "title",
12 "subtitle": "subtitle",
13 "summary": "summary"
14 }
15}
016
=== added file 'data/renderer/wide-art.json'
--- data/renderer/wide-art.json 1970-01-01 00:00:00 +0000
+++ data/renderer/wide-art.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,13 @@
1{
2 "schema-version": 1,
3 "template": {
4 "category-layout": "grid",
5 "card-size": "large",
6 "overlay": true,
7 "collapsed-rows": 0
8 },
9 "components": {
10 "title": "title",
11 "art": { "field": "image", "aspect-ratio": 2.5 }
12 }
13}
014
=== added file 'data/timeout.ini.in'
--- data/timeout.ini.in 1970-01-01 00:00:00 +0000
+++ data/timeout.ini.in 2014-09-24 10:37:38 +0000
@@ -0,0 +1,13 @@
1[ScopeConfig]
2DisplayName = TimeOut
3Description = This is an Ubuntu search plugin that enables information from TimeOut to be searched and displayed in the Dash. If you do not wish to search this content source, you can disable this search plugin.
4Icon = @SCOPE_ICON@
5Author = Canonical Ltd.
6SearchHint = Search TimeOut
7LocationDataNeeded=true
8[Appearance]
9Background = @SCOPE_COLOR@
10PageHeader.Logo = @SCOPE_LOGO@
11PageHeader.Background = @BG_COLOR@
12PageHeader.ForegroundColor = @FG_COLOR@
13BackgroundColor = @SCOPE_BG_COLOR@
014
=== added file 'manifest.json.in'
--- manifest.json.in 1970-01-01 00:00:00 +0000
+++ manifest.json.in 2014-09-24 10:37:38 +0000
@@ -0,0 +1,15 @@
1{
2 "name": "@SCOPE_PACKAGE@",
3 "description": "@SCOPE_DESC@",
4 "framework": "@FRAMEWORK@",
5 "architecture": "@ARCH@",
6 "title": "@SCOPE_TITLE@",
7 "hooks": {
8 "@SCOPE_NAME@": {
9 "scope": "@SCOPE_NAME@",
10 "apparmor": "security.json"
11 }
12 },
13 "version": "0.4.9",
14 "maintainer": "@SCOPE_MAINTAINER@"
15}
016
=== added file 'push.sh'
--- push.sh 1970-01-01 00:00:00 +0000
+++ push.sh 2014-09-24 10:37:38 +0000
@@ -0,0 +1,8 @@
1#!/bin/bash
2
3for click in `ls *.click`;do
4 adb push $click /home/phablet
5done
6
7adb shell "find /home/phablet/ -name *.click -exec pkcon --allow-untrusted install-local {} \;"
8adb shell "rm /home/phablet/*.click"
09
=== added file 'run.sh'
--- run.sh 1970-01-01 00:00:00 +0000
+++ run.sh 2014-09-24 10:37:38 +0000
@@ -0,0 +1,24 @@
1#!/bin/bash
2
3if [ $# -eq 1 ]; then
4 OWNER=$SUDO_USER
5 if [ "$OWNER" = "" ]; then
6 OWNER=$USER
7 fi
8 PACKAGE=`head CMakeLists.txt |grep SCOPE_PACKAGE|cut -d" " -f 2|tr -d "\")"`
9 DEST="/opt/click.ubuntu.com/$PACKAGE/current"
10
11 sudo mkdir -p $DEST
12# sudo cp -r data/departments.json $DEST/
13 sudo cp -r data/renderer $DEST/
14# sudo cp -r data/images $DEST/
15 sudo cp -r data/cache $DEST/
16
17 sudo chown $OWNER:$OWNER $DEST/cache
18 echo "Setup complete."
19 exit 0;
20fi
21
22cd build/src
23path=`pwd`
24unity-scope-tool $path/*.ini
025
=== added file 'security.json'
--- security.json 1970-01-01 00:00:00 +0000
+++ security.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,5 @@
1{
2 "template": "ubuntu-scope-network",
3 "policy_groups": [],
4 "policy_version": 1.2
5}
06
=== added directory 'src'
=== renamed directory 'src' => 'src.moved'
=== added file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/CMakeLists.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,22 @@
1add_definitions(-DQT_NO_KEYWORDS)
2
3find_package(Qt5Network REQUIRED)
4set(CMAKE_AUTOMOC ON)
5
6add_library(${SCOPE_PACKAGE}_${SCOPE_NAME} SHARED TimeOut-preview.cpp TimeOut-query.cpp TimeOut-scope.cpp TimeOut-client.cpp)
7
8target_link_libraries(${SCOPE_PACKAGE}_${SCOPE_NAME} ${UNITY_SCOPES_LDFLAGS})
9set_property(TARGET ${SCOPE_PACKAGE}_${SCOPE_NAME} PROPERTY COMPILE_FLAGS ${UNITY_SCOPES_CFLAGS})
10
11qt5_use_modules(${SCOPE_PACKAGE}_${SCOPE_NAME} Network)
12qt5_use_modules(${SCOPE_PACKAGE}_${SCOPE_NAME} Gui)
13
14CONFIGURE_FILE(
15 "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
16 "${CMAKE_CURRENT_SOURCE_DIR}/config.h"
17)
18
19install(
20 TARGETS ${SCOPE_PACKAGE}_${SCOPE_NAME}
21 LIBRARY DESTINATION ${SCOPE_INSTALLDIR}
22)
023
=== added file 'src/TimeOut-client.cpp'
--- src/TimeOut-client.cpp 1970-01-01 00:00:00 +0000
+++ src/TimeOut-client.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,372 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "TimeOut-client.h"
19
20#include <chrono>
21#include <utility>
22
23#include <QCoreApplication>
24#include <QNetworkDiskCache>
25
26#define VERBOSE
27
28#define TIMING
29
30#ifdef TIMING
31#define INIT_TIMER auto start = std::chrono::high_resolution_clock::now();
32#define START_TIMER start = std::chrono::high_resolution_clock::now();
33#define STOP_TIMER(name) qDebug() << "RUNTIME of " << name << ": " << \
34 std::chrono::duration_cast<std::chrono::milliseconds>( \
35 std::chrono::high_resolution_clock::now()-start \
36 ).count() << " ms ";
37#else
38#define INIT_TIMER
39#define START_TIMER
40#define STOP_TIMER(name)
41#endif
42
43#define FOREACH_JSON(it, results) for (QJsonArray::iterator it = results.begin(); it != results.end(); ++it)
44
45const QString USER_AGENT = "TimeOut Scope (Ubuntu)";
46const QString GEO_LOOKUP = "http://geoip.ubuntu.com/lookup";
47const QString URL = "http://graffiti.timeout.com/v1";
48const QString KEY = "key-goes-here";
49
50const QString AUTH_HEADER = "Bearer %1";
51
52using namespace Qt;
53
54TimeOut::TimeOut() {
55 useAltCity = false;
56}
57
58void print(QMap<QString, QString> map) {
59 QMap<QString, QString>::iterator it;
60 for (it = map.begin(); it != map.end(); ++it)
61 qDebug() << it.key() << ": " << it.value();
62}
63QMap<QString,QString> TimeOut::getCityLogos() {
64 QMap<QString,QString> myMap;
65 myMap["Accra"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/accra.png";
66 myMap["Amsterdam"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/amsterdam.png";
67 myMap["Barcelona"]="http://www.timeout.cat/bundles/timeoutfrontend/images/logos/bcn.png";
68 myMap["Berlin"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/berlin.png";
69 myMap["Boston"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/boston.png";
70 myMap["Chicago"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/chicago.png";
71 myMap["Kuala Lumpur"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/kualalumpur.png";
72 myMap["Las Vegas"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/lasvegas.png";
73 myMap["London"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/london.png";
74 myMap["Los Angeles"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/la.png";
75 myMap["Madrid"]="http://www.timeout.es/bundles/timeoutfrontend/images/logos/madrid.png";
76 myMap["Miami"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/miami.png";
77 myMap["México, DF"]="http://www.timeoutmexico.mx/bundles/timeoutfrontend/images/logos/mex.png";
78 myMap["New York"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/ny.png";
79 myMap["Paris"]="http://www.timeout.fr/bundles/timeoutfrontend/images/logos/paris.png";
80 myMap["Washington, DC"]="http://www.timeout.com/bundles/timeoutfrontend/images/logos/washingtondc.png";
81 myMap["unknown"]="http://www.timeout.com/wp-content/uploads/2014/06/TO-web-logo-global.png";
82 return myMap;
83}
84
85void TimeOut::setCacheDirectory(std::string const &cacheDirectory) {
86 scopeCache = QString::fromStdString(cacheDirectory);
87}
88
89bool inBox(locBox box, coordinates point){
90 double big,small;
91 if(box.bottom > box.top){
92 big=box.bottom;
93 small=box.top;
94 } else {
95 big=box.top;
96 small=box.bottom;
97 }
98 if (!(point.lat<big && point.lat > small))
99 return false;
100
101 if(box.left > box.right){
102 big=box.left;
103 small=box.right;
104 } else {
105 big=box.right;
106 small=box.left;
107 }
108 if (!(point.lon<big && point.lon > small))
109 return false;
110
111 return true;
112
113}
114
115bool TimeOut::setupCity() {
116 coordinates city = getCurrentCity();
117 std::vector<CityType> cities = fetchSupportedCities();
118 for (unsigned int i = 0 ; i < cities.size(); i++){
119 if (inBox(cities[i].box,city)) {
120 this->city = cities[i].name;
121 this->url = QUrl(cities[i].url);
122 qDebug() << "City set to: " << this->city;
123 useCurrentCity();
124 return true;
125 }
126 }
127 qDebug() << "Unsupported location " << city.lat <<" : " <<city.lon;
128 this->city = "";
129 this->url = "";
130 return false;
131}
132
133QString TimeOut::getCityFromUrl(QString url) {
134
135 auto iCity = url.right(url.size() - url.indexOf("mobile") - 7);
136 iCity = iCity.left(iCity.indexOf("/"));
137 qDebug() << "city from url is " <<iCity << " for " << url;
138 auto cities = getSupportedCities();
139 for (unsigned int i = 0 ; i < cities.size(); i++){
140 if(cities[i].url.contains(iCity))
141 return cities[i].url;
142 }
143 return "";
144}
145
146QByteArray TimeOut::makeRequest(QNetworkRequest &request) const {
147 int argc = 1;
148 char *argv = const_cast<char*>("timeout-scope");
149 QCoreApplication *app = new QCoreApplication(argc, &argv);
150 QNetworkAccessManager manager;
151 QByteArray reply;
152 QNetworkDiskCache *cache = new QNetworkDiskCache();
153 cache->setCacheDirectory(scopeCache);
154
155 QString authorizationHeader = AUTH_HEADER.arg(KEY);
156 request.setRawHeader("Authorization", authorizationHeader.toStdString().c_str());
157 request.setRawHeader("User-Agent", USER_AGENT.toStdString().c_str());
158 request.setRawHeader("Content-Type", "application/json");
159 request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
160
161 QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), app, SLOT(quit()));
162 QObject::connect(&manager, &QNetworkAccessManager::finished,
163 [&reply](QNetworkReply *msg) {
164 reply = msg->readAll();
165 msg->deleteLater();
166 });
167
168 manager.setCache(cache);
169 manager.get(request);
170 app->exec();
171
172 delete cache;
173 return reply;
174}
175
176QJsonValuePair TimeOut::get(QUrl url, int = 1) const {
177 INIT_TIMER
178 START_TIMER
179 QNetworkRequest request(url); // Add paging when we support it.
180 QByteArray data = makeRequest(request);
181 STOP_TIMER(QString("GET ").append(url.path()));
182
183 QJsonParseError e;
184 QJsonDocument document = QJsonDocument::fromJson(data, &e);
185 if (e.error != QJsonParseError::NoError) {
186 qCritical() << "failed to parse response " << e.errorString() << "\n" << QString(data);
187 throw QString("Failed to parse response: %1").arg(e.errorString());
188 }
189
190 if(!document.isObject()) {
191 throw QString("json is not an object");
192 }
193 QJsonObject object = document.object();
194 if (object.contains("meta")) {
195 QJsonValue meta = object.value("meta");
196 QJsonValue body = object.value("body");
197
198 return RESPONSE(meta, body);
199 } else {
200 // XXX workaround for inconsistent "curateds" API endpoint format
201 qCritical() << "No 'meta' tag present!";
202 QJsonValue meta, body;
203 if (document.isArray()) {
204 body = document.array();
205 }
206 return RESPONSE(meta, body);
207 }
208}
209
210coordinates TimeOut::getCurrentCity() {
211 //Insert coordinates here for test
212 //mycoordinates.lat= 41.4583; mycoordinates.lon= 2.0625; //Barcelona
213 //mycoordinates.lat= 41.1583; mycoordinates.lon= -3.6625; //Madrid
214 //mycoordinates.lat= 0; mycoordinates.lon= 0; //nowhere
215
216
217 qDebug()<< "lat is " << mycoordinates.lat << " , long is " <<mycoordinates.lon;
218
219 return mycoordinates;
220}
221
222std::vector<CityType> TimeOut::fetchSupportedCities() {
223 QUrl url(URL + "/mobile");
224 auto response = get(url);
225 supportedCities.clear();
226
227 qDebug() <<"my locale is" << locale_;
228 QJsonValue body = response.second;
229 QJsonArray results = body.toArray();
230 QJsonArray::iterator it;
231 for (it = results.begin(); it != results.end(); ++it) {
232 CityType iCity;
233 QJsonObject o = (*it).toObject();
234
235 //get coordinates for the city
236 QJsonObject boundingBox = o.value("bounding_box").toObject();
237 iCity.box.top=boundingBox.value("top").toDouble();
238 iCity.box.bottom=boundingBox.value("bottom").toDouble();
239 iCity.box.right=boundingBox.value("right").toDouble();
240 iCity.box.left=boundingBox.value("left").toDouble();
241 QJsonObject defaultLocale = o.value("default_locale").toObject();
242 iCity.name = defaultLocale.value("name").toString();
243 //blacklist accra as seems broken
244 if (iCity.name == "Accra")
245 continue;
246 iCity.url = defaultLocale.value("url").toString();
247 QJsonArray locales = o.value("locales").toArray();
248
249 bool locale_found=false;
250 bool en_found=false;
251 QString en_url="";
252
253 //check if my locale is supported
254 FOREACH_JSON(alocal,locales) {
255 QJsonObject o = (*alocal).toObject();
256 auto loc_lang = o.value("id").toString();
257 qDebug()<<"city supports:" <<loc_lang << "checking against" <<locale_;
258 if (loc_lang.contains(locale_)) {
259 iCity.url = o.value("url").toString();
260 locale_found =true;
261 }
262 if (loc_lang.contains("en")) {
263 en_url = o.value("url").toString();
264 en_found =true;
265 }
266 }
267 //if my locale is not found, then try english, if not default
268 if (!locale_found && en_found) iCity.url = en_url;
269
270#ifdef VERBOSE
271 qDebug() << iCity.name << " url :" << iCity.url << "\nbox :\nbottom " << iCity.box.bottom
272 <<"left "<< iCity.box.left
273 << "top "<< iCity.box.top
274 << "right " <<iCity.box.right;
275#endif
276 supportedCities.push_back(iCity);
277 }
278 return supportedCities;
279}
280
281void TimeOut::getCityEndpoints() {
282 site.clear();
283 auto response = get(useAltCity?this->alternateUrl:this->url, 1);
284
285 QJsonValue body = response.second;
286 QJsonArray results = body.toArray();
287 QJsonArray::iterator it;
288 for (it = results.begin(); it != results.end(); ++it) {
289 QJsonObject endpoint = (*it).toObject();
290 QString id = endpoint.value("id").toString();
291 QString url = endpoint.value("url").toString();
292#ifdef VERBOSE
293 qDebug() << id;
294#endif
295 site[id] = QUrl(url);
296 }
297}
298
299QJsonValuePair TimeOut::getEndpoint(QString endpoint, int page) const {
300 /*
301 "booking-providers"
302 "canned-queries"
303 "curateds"
304 "editor-lists"
305 "editor-picks"
306 "facet-groups"
307 "page-types"
308 "pages"
309 "search"
310 "windows"
311 */
312 return this->get(this->site[endpoint], page);
313}
314
315QJsonArray TimeOut::getCannedQueries(int page = 1) const {
316 QJsonValuePair response = getEndpoint(QString("canned-queries"), page);
317 return BODY(response);
318}
319
320QJsonArray TimeOut::getCurated(int page = 1) const {
321 auto response = getEndpoint(QString("curateds"), page);
322 return BODY(response);
323}
324
325QJsonArray TimeOut::getEditorLists(int page = 1) const {
326 auto response = getEndpoint(QString("editor-lists"), page);
327 return BODY(response);
328}
329
330QJsonArray TimeOut::getEditorPicks(int page = 1) const {
331 auto response = getEndpoint(QString("editor-picks"), page);
332 return BODY(response);
333}
334
335QJsonArray TimeOut::getFacetGroups(int page = 1) const {
336 auto response = getEndpoint(QString("facet-groups"), page);
337 return BODY(response);
338}
339
340QJsonArray TimeOut::search(QString query, int page = 1) const {
341 QString lat= QString::number(mycoordinates.lat);
342 QString lng= QString::number(mycoordinates.lon);;
343 QString radius("2");
344
345 QString location = QString("&latitude=%1&longitude=%2&radius=%3")
346 .arg(lat).arg(lng).arg(radius);
347 QString s = this->site["search"].toString() + QString("&q=%1").arg(query) + location;
348 auto response = this->get(QUrl(s), page);
349 return BODY(response);
350}
351/*
352 // This is left here for standalone test runs.
353int main(int argc, char **argv) {
354 TimeOut timeout;
355 timeout.setupCity();
356
357 QJsonArray curated = timeout.getCurated();
358 if (curated.empty()) {
359 qWarning() << "no curated results!";
360 }
361#ifdef VERBOSE
362 QJsonArray::iterator it;
363 for (it = curated.begin(); it != curated.end(); ++it) {
364 QJsonObject item = (*it).toObject();
365 QString name = item.value("name").toString();
366 QString url = item.value("url").toString();
367 qDebug() << name << ": " << url;
368 }
369#endif
370 return 0;
371}
372*/
0373
=== added file 'src/TimeOut-client.h'
--- src/TimeOut-client.h 1970-01-01 00:00:00 +0000
+++ src/TimeOut-client.h 2014-09-24 10:37:38 +0000
@@ -0,0 +1,101 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TIMEOUT_CLIENT_H
19#define TIMEOUT_CLIENT_H
20
21#include "config.h"
22
23#include <QNetworkAccessManager>
24#include <QNetworkReply>
25#include <QNetworkRequest>
26
27#include <QJsonArray>
28#include <QJsonDocument>
29#include <QJsonObject>
30
31#define RESPONSE(meta, body) std::make_pair(meta, body)
32#define META(response) response.first
33#define BODY(response) response.second.toArray()
34#define COORDINATES(cor,lon, lat) cor.lon=lon;\cor.lat=lat
35
36typedef std::pair<QJsonValue, QJsonValue> QJsonValuePair;
37
38//city location
39struct coordinates {
40 double lon;
41 double lat;
42};
43
44struct locBox {
45 double top;
46 double bottom;
47 double left;
48 double right;
49};
50struct CityType {
51 QString name;
52 QString url;
53 locBox box;
54};
55
56class TimeOut
57{
58
59public:
60 TimeOut();
61 QJsonValuePair get(QUrl, int) const;
62
63 void setCacheDirectory(std::string const&);
64 bool setupCity();
65 void setLocale(QString const& locale) { locale_ = locale; }
66 void setLocation(double lat, double lon) { mycoordinates.lat=lat;mycoordinates.lon =lon; }
67 coordinates getCurrentCity();
68 QString getCityName() {return city;}
69 QString getCityUrl(){ return url.toString();}
70 QString getCityFromUrl(QString url);
71 std::vector<CityType> fetchSupportedCities();
72 std::vector<CityType> getSupportedCities() {return supportedCities;}
73 QMap<QString,QString> getCityLogos();
74 void getCityEndpoints();
75 QJsonValuePair getEndpoint(QString, int) const;
76 QJsonArray getCannedQueries(int) const;
77 QJsonArray getCurated(int) const;
78 QJsonArray getEditorLists(int) const;
79 QJsonArray getEditorPicks(int) const;
80 QJsonArray getFacetGroups(int) const;
81 QJsonArray search(QString query, int) const;
82 void useAlternateCity(const QString& url) { useAltCity =true; alternateUrl =QUrl(url); getCityEndpoints();}
83 void useCurrentCity() {useAltCity=false;getCityEndpoints();}
84protected:
85 QByteArray makeRequest(QNetworkRequest &) const;
86
87private:
88 QString scopeCache;
89 QString city;
90 QUrl url;
91 QUrl alternateUrl;
92 bool useAltCity;
93 QMap<QString, QUrl> site;
94 coordinates mycoordinates;
95 QString locale_;
96 std::vector<CityType> supportedCities;
97
98
99};
100
101#endif
0102
=== added file 'src/TimeOut-preview.cpp'
--- src/TimeOut-preview.cpp 1970-01-01 00:00:00 +0000
+++ src/TimeOut-preview.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,413 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "TimeOut-preview.h"
19
20#include <unity/scopes/PreviewWidget.h>
21#include <unity/scopes/ColumnLayout.h>
22#include <unity/scopes/PreviewReply.h>
23#include <unity/scopes/VariantBuilder.h>
24
25#include <QDebug>
26#include <QString>
27
28using namespace unity::scopes;
29
30TimeoutPreview::TimeoutPreview(Result const& result, ActionMetadata const& metadata, TimeOut const& timeout)
31 : PreviewQueryBase(result, metadata), timeout(timeout) {
32}
33
34TimeoutPreview::~TimeoutPreview() {
35}
36
37void TimeoutPreview::cancelled() {
38}
39
40#define VARIANT_STR(s) Variant(s.toStdString().c_str())
41
42void TimeoutPreview::getVenueDetails(PreviewReplyProxy const& reply) {
43 Result result = PreviewQueryBase::result();
44 QString urlString(result["uri"].get_string().c_str());
45 qDebug() << "[Details] GET " << urlString;
46 QUrl url = QUrl(urlString);
47
48 QJsonValuePair response = timeout.get(url, 1);
49 QJsonObject o = response.second.toObject();
50
51 QString phone = o.value("phone").toString();
52 QString website = o.value("to_website").toString();
53 QString address = o.value("address1").toString();
54 QString postcode = o.value("postcode").toString();
55 QString city = o.value("city").toString();
56 QString transport = o.value("transport").toString();
57// QString lat = o.value("latitude").toString();
58// QString lon = o.value("longitude").toString();
59
60 PreviewWidget addressLabel("addressLabel", "text");
61 QString fullAddress = QString("%1 %2").arg(address).arg(postcode);
62 addressLabel.add_attribute_value("text", VARIANT_STR(fullAddress));
63
64 PreviewWidget contactButtons("contactButtons", "actions");
65 VariantBuilder contact;
66 QString fullPhone = QString("tel:///%1").arg(phone);
67
68 contact.add_tuple({
69 {"id", Variant("map")},
70 {"label", Variant("Map")},
71 {"uri", Variant(QString("http://m.here.com/#action=search&params={\"query\":\"%1,%2 %3\"}")
72 .arg(address).arg(city).arg(postcode).toStdString().c_str())}
73 });
74 contact.add_tuple({
75 {"id", Variant("call")},
76 {"label", Variant("Call")},
77 {"uri", VARIANT_STR(fullPhone)}
78 });
79 contact.add_tuple({
80 {"id", Variant("web")},
81 {"label", Variant("Website")},
82 {"uri", VARIANT_STR(website)}
83 });
84 contactButtons.add_attribute_value("actions", contact.end());
85
86 PreviewWidget details("details", "text");
87 details.add_attribute_value("title", Variant("Details"));
88 if (!transport.isEmpty()) {
89 QString detailsText;
90 detailsText.append(QString("<strong>Transport</strong><br />%1").arg(transport));
91 details.add_attribute_value("text", VARIANT_STR(detailsText));
92 }
93
94 PreviewWidget actionButtons("actionButtons", "actions");
95 VariantBuilder actionsBuilder;
96 actionsBuilder.add_tuple({
97 {"id", Variant("nearby")},
98 {"label", Variant("Nearby venues")}
99 });
100 actionsBuilder.add_tuple({
101 {"id", Variant("share")},
102 {"label", Variant("Share")}
103 });
104 actionButtons.add_attribute_value("actions", actionsBuilder.end());
105
106 // reply->push({addressLabel, contactButtons, details/*transportText*/, actionButtons});
107
108 //action buttons currently not supported
109 reply->push({addressLabel, contactButtons, details/*transportText*/});
110}
111
112void TimeoutPreview::previewVenue(PreviewReplyProxy const& reply) {
113 Result result = PreviewQueryBase::result();
114 ColumnLayout one(1);
115 one.add_column({"header", "ratings", "art",
116 "addressLabel", "contactButtons",
117 "timeoutsays", "details"/*"transport"*/, "actionButtons"});
118 ColumnLayout two(2);
119 two.add_column({"header", "ratings", "art"});
120 two.add_column({"addressLabel", "contactButtons", "timeoutsays", "details", "actionButtons"});
121 ColumnLayout three(3);
122 three.add_column({"header", "ratings", "art"});
123 three.add_column({"contactButtons", "addressLabel", "timeoutsays"});
124 three.add_column({"actionButtons", "details"});
125
126 reply->register_layout({one, two, three});
127
128 PreviewWidget header("header", "header");
129 header.add_attribute_mapping("title", "title");
130 header.add_attribute_mapping("subtitle", "subcategory_representation");
131
132
133 auto hasRating = this->result().contains("average");
134 auto hasTORating = this->result().contains("editorial_rating");
135 if (hasRating || hasTORating) {
136 PreviewWidget ratings("ratings", "reviews");
137 VariantBuilder ratingsBuilder;
138 if (hasTORating) {
139 ratingsBuilder.add_tuple({
140 {"author", Variant("TimeOut")},
141 {"rating", result["editorial_rating"]}
142 });
143 }
144 if (hasRating){
145 ratingsBuilder.add_tuple({
146 {"author", Variant("Users")},
147 {"rating", result["average"]}
148 });
149 }
150 ratings.add_attribute_value("reviews", ratingsBuilder.end());
151 reply->push({ratings});
152 }
153 PreviewWidget art("art", "image"); // id, widget type
154 art.add_attribute_mapping("source", "image"); // widget key, result key
155
156 reply->push({header, art});
157
158 if (!result["description"].get_string().empty()) {
159 PreviewWidget timeoutsays("timeoutsays", "text");
160 timeoutsays.add_attribute_value("title", Variant("TimeOut says"));
161 timeoutsays.add_attribute_mapping("text", "description");
162 reply->push({timeoutsays});
163 }
164
165 getVenueDetails(reply);
166}
167
168void TimeoutPreview::getEventDetails(PreviewReplyProxy const& reply) {
169 Result result = PreviewQueryBase::result();
170 QString urlString(result["uri"].get_string().c_str());
171 qDebug() << "[Details] GET " << urlString;
172 QUrl url = QUrl(urlString);
173
174 QJsonValuePair response = timeout.get(url, 1);
175 QJsonObject o = response.second.toObject();
176
177 QString phone = o.value("phone").toString();
178 QString website = o.value("to_website").toString();
179 QString venueUrl = o.value("venue_urls").toArray()[0].toString();
180 QString startDate = o.value("start_date").toString();
181 QString endDate = o.value("end_date").toString();
182 QString price = o.value("price").toString();
183 QString related = o.value("related_items_url").toString();
184 QString affinitiesUrl = o.value("affinities_url").toString();
185 QString occurrencesUrl = o.value("occurrences_url").toString();
186 // occurrence_periods_url
187 //QString bookingWeb = o.value("booking_website").toString();
188 // posted_at_date
189 // annotatino (same as description?)
190
191 if (o.contains("to_opinion")) {
192 if (o.value("to_opinion").toString() == "critics_choice") {
193 PreviewWidget opinion("opinion", "text");
194 opinion.add_attribute_value("text", Variant("✔ Critics choice"));
195
196 reply->push({opinion});
197 }
198 }
199
200 qDebug() << "[Event venue] GET " << urlString;
201 response = timeout.get(QUrl(venueUrl), 1);
202 o = response.second.toObject();
203
204 QString venueName = o.value("name").toString();
205 QString address = o.value("address1").toString();
206 QString postcode = o.value("postcode").toString();
207 QString city = o.value("city").toString();
208 QString transport = o.value("transport").toString();
209
210 PreviewWidget addressLabel("addressLabel", "text");
211 addressLabel.add_attribute_value("title", VARIANT_STR(venueName));
212 QString fullAddress = QString("%1 %2").arg(address).arg(postcode);
213 addressLabel.add_attribute_value("text", VARIANT_STR(fullAddress));
214
215 // get occurrencesUrl here
216 QString showtimes = "TBD";
217
218 PreviewWidget contactButtons("contactButtons", "actions");
219 VariantBuilder contact;
220 QString fullPhone = QString("tel:///%1").arg(phone);
221 contact.add_tuple({
222 {"id", Variant("call")},
223 {"label", Variant("Call")},
224 {"uri", VARIANT_STR(fullPhone)}
225 });
226 contact.add_tuple({
227 {"id", Variant("map")},
228 {"label", Variant("Map")},
229 {"uri", Variant(QString("http://m.here.com/#action=search&params={\"query\":\"%1,%2 %3\"}")
230 .arg(address).arg(city).arg(postcode).toStdString().c_str())}
231 });
232 contact.add_tuple({
233 {"id", Variant("web")},
234 {"label", Variant("Website")},
235 {"uri", VARIANT_STR(website)}
236 });
237 contactButtons.add_attribute_value("actions", contact.end());
238
239 PreviewWidget details("details", "text");
240 details.add_attribute_value("title", Variant("Details"));
241 QString detailsText;
242// detailsText.append(QString("<strong>Showtimes</strong><br />%1<br />").arg(showtimes));
243 if (!price.isEmpty())
244 detailsText.append(QString("<strong>Price</strong><br />%1<br />").arg(price));
245 if (!transport.isEmpty())
246 detailsText.append(QString("<strong>Transport</strong><br />%1").arg(transport));
247 details.add_attribute_value("text", VARIANT_STR(detailsText));
248
249 PreviewWidget actionButtons("actionButtons", "actions");
250 VariantBuilder actionsBuilder;
251 actionsBuilder.add_tuple({
252 {"id", Variant("nearby")},
253 {"label", Variant("Nearby venues")}
254 });
255 actionsBuilder.add_tuple({
256 {"id", Variant("share")},
257 {"label", Variant("Share")}
258 });
259 actionButtons.add_attribute_value("actions", actionsBuilder.end());
260
261 //reply->push({addressLabel, contactButtons, details, actionButtons});
262 reply->push({addressLabel, contactButtons, details});
263}
264
265void TimeoutPreview::previewEvent(PreviewReplyProxy const& reply) {
266 Result result = PreviewQueryBase::result();
267 ColumnLayout one(1);
268 one.add_column({"header", "ratings", "art",
269 "addressLabel", "contactButtons",
270 "timeoutsays", "details", "actionButtons"});
271
272 ColumnLayout two(2);
273 two.add_column({"header", "ratings", "art",
274 "addressLabel"});
275 two.add_column({"contactButtons",
276 "timeoutsays", "details", "actionButtons"});
277
278
279 ColumnLayout three(3);
280 three.add_column({"header", "ratings", "art"});
281 three.add_column({"addressLabel", "contactButtons",
282 "timeoutsays"});
283 three.add_column({"details", "actionButtons"});
284 reply->register_layout({one, two, three});
285
286 PreviewWidget header("header", "header");
287 header.add_attribute_mapping("title", "title");
288 header.add_attribute_mapping("subtitle", "category_representation");
289
290 auto hasRating = this->result().contains("average");
291 auto hasTORating = this->result().contains("editorial_rating");
292 if (hasRating || hasTORating) {
293 PreviewWidget ratings("ratings", "reviews");
294 VariantBuilder ratingsBuilder;
295 if (hasTORating) {
296 ratingsBuilder.add_tuple({
297 {"author", Variant("TimeOut")},
298 {"rating", result["editorial_rating"]}
299 });
300 }
301 if (hasRating){
302 ratingsBuilder.add_tuple({
303 {"author", Variant("Users")},
304 {"rating", result["average"]}
305 });
306 }
307 ratings.add_attribute_value("reviews", ratingsBuilder.end());
308 reply->push({ratings});
309 }
310 PreviewWidget art("art", "image");
311 art.add_attribute_mapping("source", "image");
312
313 reply->push({header, art});
314
315 if (!result["description"].get_string().empty()) {
316 PreviewWidget timeoutsays("timeoutsays", "text");
317 timeoutsays.add_attribute_value("title", Variant("TimeOut says"));
318 timeoutsays.add_attribute_mapping("text", "description");
319 reply->push({timeoutsays});
320 }
321
322 getEventDetails(reply);
323}
324
325void TimeoutPreview::previewFilm(PreviewReplyProxy const& reply) {
326 Result result = PreviewQueryBase::result();
327
328 ColumnLayout one(1);
329 one.add_column({"header", "ratings", "art","FilmButtons", "timeoutsays", "timeoutsays"});
330
331 ColumnLayout two(2);
332 two.add_column({"header", "ratings", "art"});
333 two.add_column({"FilmButtons", "timeoutsays"});
334
335 ColumnLayout three(3);
336 three.add_column({"art","FilmButtons"});
337 three.add_column({"header", "ratings"});
338 three.add_column({"timeoutsays", "timeoutsays"});
339
340 reply->register_layout({one, two, three});
341
342 PreviewWidget header("header", "header");
343 header.add_attribute_mapping("title", "title");
344 header.add_attribute_mapping("subtitle", "category_representation");
345
346 auto hasRating = this->result().contains("average");
347 auto hasTORating = this->result().contains("editorial_rating");
348
349 if (hasRating || hasTORating) {
350 PreviewWidget ratings("ratings", "reviews");
351 VariantBuilder ratingsBuilder;
352 if (hasTORating) {
353 ratingsBuilder.add_tuple({
354 {"author", Variant("TimeOut")},
355 {"rating", result["editorial_rating"]}
356 });
357 }
358 if (hasRating){
359 ratingsBuilder.add_tuple({
360 {"author", Variant("Users")},
361 {"rating", result["average"]}
362 });
363 }
364 ratings.add_attribute_value("reviews", ratingsBuilder.end());
365 reply->push({ratings});
366 }
367
368 PreviewWidget art("art", "image");
369 art.add_attribute_mapping("source", "image");
370
371 reply->push({header, art});
372
373 if (!result["description"].get_string().empty()) {
374 PreviewWidget timeoutsays("timeoutsays", "text");
375 timeoutsays.add_attribute_value("title", Variant("TimeOut says"));
376 timeoutsays.add_attribute_mapping("text", "description");
377 reply->push({timeoutsays});
378 }
379
380 QString urlString(result["uri"].get_string().c_str());
381 qDebug() << "[Details] GET " << urlString;
382 QUrl url = QUrl(urlString);
383
384 QJsonValuePair response = timeout.get(url, 1);
385 QJsonObject o = response.second.toObject();
386
387 QString website = o.value("to_website").toString();
388 if (!website.isEmpty()){
389 PreviewWidget filmButtons("FilmButtons", "actions");
390 VariantBuilder filmAction;
391 filmAction.add_tuple({
392 {"id", Variant("web")},
393 {"label", Variant("More")},
394 {"uri", VARIANT_STR(website)}
395 });
396 filmButtons.add_attribute_value("actions", filmAction.end());
397 reply->push({filmButtons});
398 }
399
400}
401
402void TimeoutPreview::run(PreviewReplyProxy const& reply) {
403 Result result = PreviewQueryBase::result();
404 std::string type = result["type"].get_string();
405 qDebug() << "Previewing: " << QString(type.c_str());
406 if (type == "venue") {
407 previewVenue(reply);
408 } else if (type == "event") {
409 previewEvent(reply);
410 } else if (type == "film") {
411 previewFilm(reply);
412 }
413}
0414
=== added file 'src/TimeOut-preview.h'
--- src/TimeOut-preview.h 1970-01-01 00:00:00 +0000
+++ src/TimeOut-preview.h 2014-09-24 10:37:38 +0000
@@ -0,0 +1,46 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TIMEOUT_PREVIEW_H
19#define TIMEOUT_PREVIEW_H
20
21#include "TimeOut-client.h"
22
23#include <unity/scopes/PreviewQueryBase.h>
24#include <unity/scopes/Result.h>
25
26using namespace unity::scopes;
27
28class TimeoutPreview : public PreviewQueryBase
29{
30public:
31 TimeoutPreview(Result const&, ActionMetadata const&, TimeOut const&);
32 ~TimeoutPreview();
33
34 virtual void cancelled() override;
35 virtual void run(PreviewReplyProxy const& reply) override;
36 void getVenueDetails(PreviewReplyProxy const& reply);
37 void getEventDetails(PreviewReplyProxy const& reply);
38 void previewVenue(PreviewReplyProxy const& reply);
39 void previewEvent(PreviewReplyProxy const& reply);
40 void previewFilm(PreviewReplyProxy const& reply);
41
42private:
43 const TimeOut timeout;
44};
45
46#endif
047
=== added file 'src/TimeOut-query.cpp'
--- src/TimeOut-query.cpp 1970-01-01 00:00:00 +0000
+++ src/TimeOut-query.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,491 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "TimeOut-query.h"
19#include "TimeOut-client.h"
20
21#include <unity/scopes/Annotation.h>
22#include <unity/scopes/CategorisedResult.h>
23#include <unity/scopes/CategoryRenderer.h>
24#include <unity/scopes/QueryBase.h>
25#include <unity/scopes/SearchReply.h>
26#include <unity/scopes/Department.h>
27#include <unity/scopes/VariantBuilder.h>
28
29using namespace Qt;
30using namespace unity::scopes;
31
32std::string JOURNAL;
33std::string WIDE_ART;
34std::string HORIZONTAL_LIST;
35std::string MEDIUM_GRID;
36std::string LARGE_GRID;
37std::string CAROUSEL;
38
39const QString imageWidth = QString("{width}");
40const QString imageHeight = QString("{height}");
41
42//avoid registering multiple depts
43std::set<QString> Deptset;
44
45QString readFile(QString path) {
46 QFile file(path);
47 file.open(QIODevice::ReadOnly | QIODevice::Text);
48 QString data = file.readAll();
49 file.close();
50 return data;
51}
52
53std::string TimeoutQuery::getRenderer(QString name) {
54 QString path = QString("%1/renderer/%2.json").arg(scopePath_).arg(name);
55 qDebug() << "loading renderer " << path;
56 QString renderer = readFile(path);
57 return renderer.toStdString();
58}
59
60TimeoutQuery::TimeoutQuery(CannedQuery const& query, SearchMetadata const& metadata, TimeOut &timeout, QString scope_dir)
61 : SearchQueryBase(query, metadata), timeout(timeout), scopePath_(scope_dir) {
62 JOURNAL = getRenderer("vjournal");
63 WIDE_ART = getRenderer("wide-art");
64 MEDIUM_GRID = getRenderer("medium-grid");
65 LARGE_GRID = getRenderer("large-grid");
66 CAROUSEL = getRenderer("carousel");
67 HORIZONTAL_LIST = getRenderer("horizontal-list");
68}
69
70TimeoutQuery::~TimeoutQuery() {
71
72}
73
74void TimeoutQuery::cancelled() {
75}
76
77void set(CategorisedResult &result, std::string &key, QString &value) {
78 result[key] = value.toStdString();
79}
80
81std::string reformat(QString mytext){
82 QTextDocument text;
83 text.setHtml(mytext);
84 auto newText =text.toPlainText().toStdString();
85 return newText;
86}
87
88#define SET_RESULT(key) result[key] = o.value(key).toString().toStdString()
89#define SET_RESULT_INT(key) result[key] = o.value(key).toInt(0)
90#define SET_RESULT_REMAP(apikey, key) result[key] = o.value(apikey).toString().toStdString()
91#define SET_RESULT_FROM_JSON(apikey, key, json) result[key] = json.value(apikey).toString().toStdString()
92
93void getResultDetailsFromJson(QJsonObject const& o, CategorisedResult &result) {
94 SET_RESULT("uid");
95 SET_RESULT("id");
96 SET_RESULT("category_representation");
97 SET_RESULT("subcategory_representation");
98
99 //remove html special characters from the description
100 auto formatted_text = reformat(o.value("description").toString());
101 result["description"]=formatted_text;
102
103 SET_RESULT_REMAP("to_website", "web");
104 if (o.contains("editorial_rating")) {
105 SET_RESULT_INT("editorial_rating");
106 }
107 if (o.contains("user_ratings_summary")) {
108 QJsonObject ratings = o.value("user_ratings_summary").toObject();
109 SET_RESULT_FROM_JSON("average", "average", ratings);
110 SET_RESULT_FROM_JSON("count", "count", ratings);
111 }
112}
113
114#define SET_SIZE(pattern, w, h) pattern\
115 .replace(imageWidth, QString::number(w))\
116 .replace(imageHeight, QString::number(h))\
117 .toStdString()
118
119void getResultFromJson(QJsonArray::iterator const& it, CategorisedResult &result) {
120 QJsonObject o = (*it).toObject();
121
122 SET_RESULT_REMAP("url", "uri");
123 SET_RESULT_REMAP("name", "title");
124 QJsonObject image = o.value("image").toObject();
125 if (image.contains("url_pattern")) {
126 QJsonObject pattern = image.value("url_pattern").toObject();
127 QString urlPattern = pattern.value("value").toString();
128 result["image"] = SET_SIZE(urlPattern, 480, 360);
129 result["image-large"] = SET_SIZE(urlPattern, 800, 600);
130 result["image-small"] = SET_SIZE(urlPattern, 320, 240);
131 } else {
132 SET_RESULT_FROM_JSON("url", "image", image);
133 }
134
135 if (o.contains("type")) {
136 qDebug() << "Item contains type";
137 QString type = o.value("type").toString();
138 result["type"] = type.toStdString();
139 if (type != "curated") {
140 getResultDetailsFromJson(o, result);
141 } else {
142 //this creates a link to a department when you click on a result
143 qDebug() << "Item is a link to a category";
144 auto uri = o.value("url").toString();
145 CannedQuery catheader_query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString(), "",
146 uri.toStdString());
147 result.set_uri(catheader_query.to_uri());
148 }
149 }
150}
151
152/*
153 This is hardcoded here only temporarily for alternate content surfacing. For instance,
154 in "Restaurants and Cafes" category we used to show the list of curated lists. Being
155 temporarily limited by technical reasons, instead of showing those (which would not yet
156 open proper lists of items), we show selected subcategory from given category when surfacing."
157*/
158static const QMap<QString, QString> ALTERNATE_SURFACING {
159 {
160 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/restaurants_caf_s?locale=en-GB",
161 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/food+%26+drink/sunday_roasts_mobile?locale=en-GB"
162 },
163 {
164 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/bars_pubs?locale=en-GB",
165 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/food+%26+drink/lon_en_20120718_ipad_cocktailbars?locale=en-GB"
166 },
167 {
168 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/things_to_do?locale=en-GB",
169 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/things+to+do/london_hot_list?locale=en-GB"
170 },
171 {
172 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/art?locale=en-GB",
173 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/art+%26+culture/art_best_new_art?locale=en-GB"
174 },
175 {
176 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/theatre_dance?locale=en-GB",
177 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/art+%26+culture/theatre_critics_choice_new_shows?locale=en-GB"
178 },
179 {
180 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/muisc_nightlife?locale=en-GB",
181 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/music+%26+nightlife/clubs_app?locale=en-GB"
182 },
183 {
184 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/editorial+lists/shopping_style?locale=en-GB",
185 "http://graffiti.timeout.com/v1/mobile/uk-london/curateds/shopping+%26+lifestyle/department_stores?locale=en-GB"
186 }
187};
188
189#define FOREACH_JSON(it, results) for (QJsonArray::iterator it = results.begin(); it != results.end(); ++it)
190
191void TimeoutQuery::getGeneric(TimeOut const& timeout, QString &url, std::string &categoryJson,
192 QString &id, QString &title, SearchReplyProxy const& reply) {
193
194 qDebug() << "category id is " << id;
195 CannedQuery catheader_query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString(), "",
196 url.toStdString());
197
198 CategoryRenderer renderer(categoryJson);
199 Category::SCPtr category;
200
201 if (title.isEmpty()) {
202 category= reply->register_category(
203 id.toStdString(), title.toStdString(), "", renderer);
204 } else {
205 category= reply->register_category(
206 id.toStdString(), title.toStdString(), "",catheader_query, renderer);
207 }
208
209 QJsonValuePair response = timeout.get(QUrl(url), 1);
210 QJsonArray results = BODY(response);
211
212 FOREACH_JSON(json, results) {
213 CategorisedResult result(category);
214 getResultFromJson(json, result);
215 if (!reply->push(result)) break;
216 }
217}
218
219void TimeoutQuery::getEditorLists(TimeOut const& timeout, SearchReplyProxy const& reply) {
220 QJsonArray results = timeout.getEditorLists(1);
221 FOREACH_JSON(json, results) {
222 QJsonObject o = (*json).toObject();
223 QString uid = o.value("uid").toString();
224 if (!(uid.contains("things_to_do") || uid.contains(MAD_TTODO)))
225 continue;
226 QString listName = o.value("name").toString();
227 QString name = listName;
228 QString url = o.value("url").toString();
229 if (uid.contains(MAD_TTODO)) uid =+ "things_to_do";
230 std::string category = WIDE_ART;
231 getGeneric(timeout, url, category, uid, name, reply);
232 }
233
234 FOREACH_JSON(json, results) {
235 QJsonObject o = (*json).toObject();
236 QString uid = o.value("uid").toString();
237 if (uid.contains("things_to_do"))
238 continue;
239 QString listName = o.value("name").toString();
240 QString name = listName;
241 QString url = o.value("url").toString();
242 if (uid.contains(MAD_BAR)) uid =+ "bars";
243 if (uid.contains(MAD_RESTAURANTS)) uid =+ "restaurants";
244 if (uid.contains(MAD_SHOPPING)) uid =+ "shopping";
245 qDebug() << "Category id is " << uid;
246
247 std::string category = MEDIUM_GRID;
248 getGeneric(timeout, url, category, uid, name, reply);
249 }
250}
251
252void TimeoutQuery::getCitySurface(TimeOut timeout, SearchReplyProxy reply) {
253 CategoryRenderer renderer(JOURNAL);
254 auto citiesCat = reply->register_category("cities", "", "", renderer);
255 auto citiesArt =timeout.getCityLogos();
256 auto cities = timeout.getSupportedCities();
257 for (unsigned int i = 0; i < cities.size(); i++) {
258 CategorisedResult result(citiesCat);
259 CannedQuery city_query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString(), "",
260 ("city:"+ cities[i].url).toStdString());
261 result.set_uri(city_query.to_uri());
262 QString city_name = cities[i].name;
263 result["image-small"]=citiesArt[city_name].toStdString();
264 result["title"]=city_name.toStdString();
265
266 reply->push(result);
267 }
268
269}
270void TimeoutQuery::getEditorPicks(TimeOut const& timeout, SearchReplyProxy const& reply) {
271 CategoryRenderer renderer(HORIZONTAL_LIST);
272 auto editorPicks = reply->register_category("editor-picks", "", "", renderer);
273 QJsonArray results = timeout.getEditorPicks(1);
274
275 qDebug() << "Got editors picks";
276 FOREACH_JSON(json, results) {
277 QJsonObject o = (*json).toObject();
278 QString type = o.value("type").toString();
279 // FIXME filtering out type:curated for now. Needs activation.
280 if (type == "curated") continue;
281
282 CategorisedResult result(editorPicks);
283 getResultFromJson(json, result);
284 if (!reply->push(result)) break;
285 }
286}
287
288void TimeoutQuery::search(TimeOut const& timeout, SearchReplyProxy const& reply) {
289 CannedQuery cannedQuery = SearchQueryBase::query();
290 QString query = QString::fromStdString(cannedQuery.query_string());
291 QString title = QString("Results for %1:").arg(query);
292
293 CategoryRenderer renderer(JOURNAL);
294 auto search = reply->register_category("search", title.toStdString(), "", renderer);
295
296 QJsonArray results = timeout.search(query, 1);
297 FOREACH_JSON(json, results) {
298 QJsonObject o = (*json).toObject();
299 QString type = o.value("type").toString();
300
301 CategorisedResult result(search);
302 getResultFromJson(json, result);
303 if (!reply->push(result)) break;
304 }
305}
306
307const int MAX_DEPT_NAME = 45;
308
309void setSubdepartments(TimeOut const& timeout, Department::SPtr const& parent, QString &/*id*/,
310 QString &/*title*/, QUrl const& url, SearchReplyProxy const& /*reply*/) {
311 DepartmentList depts;
312
313 QJsonValuePair response = timeout.get(QUrl(url), 1);
314 QJsonArray results = BODY(response);
315
316 FOREACH_JSON(json, results) {
317 QJsonObject o = (*json).toObject();
318 QString uid = o.value("uid").toString();
319 QString name = o.value("name").toString();
320 QString url = o.value("url").toString();
321 QString type = o.value("type").toString();
322
323 if (name.length() > MAX_DEPT_NAME) {
324 name = name.left(MAX_DEPT_NAME) + "...";
325 }
326
327 if (type == "curated") {
328 CannedQuery query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString());
329 if (Deptset.find(url) != Deptset.end()) {
330 qDebug()<<"duplicated dept " << url;
331 continue;
332 }
333 Deptset.insert(url);
334 query.set_department_id(url.toStdString());
335 query.set_query_string(url.toStdString());
336 Department::SPtr dept(Department::create(url.toStdString(), query, name.toStdString()));
337 depts.push_back(dept);
338 }
339 }
340 depts.unique();
341 if (depts.size() >0)
342 parent->set_subdepartments(depts);
343}
344
345void setDepartmentsFromEditorLists(TimeOut timeout, Department::SPtr parent,
346 SearchReplyProxy reply, QString city_url) {
347 Deptset.clear();
348 DepartmentList depts;
349 qDebug()<<"Retriving departments";
350 timeout.useAlternateCity(city_url);
351 QJsonArray results = timeout.getEditorLists(1);
352 FOREACH_JSON(json, results) {
353 QJsonObject o = (*json).toObject();
354 QString uid = o.value("uid").toString();
355 QString name = o.value("name").toString();
356 QString url = o.value("url").toString();
357 QString type = o.value("type").toString();
358
359 qDebug() << " DeptId is " << url;
360
361 if (name.length() > MAX_DEPT_NAME) {
362 name = name.left(MAX_DEPT_NAME) + "...";
363 }
364
365 if (type == "curated") {
366 CannedQuery query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString());
367 if (Deptset.find(url) != Deptset.end()) {
368 qDebug()<<"duplicated dept " << url;
369 continue;
370 }
371 Deptset.insert(url);
372 query.set_department_id(url.toStdString());
373 query.set_query_string(url.toStdString());
374
375 Department::SPtr dept(Department::create(url.toStdString(), query, name.toStdString()));
376 depts.push_back(dept);
377 setSubdepartments(timeout, dept, uid, name, url, reply);
378 }
379 }
380 depts.unique();
381 parent->set_subdepartments(depts);
382}
383
384void TimeoutQuery::getDepartments(SearchReplyProxy const& reply, bool inCity, QString expandUrl) {
385 DepartmentList depts;
386
387 qDebug() << "City found is " << inCity << "url is " <<expandUrl;
388 //clear previous dept sets
389 Deptset.clear();
390 QString cityUrl = timeout.getCityUrl();
391
392 Department::SPtr moreCities;
393 Department::SPtr topDept;
394 Department::SPtr expandCity;
395
396
397 CannedQuery topQuery((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString());
398 topQuery.set_department_id("");
399
400 //get list of cities
401 std::vector<CityType> list_cities = timeout.getSupportedCities();
402
403 for (unsigned int i = 0; i < list_cities.size(); i++) {
404 CannedQuery query((SCOPE_PACKAGE+"_"+SCOPE_NAME).toStdString());
405 query.set_department_id(list_cities[i].name.toStdString());
406 query.set_query_string(list_cities[i].url.toStdString());
407
408 Department::SPtr dept(Department::create(("city:" + list_cities[i].url).toStdString(), query, list_cities[i].name.toStdString()));
409 dept->set_has_subdepartments(true);
410
411 //check if it is the dept I need to expand
412 if (expandUrl == list_cities[i].url)
413 expandCity = dept;
414
415 //check if it is the root dept
416 if (!(inCity && cityUrl == list_cities[i].url))
417 depts.push_back(dept);
418
419 }
420
421 if (inCity){
422 Department::SPtr rootDept(Department::create("", topQuery, timeout.getCityName().toStdString()));
423 Department::SPtr moreDept(Department::create("moreCities", topQuery, "More Cities"));
424 moreDept->set_subdepartments(depts);
425 setDepartmentsFromEditorLists(timeout, rootDept, reply, cityUrl);
426 rootDept->add_subdepartment(moreDept);
427 topDept = rootDept;
428
429 } else {
430 Department::SPtr rootDept(Department::create("", topQuery, "Pick a city"));
431 rootDept->set_subdepartments(depts);
432 topDept = rootDept;
433 }
434 if(expandUrl != cityUrl)
435 setDepartmentsFromEditorLists(timeout, expandCity, reply, expandUrl);
436
437 reply->register_departments(topDept);
438}
439
440void TimeoutQuery::run(SearchReplyProxy const& reply) {
441
442
443 auto mylang = QString::fromStdString(search_metadata().locale()).left(2);
444 qDebug() << "language is " <<mylang;
445 timeout.setLocale(mylang);
446 try {
447 timeout.setLocation(search_metadata().location().latitude(),search_metadata().location().longitude());
448 } catch (const std::exception &e) {
449 // timeout.setLocation(0,0);
450 }
451
452 CannedQuery query = SearchQueryBase::query();
453 QString queryString = QString::fromStdString(query.query_string());
454 QString deptId = QString::fromStdString(query.department_id());
455 auto city_found = timeout.setupCity();
456 qDebug() << "city is " << timeout.getCityUrl();
457
458 if (queryString.length() == 0) {
459 if (deptId == "") {
460 getDepartments(reply, city_found, timeout.getCityUrl());
461 qDebug() << "Empty search - doing surfacing instead";
462 if (city_found){
463 getEditorPicks(timeout, reply);
464 getEditorLists(timeout, reply);
465 } else {
466 getCitySurface(timeout, reply);
467 }
468 return;
469 }
470 if (deptId.contains("city:")) {
471 auto cityUrl = deptId.right(deptId.size()-5);
472 getDepartments(reply, city_found, cityUrl);
473 timeout.useAlternateCity(cityUrl);
474 getEditorPicks(timeout, reply);
475 getEditorLists(timeout, reply);
476 return;
477 }
478 if (deptId.contains("moreCities")) {
479 getDepartments(reply, city_found,timeout.getCityUrl());
480 return;
481 }
482 auto cityUrl = timeout.getCityFromUrl(deptId);
483 getDepartments(reply, city_found,cityUrl);
484 QString url = deptId;
485 QString title = "";
486 getGeneric(timeout, url, WIDE_ART, url, title, reply);
487
488 } else {
489 search(timeout, reply);
490 }
491}
0492
=== added file 'src/TimeOut-query.h'
--- src/TimeOut-query.h 1970-01-01 00:00:00 +0000
+++ src/TimeOut-query.h 2014-09-24 10:37:38 +0000
@@ -0,0 +1,69 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TIMEOUT_QUERY_H
19#define TIMEOUT_QUERY_H
20
21#include "TimeOut-client.h"
22
23#include <unity/scopes/SearchQueryBase.h>
24#include <unity/scopes/ReplyProxyFwd.h>
25#include <unity/scopes/CategorisedResult.h>
26
27#include <QFile>
28#include <QString>
29#include <QMap>
30#include <set>
31#include <unity/scopes/Location.h>
32#include <unity/scopes/Location.h>
33#include <unity/scopes/SearchMetadata.h>
34#include <QTextDocument>
35#include <QCoreApplication>
36
37
38using namespace unity::scopes;
39
40class TimeOut;
41
42class TimeoutQuery : public SearchQueryBase
43{
44public:
45 TimeoutQuery(CannedQuery const&, SearchMetadata const&, TimeOut &, QString);
46 ~TimeoutQuery();
47 virtual void cancelled() override;
48
49 virtual void run(SearchReplyProxy const& reply) override;
50
51 void getDepartments(SearchReplyProxy const& reply, bool inCity, QString expandUrl);
52 void search(TimeOut const& timeout, SearchReplyProxy const& reply);
53 void getEditorLists(TimeOut const& timeout, SearchReplyProxy const& reply);
54 void getEditorPicks(TimeOut const& timeout, SearchReplyProxy const& reply);
55 void getGeneric(TimeOut const& timeout, QString &url, std::string &categoryJson,
56 QString &id, QString &title, SearchReplyProxy const& reply);
57 void getCitySurface(TimeOut timeout, SearchReplyProxy reply);
58
59
60
61private:
62 std::string getRenderer(QString name);
63 TimeOut timeout;
64 //avoid registering multiple depts
65 std::set<QString> Deptset;
66 QString scopePath_;
67};
68
69#endif
070
=== added file 'src/TimeOut-scope.cpp'
--- src/TimeOut-scope.cpp 1970-01-01 00:00:00 +0000
+++ src/TimeOut-scope.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,62 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "TimeOut-scope.h"
19#include "TimeOut-query.h"
20#include "TimeOut-preview.h"
21#include <unity-scopes.h>
22
23using namespace unity::scopes;
24
25void TimeoutScope::start(std::string const&) {
26 timeout.setCacheDirectory(cache_directory());
27}
28
29void TimeoutScope::stop() {
30}
31
32SearchQueryBase::UPtr TimeoutScope::search(CannedQuery const &q, SearchMetadata const& metadata) {
33 const QString scopePath = QString::fromStdString(scope_directory());
34 SearchQueryBase::UPtr query(new TimeoutQuery(q, metadata, timeout, scopePath));
35 return query;
36}
37
38PreviewQueryBase::UPtr TimeoutScope::preview(Result const& result, ActionMetadata const& metadata) {
39 PreviewQueryBase::UPtr preview(new TimeoutPreview(result, metadata, timeout));
40 return preview;
41}
42
43#define EXPORT __attribute__ ((visibility ("default")))
44
45extern "C"
46{
47
48EXPORT
49ScopeBase*
50// cppcheck-suppress unusedFunction
51UNITY_SCOPE_CREATE_FUNCTION() {
52 return new TimeoutScope();
53}
54
55EXPORT
56void
57// cppcheck-suppress unusedFunction
58UNITY_SCOPE_DESTROY_FUNCTION(ScopeBase* scope_base) {
59 delete scope_base;
60}
61
62}
063
=== added file 'src/TimeOut-scope.h'
--- src/TimeOut-scope.h 1970-01-01 00:00:00 +0000
+++ src/TimeOut-scope.h 2014-09-24 10:37:38 +0000
@@ -0,0 +1,51 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef DEMOSCOPE_H
19#define DEMOSCOPE_H
20
21#include "TimeOut-client.h"
22
23#include <unity/scopes/ScopeBase.h>
24#include <unity/scopes/QueryBase.h>
25#include <unity/scopes/ReplyProxyFwd.h>
26#include <unity/scopes/QueryBase.h>
27#include <unity/scopes/PreviewQueryBase.h>
28#include <unity/scopes/Location.h>
29#include <QCoreApplication>
30
31
32
33using namespace unity::scopes;
34
35class TimeoutScope : public unity::scopes::ScopeBase
36{
37public:
38 virtual void start(std::string const&) override;
39
40 virtual void stop() override;
41
42 PreviewQueryBase::UPtr preview(const Result&, const ActionMetadata&) override;
43
44 virtual SearchQueryBase::UPtr search(CannedQuery const& q, SearchMetadata const&) override;
45
46private:
47 TimeOut timeout;
48
49};
50
51#endif
052
=== added file 'src/TimeOut-scope.h.autosave'
--- src/TimeOut-scope.h.autosave 1970-01-01 00:00:00 +0000
+++ src/TimeOut-scope.h.autosave 2014-09-24 10:37:38 +0000
@@ -0,0 +1,50 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef DEMOSCOPE_H
19#define DEMOSCOPE_H
20
21#include "TimeOut-client.h"
22
23#include <unity/scopes/ScopeBase.h>
24#include <unity/scopes/QueryBase.h>
25#include <unity/scopes/ReplyProxyFwd.h>
26#include <unity/scopes/QueryBase.h>
27#include <unity/scopes/PreviewQueryBase.h>
28#include <unity/scopes/Location.h>
29
30
31
32using namespace unity::scopes;
33
34class TimeoutScope : public unity::scopes::ScopeBase
35{
36public:
37 virtual void start(std::string const&) override;
38
39 virtual void stop() override;
40
41 PreviewQueryBase::UPtr preview(const Result&, const ActionMetadata&) override;
42
43 virtual SearchQueryBase::UPtr search(CannedQuery const& q, SearchMetadata const&) override;
44
45private:
46 TimeOut timeout;
47
48};
49
50#endif
051
=== added file 'src/com.canonical.scopes.timeout_timeout.ini'
--- src/com.canonical.scopes.timeout_timeout.ini 1970-01-01 00:00:00 +0000
+++ src/com.canonical.scopes.timeout_timeout.ini 2014-09-24 10:37:38 +0000
@@ -0,0 +1,13 @@
1[ScopeConfig]
2DisplayName = TimeOut
3Description = This is an Ubuntu search plugin that enables information from TimeOut to be searched and displayed in the Dash. If you do not wish to search this content source, you can disable this search plugin.
4Icon = icon.png
5Author = Canonical Ltd.
6SearchHint = Search TimeOut
7LocationDataNeeded=true
8[Appearance]
9Background = color:///#000000
10PageHeader.Logo = logo.png
11PageHeader.Background = color:///#000000
12PageHeader.ForegroundColor = #FFFFFF
13BackgroundColor = #FFFFFF
014
=== added file 'src/com.canonical.scopes.timeout_timeout_automoc.cpp'
--- src/com.canonical.scopes.timeout_timeout_automoc.cpp 1970-01-01 00:00:00 +0000
+++ src/com.canonical.scopes.timeout_timeout_automoc.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,2 @@
1/* This file is autogenerated, do not edit*/
2enum some_compilers { need_more_than_nothing };
03
=== added file 'src/config.h.in'
--- src/config.h.in 1970-01-01 00:00:00 +0000
+++ src/config.h.in 2014-09-24 10:37:38 +0000
@@ -0,0 +1,47 @@
1/*
2 * This file is part of Ubuntu TimeOut Scope.
3 * Copyright 2014 Canonical Ltd.
4 *
5 * TimeOut Scope is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 *
9 * TimeOut Scope is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with TimeOut Scope. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <QString>
22
23/*** Please edit this section. ***/
24const QString HOME_URL = "http://timeout.com/";
25const QString MOBILE_URL = "http://m.timeout.com/";
26const QString SURFACING_LAYOUT = "wide-art";
27const QString READ_MORE = "Read more...";
28const QString NO_CONNECTION = "No connection.";
29const QString RESULTS = "Results:";
30const QString ERROR = "Error";
31
32// If false, your first department will become your top (root) department.
33//const bool BROWSE_AT_ROOT = true;
34//const QString BROWSE = "Browse";
35
36/*** DO NOT edit this section! ***/
37const QString SCOPE_TITLE = "@SCOPE_TITLE@";
38const QString SCOPE_PACKAGE = "@SCOPE_PACKAGE@";
39const QString SCOPE_NAME = "@SCOPE_NAME@";
40
41//WORK AROUND MADRID IUDs
42const QString MAD_SHOPPING = "tiendas";
43const QString MAD_BAR = "bares";
44const QString MAD_TTODO = "qu_hacer";
45const QString MAD_RESTAURANTS = "restaurantes";
46
47#endif
048
=== added file 'src/timeout.ini'
--- src/timeout.ini 1970-01-01 00:00:00 +0000
+++ src/timeout.ini 2014-09-24 10:37:38 +0000
@@ -0,0 +1,13 @@
1[ScopeConfig]
2DisplayName = TimeOut
3Description = This is an Ubuntu search plugin that enables information from TimeOut to be searched and displayed in the Dash. If you do not wish to search this content source, you can disable this search plugin.
4Icon = icon.png
5Author = Canonical Ltd.
6SearchHint = Search TimeOut
7LocationDataNeeded=true
8[Appearance]
9Background = color:///#000000
10PageHeader.Logo = /opt/click.ubuntu.com/com.canonical.scopes.timeout/current/images/logo.png
11PageHeader.Background = color:///#000000
12PageHeader.ForegroundColor = #FFFFFF
13BackgroundColor = #FFFFFF
014
=== added file 'src/timeout_automoc.cpp'
--- src/timeout_automoc.cpp 1970-01-01 00:00:00 +0000
+++ src/timeout_automoc.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,2 @@
1/* This file is autogenerated, do not edit*/
2enum some_compilers { need_more_than_nothing };
03
=== added directory 'test'
=== added file 'test/CMakeLists.txt'
--- test/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ test/CMakeLists.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,24 @@
1if (NOT DEFINED GMOCK_ROOT)
2 set(GMOCK_ROOT /usr/src/gmock)
3endif()
4add_subdirectory(${GMOCK_ROOT} gmock)
5include_directories(${GMOCK_ROOT}/gtest/include)
6
7set(gtest_libs gtest gmock gmock_main)
8foreach(target ${gtest_libs})
9 set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -Wno-missing-declarations")
10endforeach()
11
12add_subdirectory(files)
13
14include_directories(${UNITY_INCLUDE_DIRS})
15find_package(Qt5Network REQUIRED)
16
17add_executable(test-timeout-client
18 test-timeout-client.cpp
19 ../src/TimeOut-client.cpp
20)
21
22qt5_use_modules(test-timeout-client Network)
23target_link_libraries(test-timeout-client ${UNITY_LDFLAGS} ${gtest_libs})
24add_test(test-timeout-client test-timeout-client)
025
=== added directory 'test/files'
=== added file 'test/files/CMakeLists.txt'
--- test/files/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ test/files/CMakeLists.txt 2014-09-24 10:37:38 +0000
@@ -0,0 +1,1 @@
1configure_file(response-mobile.json ${CMAKE_CURRENT_BINARY_DIR}/response-mobile.json COPYONLY)
02
=== added file 'test/files/response-mobile.json'
=== added file 'test/test-timeout-client.cpp'
--- test/test-timeout-client.cpp 1970-01-01 00:00:00 +0000
+++ test/test-timeout-client.cpp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,16 @@
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <QFile>
5
6#include "../src/TimeOut-client.h"
7
8using ::testing::_;
9
10TEST(TimeOut, getCities) {
11}
12
13int main(int argc, char **argv) {
14 ::testing::InitGoogleTest(&argc, argv);
15 return RUN_ALL_TESTS();
16}
017
=== added file 'timeout-scope.json'
--- timeout-scope.json 1970-01-01 00:00:00 +0000
+++ timeout-scope.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,6 @@
1{
2 "policy_groups": [
3 "networking"
4 ],
5 "policy_version": 1.1
6}
0\ No newline at end of file7\ No newline at end of file
18
=== added file 'timeout.cbp'
--- timeout.cbp 1970-01-01 00:00:00 +0000
+++ timeout.cbp 2014-09-24 10:37:38 +0000
@@ -0,0 +1,199 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2<CodeBlocks_project_file>
3 <FileVersion major="1" minor="6" />
4 <Project>
5 <Option title="timeout" />
6 <Option makefile_is_custom="1" />
7 <Option compiler="gcc" />
8 <Option virtualFolders="CMake Files\;CMake Files\src\;CMake Files\..\;CMake Files\..\..\;CMake Files\..\..\..\;CMake Files\..\..\..\..\;CMake Files\..\..\..\..\usr\;CMake Files\..\..\..\..\usr\lib\;CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\;CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\;CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Network\;CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\;CMake Files\data\;" />
9 <Build>
10 <Target title="all">
11 <Option working_dir="/home/victorp/qtworkspace/timeout" />
12 <Option type="4" />
13 <MakeCommands>
14 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 all" />
15 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
16 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
17 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
18 </MakeCommands>
19 </Target>
20 <Target title="install">
21 <Option working_dir="/home/victorp/qtworkspace/timeout" />
22 <Option type="4" />
23 <MakeCommands>
24 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 install" />
25 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
26 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
27 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
28 </MakeCommands>
29 </Target>
30 <Target title="install/local">
31 <Option working_dir="/home/victorp/qtworkspace/timeout" />
32 <Option type="4" />
33 <MakeCommands>
34 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 install/local" />
35 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
36 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
37 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
38 </MakeCommands>
39 </Target>
40 <Target title="install/strip">
41 <Option working_dir="/home/victorp/qtworkspace/timeout" />
42 <Option type="4" />
43 <MakeCommands>
44 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 install/strip" />
45 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
46 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
47 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
48 </MakeCommands>
49 </Target>
50 <Target title="list_install_components">
51 <Option working_dir="/home/victorp/qtworkspace/timeout" />
52 <Option type="4" />
53 <MakeCommands>
54 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 list_install_components" />
55 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
56 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
57 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
58 </MakeCommands>
59 </Target>
60 <Target title="rebuild_cache">
61 <Option working_dir="/home/victorp/qtworkspace/timeout" />
62 <Option type="4" />
63 <MakeCommands>
64 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 rebuild_cache" />
65 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
66 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
67 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/Makefile&quot; VERBOSE=1 clean" />
68 </MakeCommands>
69 </Target>
70 <Target title="timeout">
71 <Option output="/home/victorp/qtworkspace/timeout/src/libtimeout.so" prefix_auto="0" extension_auto="0" />
72 <Option working_dir="/home/victorp/qtworkspace/timeout/src" />
73 <Option object_output="./" />
74 <Option type="3" />
75 <Option compiler="gcc" />
76 <Compiler>
77 <Add option="-DQT_NETWORK_LIB" />
78 <Add option="-DQT_CORE_LIB" />
79 <Add option="-DQT_NO_KEYWORDS" />
80 <Add option="-DQT_NO_DEBUG" />
81 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2" />
82 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2/arm-linux-gnueabihf" />
83 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2/backward" />
84 <Add directory="/usr/include" />
85 <Add directory="/usr/include/arm-linux-gnueabihf" />
86 <Add directory="/usr/include/arm-linux-gnueabihf/qt5" />
87 <Add directory="/usr/include/arm-linux-gnueabihf/qt5/QtCore" />
88 <Add directory="/usr/include/arm-linux-gnueabihf/qt5/QtNetwork" />
89 <Add directory="/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++" />
90 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/include" />
91 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include" />
92 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include-fixed" />
93 </Compiler>
94 <MakeCommands>
95 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 timeout" />
96 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
97 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
98 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
99 </MakeCommands>
100 </Target>
101 <Target title="timeout/fast">
102 <Option output="/home/victorp/qtworkspace/timeout/src/libtimeout.so" prefix_auto="0" extension_auto="0" />
103 <Option working_dir="/home/victorp/qtworkspace/timeout/src" />
104 <Option object_output="./" />
105 <Option type="3" />
106 <Option compiler="gcc" />
107 <Compiler>
108 <Add option="-DQT_NETWORK_LIB" />
109 <Add option="-DQT_CORE_LIB" />
110 <Add option="-DQT_NO_KEYWORDS" />
111 <Add option="-DQT_NO_DEBUG" />
112 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2" />
113 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2/arm-linux-gnueabihf" />
114 <Add directory="/usr/arm-linux-gnueabihf/include/c++/4.8.2/backward" />
115 <Add directory="/usr/include" />
116 <Add directory="/usr/include/arm-linux-gnueabihf" />
117 <Add directory="/usr/include/arm-linux-gnueabihf/qt5" />
118 <Add directory="/usr/include/arm-linux-gnueabihf/qt5/QtCore" />
119 <Add directory="/usr/include/arm-linux-gnueabihf/qt5/QtNetwork" />
120 <Add directory="/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++" />
121 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/include" />
122 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include" />
123 <Add directory="/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include-fixed" />
124 </Compiler>
125 <MakeCommands>
126 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 timeout/fast" />
127 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
128 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
129 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
130 </MakeCommands>
131 </Target>
132 <Target title="timeout_automoc">
133 <Option working_dir="/home/victorp/qtworkspace/timeout/src" />
134 <Option type="4" />
135 <MakeCommands>
136 <Build command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 timeout_automoc" />
137 <CompileFile command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 &quot;$file&quot;" />
138 <Clean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
139 <DistClean command="/usr/bin/make -f &quot;/home/victorp/qtworkspace/timeout/src/Makefile&quot; VERBOSE=1 clean" />
140 </MakeCommands>
141 </Target>
142 </Build>
143 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-client.cpp">
144 </Unit>
145 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-preview.cpp">
146 </Unit>
147 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-query.cpp">
148 </Unit>
149 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-scope.cpp">
150 </Unit>
151 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-client.h">
152 </Unit>
153 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-preview.h">
154 </Unit>
155 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-query.h">
156 </Unit>
157 <Unit filename="/home/victorp/qtworkspace/timeout/src/TimeOut-scope.h">
158 </Unit>
159 <Unit filename="/home/victorp/qtworkspace/timeout/CMakeLists.txt">
160 <Option virtualFolder="CMake Files\" />
161 </Unit>
162 <Unit filename="/home/victorp/qtworkspace/timeout/manifest.json.in">
163 <Option virtualFolder="CMake Files\" />
164 </Unit>
165 <Unit filename="/home/victorp/qtworkspace/timeout/src/CMakeLists.txt">
166 <Option virtualFolder="CMake Files\src\" />
167 </Unit>
168 <Unit filename="/home/victorp/qtworkspace/timeout/src/config.h.in">
169 <Option virtualFolder="CMake Files\src\" />
170 </Unit>
171 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Network/Qt5NetworkConfigVersion.cmake">
172 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Network\" />
173 </Unit>
174 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Network/Qt5NetworkConfig.cmake">
175 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Network\" />
176 </Unit>
177 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfigVersion.cmake">
178 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\" />
179 </Unit>
180 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfig.cmake">
181 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\" />
182 </Unit>
183 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfigExtras.cmake">
184 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\" />
185 </Unit>
186 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake">
187 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\" />
188 </Unit>
189 <Unit filename="/home/victorp/qtworkspace/timeout/../../../../usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreMacros.cmake">
190 <Option virtualFolder="CMake Files\..\..\..\..\usr\lib\arm-linux-gnueabihf\cmake\Qt5Core\" />
191 </Unit>
192 <Unit filename="/home/victorp/qtworkspace/timeout/data/CMakeLists.txt">
193 <Option virtualFolder="CMake Files\data\" />
194 </Unit>
195 <Unit filename="/home/victorp/qtworkspace/timeout/data/timeout.ini.in">
196 <Option virtualFolder="CMake Files\data\" />
197 </Unit>
198 </Project>
199</CodeBlocks_project_file>
0200
=== added file 'timeout.json'
--- timeout.json 1970-01-01 00:00:00 +0000
+++ timeout.json 2014-09-24 10:37:38 +0000
@@ -0,0 +1,6 @@
1{
2 "policy_groups": [
3 "networking"
4 ],
5 "policy_version": 1.1
6}
0\ No newline at end of file7\ No newline at end of file

Subscribers

People subscribed via source and target branches