Merge lp:~vthompson/ubuntu-weather-app/reboot-small-homehourly-tweak into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Victor Thompson
Status: Superseded
Proposed branch: lp:~vthompson/ubuntu-weather-app/reboot-small-homehourly-tweak
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 6484 lines (+6097/-0) (has conflicts)
68 files modified
.bzrignore (+19/-0)
CMakeLists.txt (+108/-0)
COPYING (+674/-0)
README (+11/-0)
README.translations (+40/-0)
app/CMakeLists.txt (+18/-0)
app/components/CMakeLists.txt (+7/-0)
app/components/DayDelegate.qml (+95/-0)
app/components/FastScroll.js (+130/-0)
app/components/FastScroll.qml (+321/-0)
app/components/HeaderRow.qml (+65/-0)
app/components/HomeGraphic.qml (+38/-0)
app/components/HomeHourly.qml (+96/-0)
app/components/HomeTempInfo.qml (+73/-0)
app/components/ListItemActions/CMakeLists.txt (+5/-0)
app/components/ListItemActions/CheckBox.qml (+25/-0)
app/components/ListItemActions/Remove.qml (+27/-0)
app/components/ListItemReorderComponent.qml (+106/-0)
app/components/ListItemWithActions.qml (+496/-0)
app/components/MultiSelectHeadState.qml (+72/-0)
app/components/MultiSelectListView.qml (+52/-0)
app/components/PageWithBottomEdge.qml (+411/-0)
app/components/WeatherListItem.qml (+139/-0)
app/components/WeatherListView.qml (+32/-0)
app/data/CMakeLists.txt (+5/-0)
app/data/CitiesList.js (+65/-0)
app/data/Storage.qml (+189/-0)
app/data/WeatherApi.js (+744/-0)
app/data/key.js (+1/-0)
app/graphics/CMakeLists.txt (+5/-0)
app/graphics/clouds.svg (+22/-0)
app/graphics/cloudy-night.svg (+38/-0)
app/graphics/cloudy.svg (+12/-0)
app/graphics/fog.svg (+13/-0)
app/graphics/partly-cloudy.svg (+21/-0)
app/graphics/rain.svg (+22/-0)
app/graphics/snow.svg (+21/-0)
app/graphics/starry.svg (+22/-0)
app/graphics/sunny.svg (+13/-0)
app/graphics/thunder.svg (+14/-0)
app/graphics/windy-snow.svg (+42/-0)
app/ubuntu-weather-app.qml (+237/-0)
app/ui/AddLocationPage.qml (+281/-0)
app/ui/CMakeLists.txt (+7/-0)
app/ui/HomePage.qml (+148/-0)
app/ui/LocationPane.qml (+183/-0)
app/ui/LocationsPage.qml (+152/-0)
app/ui/SettingsPage.qml (+61/-0)
app/ui/settings/CMakeLists.txt (+5/-0)
app/ui/settings/DataProviderPage.qml (+53/-0)
app/ui/settings/RefreshIntervalPage.qml (+56/-0)
app/ui/settings/UnitsPage.qml (+77/-0)
backend/CMakeLists.txt (+29/-0)
debian/changelog (+173/-0)
debian/compat (+1/-0)
debian/control (+41/-0)
debian/copyright (+54/-0)
debian/rules (+14/-0)
debian/source/format (+1/-0)
debian/ubuntu-weather-app-autopilot.install (+1/-0)
debian/ubuntu-weather-app.install (+1/-0)
manifest.json.in (+23/-0)
po/CMakeLists.txt (+33/-0)
po/com.ubuntu.weather.pot (+128/-0)
tests/CMakeLists.txt (+3/-0)
tests/autopilot/CMakeLists.txt (+8/-0)
ubuntu-weather-app.apparmor (+6/-0)
ubuntu-weather-app.desktop.in.in (+12/-0)
Conflict adding file .bzrignore.  Moved existing file to .bzrignore.moved.
Conflict adding file CMakeLists.txt.  Moved existing file to CMakeLists.txt.moved.
Conflict adding file COPYING.  Moved existing file to COPYING.moved.
Conflict adding file README.  Moved existing file to README.moved.
Conflict adding file README.translations.  Moved existing file to README.translations.moved.
Conflict adding file debian.  Moved existing file to debian.moved.
Conflict adding file po.  Moved existing file to po.moved.
Conflict adding file tests.  Moved existing file to tests.moved.
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/reboot-small-homehourly-tweak
Reviewer Review Type Date Requested Status
Ubuntu Weather Developers Pending
Review via email: mp+253463@code.launchpad.net

This proposal has been superseded by a proposal from 2015-03-19.

Commit message

* Do not show divider on first HomeHourly delegate.
* Make dividers lighter.

Description of the change

* Do not show divider on first HomeHourly delegate.
* Make dividers lighter.

To post a comment you must log in.

Unmerged revisions

24. By Victor Thompson

* Do not show divider on first HomeHourly delegate.
* Make dividers lighter.

23. By Victor Thompson

* Fix eliding on LocationsPage
* Hide condition data on LocationsPage when in multiselect mode.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

22. By Victor Thompson

* Revert WorkerScript, but still initialize app with stored data. Fixes: https://bugs.launchpad.net/bugs/1432260.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

21. By Martin Borho

To prevent a blank app at startup:

* reimplemented worker calls for data requests
* starts up the app with stored data and spins off a refresh request in a worker
.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

20. By Victor Thompson

Add current temps to the Locations page.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

19. By Victor Thompson

* Add pull to refresh support. Fixes: https://bugs.launchpad.net/bugs/1429484.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

18. By Martin Borho

Some fixes related to data backend and data format:

* added missing settings.interval value to request parameters in data client
* respect caching after adding a new location
* updated refresh interval choices to maintain netiquette (OWM/TWC): 5 min too small, should be 10min at least (TWC)
* alignment of data format for TWC/OWM for condition-phrase, updated RESPONSE_DATA_VERSION to force a refresh at start
* do refresh only from storage after a unit-setting change.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

17. By Nekhelesh Ramananthan

This MP brings the Add Location Page more in line with Clock app's own add city page to maintain consistency. Also there was no design specified for the add location page in weather app's design spec.

- Added fast scroll to add location page
- Renamed AddPage.qml to AddLocationPage.qml to be more specific
- Added section headers to listview
- Removed focus on search textfield immediately after opening the add location page. The reasoning here being that we show a list of cities that the user can choose from. Only if doesnt find his city there should he resort to searching online.
- Moved the search textfield to a component to allow for dynamic loading.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

16. By Nekhelesh Ramananthan

Fxied the broken settings page links and also renamed Settings folder to settings to maintain consistency.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

15. By Andrew Hayzen

* Added multiselect/swipe delete and reorder support to locations list
* Added a few FIXMEs to fix in future mps.

Approved by Martin Borho, Ubuntu Phone Apps Jenkins Bot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2015-03-19 04:32:18 +0000
4@@ -0,0 +1,19 @@
5+*.user*
6+debian/files
7+debian/tmp
8+debian/ubuntu-weather-app*
9+debian/app-template/
10+debian/*.debhelper.log
11+debian/*.substvars
12+.build
13+Makefile
14+CMakeCache.txt
15+CMakeFiles/
16+*.cmake
17+*.gmo
18+*.mo
19+*.desktop
20+*.desktop.in
21+*.desktop.in.in.h
22+.excludes
23+ubuntu-weather-app.json
24
25=== renamed file '.bzrignore' => '.bzrignore.moved'
26=== added file 'CMakeLists.txt'
27--- CMakeLists.txt 1970-01-01 00:00:00 +0000
28+++ CMakeLists.txt 2015-03-19 04:32:18 +0000
29@@ -0,0 +1,108 @@
30+project(com.ubuntu.weather)
31+cmake_minimum_required(VERSION 2.8.9)
32+
33+find_program(INTLTOOL_MERGE intltool-merge)
34+if(NOT INTLTOOL_MERGE)
35+ message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
36+endif()
37+find_program(INTLTOOL_EXTRACT intltool-extract)
38+if(NOT INTLTOOL_EXTRACT)
39+ message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
40+endif()
41+
42+set (UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Relative path to the manifest file")
43+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
44+
45+find_package(Qt5Core REQUIRED)
46+find_package(Qt5Qml REQUIRED)
47+find_package(Qt5Quick REQUIRED)
48+
49+# Automatically create moc files
50+set(CMAKE_AUTOMOC ON)
51+
52+option(INSTALL_TESTS "Install the tests on make install" on)
53+option(CLICK_MODE "Build as a click package" on)
54+
55+# Tests
56+enable_testing()
57+
58+# Standard install paths
59+include(GNUInstallDirs)
60+
61+set(APP_NAME weather)
62+set(APP_HARDCODE ubuntu-weather-app)
63+set(MAIN_QML ${APP_HARDCODE}.qml)
64+set(DESKTOP_FILE "${APP_HARDCODE}.desktop")
65+set(ICON weather-app@30.png)
66+set(AUTOPILOT_DIR ubuntu_weather_app)
67+
68+# Set install paths
69+if(CLICK_MODE)
70+ set(CMAKE_INSTALL_PREFIX "/")
71+ set(UBUNTU-WEATHER_APP_DIR "${CMAKE_INSTALL_DATADIR}/qml")
72+
73+ set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}")
74+ set(EXEC "qmlscene $@ ${UBUNTU-WEATHER_APP_DIR}/${MAIN_QML}")
75+ set(MODULE_PATH ${QT_IMPORTS_DIR})
76+ if(NOT BZR_REVNO)
77+ execute_process(
78+ COMMAND bzr revno
79+ OUTPUT_VARIABLE BZR_REVNO
80+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
81+ OUTPUT_STRIP_TRAILING_WHITESPACE
82+ )
83+ endif(NOT BZR_REVNO)
84+ if(NOT BZR_SOURCE)
85+ set(BZR_SOURCE "lp:${APP_HARDCODE}/reboot")
86+ message("-- Setting BZR_SOURCE to ${BZR_SOURCE}")
87+ endif(NOT BZR_SOURCE)
88+else(CLICK_MODE)
89+ set(UBUNTU-WEATHER_APP_DIR "${CMAKE_INSTALL_DATADIR}/ubuntu-weather-app")
90+ execute_process(
91+ COMMAND qmake -query QT_INSTALL_QML
92+ OUTPUT_VARIABLE QT_IMPORTS_DIR
93+ OUTPUT_STRIP_TRAILING_WHITESPACE
94+ )
95+ set(MODULE_PATH ${QT_IMPORTS_DIR}/WeatherApp)
96+endif(CLICK_MODE)
97+
98+if(${CLICK_MODE})
99+ message("-- Configuring manifest.json")
100+
101+ execute_process(
102+ COMMAND dpkg-architecture -qDEB_HOST_ARCH
103+ OUTPUT_VARIABLE CLICK_ARCH
104+ OUTPUT_STRIP_TRAILING_WHITESPACE
105+ )
106+
107+ configure_file(${UBUNTU_MANIFEST_PATH} ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
108+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
109+ install(FILES "${APP_HARDCODE}.apparmor" DESTINATION ${CMAKE_INSTALL_PREFIX})
110+else(CLICK_MODE)
111+ set(EXEC "qmlscene $@ -I ${MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/${UBUNTU-WEATHER_APP_DIR}/${MAIN_QML}")
112+endif()
113+
114+
115+file(GLOB_RECURSE I18N_SRC_FILES
116+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po
117+ *.qml *.js)
118+list(APPEND I18N_SRC_FILES ${DESKTOP_FILE}.in.in.h)
119+list(SORT I18N_SRC_FILES)
120+
121+configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in)
122+
123+add_custom_target(${DESKTOP_FILE} ALL
124+ COMMENT "Merging translations into ${DESKTOP_FILE}..."
125+ COMMAND LC_ALL=C ${INTLTOOL_MERGE} -d -u ${CMAKE_SOURCE_DIR}/po ${DESKTOP_FILE}.in ${DESKTOP_FILE}
126+)
127+
128+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
129+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
130+
131+add_subdirectory(app)
132+add_subdirectory(backend)
133+add_subdirectory(po)
134+add_subdirectory(tests)
135+
136+# TODO: Add custom target for autopilot and run.
137+
138
139=== renamed file 'CMakeLists.txt' => 'CMakeLists.txt.moved'
140=== added file 'COPYING'
141--- COPYING 1970-01-01 00:00:00 +0000
142+++ COPYING 2015-03-19 04:32:18 +0000
143@@ -0,0 +1,674 @@
144+ GNU GENERAL PUBLIC LICENSE
145+ Version 3, 29 June 2007
146+
147+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
148+ Everyone is permitted to copy and distribute verbatim copies
149+ of this license document, but changing it is not allowed.
150+
151+ Preamble
152+
153+ The GNU General Public License is a free, copyleft license for
154+software and other kinds of works.
155+
156+ The licenses for most software and other practical works are designed
157+to take away your freedom to share and change the works. By contrast,
158+the GNU General Public License is intended to guarantee your freedom to
159+share and change all versions of a program--to make sure it remains free
160+software for all its users. We, the Free Software Foundation, use the
161+GNU General Public License for most of our software; it applies also to
162+any other work released this way by its authors. You can apply it to
163+your programs, too.
164+
165+ When we speak of free software, we are referring to freedom, not
166+price. Our General Public Licenses are designed to make sure that you
167+have the freedom to distribute copies of free software (and charge for
168+them if you wish), that you receive source code or can get it if you
169+want it, that you can change the software or use pieces of it in new
170+free programs, and that you know you can do these things.
171+
172+ To protect your rights, we need to prevent others from denying you
173+these rights or asking you to surrender the rights. Therefore, you have
174+certain responsibilities if you distribute copies of the software, or if
175+you modify it: responsibilities to respect the freedom of others.
176+
177+ For example, if you distribute copies of such a program, whether
178+gratis or for a fee, you must pass on to the recipients the same
179+freedoms that you received. You must make sure that they, too, receive
180+or can get the source code. And you must show them these terms so they
181+know their rights.
182+
183+ Developers that use the GNU GPL protect your rights with two steps:
184+(1) assert copyright on the software, and (2) offer you this License
185+giving you legal permission to copy, distribute and/or modify it.
186+
187+ For the developers' and authors' protection, the GPL clearly explains
188+that there is no warranty for this free software. For both users' and
189+authors' sake, the GPL requires that modified versions be marked as
190+changed, so that their problems will not be attributed erroneously to
191+authors of previous versions.
192+
193+ Some devices are designed to deny users access to install or run
194+modified versions of the software inside them, although the manufacturer
195+can do so. This is fundamentally incompatible with the aim of
196+protecting users' freedom to change the software. The systematic
197+pattern of such abuse occurs in the area of products for individuals to
198+use, which is precisely where it is most unacceptable. Therefore, we
199+have designed this version of the GPL to prohibit the practice for those
200+products. If such problems arise substantially in other domains, we
201+stand ready to extend this provision to those domains in future versions
202+of the GPL, as needed to protect the freedom of users.
203+
204+ Finally, every program is threatened constantly by software patents.
205+States should not allow patents to restrict development and use of
206+software on general-purpose computers, but in those that do, we wish to
207+avoid the special danger that patents applied to a free program could
208+make it effectively proprietary. To prevent this, the GPL assures that
209+patents cannot be used to render the program non-free.
210+
211+ The precise terms and conditions for copying, distribution and
212+modification follow.
213+
214+ TERMS AND CONDITIONS
215+
216+ 0. Definitions.
217+
218+ "This License" refers to version 3 of the GNU General Public License.
219+
220+ "Copyright" also means copyright-like laws that apply to other kinds of
221+works, such as semiconductor masks.
222+
223+ "The Program" refers to any copyrightable work licensed under this
224+License. Each licensee is addressed as "you". "Licensees" and
225+"recipients" may be individuals or organizations.
226+
227+ To "modify" a work means to copy from or adapt all or part of the work
228+in a fashion requiring copyright permission, other than the making of an
229+exact copy. The resulting work is called a "modified version" of the
230+earlier work or a work "based on" the earlier work.
231+
232+ A "covered work" means either the unmodified Program or a work based
233+on the Program.
234+
235+ To "propagate" a work means to do anything with it that, without
236+permission, would make you directly or secondarily liable for
237+infringement under applicable copyright law, except executing it on a
238+computer or modifying a private copy. Propagation includes copying,
239+distribution (with or without modification), making available to the
240+public, and in some countries other activities as well.
241+
242+ To "convey" a work means any kind of propagation that enables other
243+parties to make or receive copies. Mere interaction with a user through
244+a computer network, with no transfer of a copy, is not conveying.
245+
246+ An interactive user interface displays "Appropriate Legal Notices"
247+to the extent that it includes a convenient and prominently visible
248+feature that (1) displays an appropriate copyright notice, and (2)
249+tells the user that there is no warranty for the work (except to the
250+extent that warranties are provided), that licensees may convey the
251+work under this License, and how to view a copy of this License. If
252+the interface presents a list of user commands or options, such as a
253+menu, a prominent item in the list meets this criterion.
254+
255+ 1. Source Code.
256+
257+ The "source code" for a work means the preferred form of the work
258+for making modifications to it. "Object code" means any non-source
259+form of a work.
260+
261+ A "Standard Interface" means an interface that either is an official
262+standard defined by a recognized standards body, or, in the case of
263+interfaces specified for a particular programming language, one that
264+is widely used among developers working in that language.
265+
266+ The "System Libraries" of an executable work include anything, other
267+than the work as a whole, that (a) is included in the normal form of
268+packaging a Major Component, but which is not part of that Major
269+Component, and (b) serves only to enable use of the work with that
270+Major Component, or to implement a Standard Interface for which an
271+implementation is available to the public in source code form. A
272+"Major Component", in this context, means a major essential component
273+(kernel, window system, and so on) of the specific operating system
274+(if any) on which the executable work runs, or a compiler used to
275+produce the work, or an object code interpreter used to run it.
276+
277+ The "Corresponding Source" for a work in object code form means all
278+the source code needed to generate, install, and (for an executable
279+work) run the object code and to modify the work, including scripts to
280+control those activities. However, it does not include the work's
281+System Libraries, or general-purpose tools or generally available free
282+programs which are used unmodified in performing those activities but
283+which are not part of the work. For example, Corresponding Source
284+includes interface definition files associated with source files for
285+the work, and the source code for shared libraries and dynamically
286+linked subprograms that the work is specifically designed to require,
287+such as by intimate data communication or control flow between those
288+subprograms and other parts of the work.
289+
290+ The Corresponding Source need not include anything that users
291+can regenerate automatically from other parts of the Corresponding
292+Source.
293+
294+ The Corresponding Source for a work in source code form is that
295+same work.
296+
297+ 2. Basic Permissions.
298+
299+ All rights granted under this License are granted for the term of
300+copyright on the Program, and are irrevocable provided the stated
301+conditions are met. This License explicitly affirms your unlimited
302+permission to run the unmodified Program. The output from running a
303+covered work is covered by this License only if the output, given its
304+content, constitutes a covered work. This License acknowledges your
305+rights of fair use or other equivalent, as provided by copyright law.
306+
307+ You may make, run and propagate covered works that you do not
308+convey, without conditions so long as your license otherwise remains
309+in force. You may convey covered works to others for the sole purpose
310+of having them make modifications exclusively for you, or provide you
311+with facilities for running those works, provided that you comply with
312+the terms of this License in conveying all material for which you do
313+not control copyright. Those thus making or running the covered works
314+for you must do so exclusively on your behalf, under your direction
315+and control, on terms that prohibit them from making any copies of
316+your copyrighted material outside their relationship with you.
317+
318+ Conveying under any other circumstances is permitted solely under
319+the conditions stated below. Sublicensing is not allowed; section 10
320+makes it unnecessary.
321+
322+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
323+
324+ No covered work shall be deemed part of an effective technological
325+measure under any applicable law fulfilling obligations under article
326+11 of the WIPO copyright treaty adopted on 20 December 1996, or
327+similar laws prohibiting or restricting circumvention of such
328+measures.
329+
330+ When you convey a covered work, you waive any legal power to forbid
331+circumvention of technological measures to the extent such circumvention
332+is effected by exercising rights under this License with respect to
333+the covered work, and you disclaim any intention to limit operation or
334+modification of the work as a means of enforcing, against the work's
335+users, your or third parties' legal rights to forbid circumvention of
336+technological measures.
337+
338+ 4. Conveying Verbatim Copies.
339+
340+ You may convey verbatim copies of the Program's source code as you
341+receive it, in any medium, provided that you conspicuously and
342+appropriately publish on each copy an appropriate copyright notice;
343+keep intact all notices stating that this License and any
344+non-permissive terms added in accord with section 7 apply to the code;
345+keep intact all notices of the absence of any warranty; and give all
346+recipients a copy of this License along with the Program.
347+
348+ You may charge any price or no price for each copy that you convey,
349+and you may offer support or warranty protection for a fee.
350+
351+ 5. Conveying Modified Source Versions.
352+
353+ You may convey a work based on the Program, or the modifications to
354+produce it from the Program, in the form of source code under the
355+terms of section 4, provided that you also meet all of these conditions:
356+
357+ a) The work must carry prominent notices stating that you modified
358+ it, and giving a relevant date.
359+
360+ b) The work must carry prominent notices stating that it is
361+ released under this License and any conditions added under section
362+ 7. This requirement modifies the requirement in section 4 to
363+ "keep intact all notices".
364+
365+ c) You must license the entire work, as a whole, under this
366+ License to anyone who comes into possession of a copy. This
367+ License will therefore apply, along with any applicable section 7
368+ additional terms, to the whole of the work, and all its parts,
369+ regardless of how they are packaged. This License gives no
370+ permission to license the work in any other way, but it does not
371+ invalidate such permission if you have separately received it.
372+
373+ d) If the work has interactive user interfaces, each must display
374+ Appropriate Legal Notices; however, if the Program has interactive
375+ interfaces that do not display Appropriate Legal Notices, your
376+ work need not make them do so.
377+
378+ A compilation of a covered work with other separate and independent
379+works, which are not by their nature extensions of the covered work,
380+and which are not combined with it such as to form a larger program,
381+in or on a volume of a storage or distribution medium, is called an
382+"aggregate" if the compilation and its resulting copyright are not
383+used to limit the access or legal rights of the compilation's users
384+beyond what the individual works permit. Inclusion of a covered work
385+in an aggregate does not cause this License to apply to the other
386+parts of the aggregate.
387+
388+ 6. Conveying Non-Source Forms.
389+
390+ You may convey a covered work in object code form under the terms
391+of sections 4 and 5, provided that you also convey the
392+machine-readable Corresponding Source under the terms of this License,
393+in one of these ways:
394+
395+ a) Convey the object code in, or embodied in, a physical product
396+ (including a physical distribution medium), accompanied by the
397+ Corresponding Source fixed on a durable physical medium
398+ customarily used for software interchange.
399+
400+ b) Convey the object code in, or embodied in, a physical product
401+ (including a physical distribution medium), accompanied by a
402+ written offer, valid for at least three years and valid for as
403+ long as you offer spare parts or customer support for that product
404+ model, to give anyone who possesses the object code either (1) a
405+ copy of the Corresponding Source for all the software in the
406+ product that is covered by this License, on a durable physical
407+ medium customarily used for software interchange, for a price no
408+ more than your reasonable cost of physically performing this
409+ conveying of source, or (2) access to copy the
410+ Corresponding Source from a network server at no charge.
411+
412+ c) Convey individual copies of the object code with a copy of the
413+ written offer to provide the Corresponding Source. This
414+ alternative is allowed only occasionally and noncommercially, and
415+ only if you received the object code with such an offer, in accord
416+ with subsection 6b.
417+
418+ d) Convey the object code by offering access from a designated
419+ place (gratis or for a charge), and offer equivalent access to the
420+ Corresponding Source in the same way through the same place at no
421+ further charge. You need not require recipients to copy the
422+ Corresponding Source along with the object code. If the place to
423+ copy the object code is a network server, the Corresponding Source
424+ may be on a different server (operated by you or a third party)
425+ that supports equivalent copying facilities, provided you maintain
426+ clear directions next to the object code saying where to find the
427+ Corresponding Source. Regardless of what server hosts the
428+ Corresponding Source, you remain obligated to ensure that it is
429+ available for as long as needed to satisfy these requirements.
430+
431+ e) Convey the object code using peer-to-peer transmission, provided
432+ you inform other peers where the object code and Corresponding
433+ Source of the work are being offered to the general public at no
434+ charge under subsection 6d.
435+
436+ A separable portion of the object code, whose source code is excluded
437+from the Corresponding Source as a System Library, need not be
438+included in conveying the object code work.
439+
440+ A "User Product" is either (1) a "consumer product", which means any
441+tangible personal property which is normally used for personal, family,
442+or household purposes, or (2) anything designed or sold for incorporation
443+into a dwelling. In determining whether a product is a consumer product,
444+doubtful cases shall be resolved in favor of coverage. For a particular
445+product received by a particular user, "normally used" refers to a
446+typical or common use of that class of product, regardless of the status
447+of the particular user or of the way in which the particular user
448+actually uses, or expects or is expected to use, the product. A product
449+is a consumer product regardless of whether the product has substantial
450+commercial, industrial or non-consumer uses, unless such uses represent
451+the only significant mode of use of the product.
452+
453+ "Installation Information" for a User Product means any methods,
454+procedures, authorization keys, or other information required to install
455+and execute modified versions of a covered work in that User Product from
456+a modified version of its Corresponding Source. The information must
457+suffice to ensure that the continued functioning of the modified object
458+code is in no case prevented or interfered with solely because
459+modification has been made.
460+
461+ If you convey an object code work under this section in, or with, or
462+specifically for use in, a User Product, and the conveying occurs as
463+part of a transaction in which the right of possession and use of the
464+User Product is transferred to the recipient in perpetuity or for a
465+fixed term (regardless of how the transaction is characterized), the
466+Corresponding Source conveyed under this section must be accompanied
467+by the Installation Information. But this requirement does not apply
468+if neither you nor any third party retains the ability to install
469+modified object code on the User Product (for example, the work has
470+been installed in ROM).
471+
472+ The requirement to provide Installation Information does not include a
473+requirement to continue to provide support service, warranty, or updates
474+for a work that has been modified or installed by the recipient, or for
475+the User Product in which it has been modified or installed. Access to a
476+network may be denied when the modification itself materially and
477+adversely affects the operation of the network or violates the rules and
478+protocols for communication across the network.
479+
480+ Corresponding Source conveyed, and Installation Information provided,
481+in accord with this section must be in a format that is publicly
482+documented (and with an implementation available to the public in
483+source code form), and must require no special password or key for
484+unpacking, reading or copying.
485+
486+ 7. Additional Terms.
487+
488+ "Additional permissions" are terms that supplement the terms of this
489+License by making exceptions from one or more of its conditions.
490+Additional permissions that are applicable to the entire Program shall
491+be treated as though they were included in this License, to the extent
492+that they are valid under applicable law. If additional permissions
493+apply only to part of the Program, that part may be used separately
494+under those permissions, but the entire Program remains governed by
495+this License without regard to the additional permissions.
496+
497+ When you convey a copy of a covered work, you may at your option
498+remove any additional permissions from that copy, or from any part of
499+it. (Additional permissions may be written to require their own
500+removal in certain cases when you modify the work.) You may place
501+additional permissions on material, added by you to a covered work,
502+for which you have or can give appropriate copyright permission.
503+
504+ Notwithstanding any other provision of this License, for material you
505+add to a covered work, you may (if authorized by the copyright holders of
506+that material) supplement the terms of this License with terms:
507+
508+ a) Disclaiming warranty or limiting liability differently from the
509+ terms of sections 15 and 16 of this License; or
510+
511+ b) Requiring preservation of specified reasonable legal notices or
512+ author attributions in that material or in the Appropriate Legal
513+ Notices displayed by works containing it; or
514+
515+ c) Prohibiting misrepresentation of the origin of that material, or
516+ requiring that modified versions of such material be marked in
517+ reasonable ways as different from the original version; or
518+
519+ d) Limiting the use for publicity purposes of names of licensors or
520+ authors of the material; or
521+
522+ e) Declining to grant rights under trademark law for use of some
523+ trade names, trademarks, or service marks; or
524+
525+ f) Requiring indemnification of licensors and authors of that
526+ material by anyone who conveys the material (or modified versions of
527+ it) with contractual assumptions of liability to the recipient, for
528+ any liability that these contractual assumptions directly impose on
529+ those licensors and authors.
530+
531+ All other non-permissive additional terms are considered "further
532+restrictions" within the meaning of section 10. If the Program as you
533+received it, or any part of it, contains a notice stating that it is
534+governed by this License along with a term that is a further
535+restriction, you may remove that term. If a license document contains
536+a further restriction but permits relicensing or conveying under this
537+License, you may add to a covered work material governed by the terms
538+of that license document, provided that the further restriction does
539+not survive such relicensing or conveying.
540+
541+ If you add terms to a covered work in accord with this section, you
542+must place, in the relevant source files, a statement of the
543+additional terms that apply to those files, or a notice indicating
544+where to find the applicable terms.
545+
546+ Additional terms, permissive or non-permissive, may be stated in the
547+form of a separately written license, or stated as exceptions;
548+the above requirements apply either way.
549+
550+ 8. Termination.
551+
552+ You may not propagate or modify a covered work except as expressly
553+provided under this License. Any attempt otherwise to propagate or
554+modify it is void, and will automatically terminate your rights under
555+this License (including any patent licenses granted under the third
556+paragraph of section 11).
557+
558+ However, if you cease all violation of this License, then your
559+license from a particular copyright holder is reinstated (a)
560+provisionally, unless and until the copyright holder explicitly and
561+finally terminates your license, and (b) permanently, if the copyright
562+holder fails to notify you of the violation by some reasonable means
563+prior to 60 days after the cessation.
564+
565+ Moreover, your license from a particular copyright holder is
566+reinstated permanently if the copyright holder notifies you of the
567+violation by some reasonable means, this is the first time you have
568+received notice of violation of this License (for any work) from that
569+copyright holder, and you cure the violation prior to 30 days after
570+your receipt of the notice.
571+
572+ Termination of your rights under this section does not terminate the
573+licenses of parties who have received copies or rights from you under
574+this License. If your rights have been terminated and not permanently
575+reinstated, you do not qualify to receive new licenses for the same
576+material under section 10.
577+
578+ 9. Acceptance Not Required for Having Copies.
579+
580+ You are not required to accept this License in order to receive or
581+run a copy of the Program. Ancillary propagation of a covered work
582+occurring solely as a consequence of using peer-to-peer transmission
583+to receive a copy likewise does not require acceptance. However,
584+nothing other than this License grants you permission to propagate or
585+modify any covered work. These actions infringe copyright if you do
586+not accept this License. Therefore, by modifying or propagating a
587+covered work, you indicate your acceptance of this License to do so.
588+
589+ 10. Automatic Licensing of Downstream Recipients.
590+
591+ Each time you convey a covered work, the recipient automatically
592+receives a license from the original licensors, to run, modify and
593+propagate that work, subject to this License. You are not responsible
594+for enforcing compliance by third parties with this License.
595+
596+ An "entity transaction" is a transaction transferring control of an
597+organization, or substantially all assets of one, or subdividing an
598+organization, or merging organizations. If propagation of a covered
599+work results from an entity transaction, each party to that
600+transaction who receives a copy of the work also receives whatever
601+licenses to the work the party's predecessor in interest had or could
602+give under the previous paragraph, plus a right to possession of the
603+Corresponding Source of the work from the predecessor in interest, if
604+the predecessor has it or can get it with reasonable efforts.
605+
606+ You may not impose any further restrictions on the exercise of the
607+rights granted or affirmed under this License. For example, you may
608+not impose a license fee, royalty, or other charge for exercise of
609+rights granted under this License, and you may not initiate litigation
610+(including a cross-claim or counterclaim in a lawsuit) alleging that
611+any patent claim is infringed by making, using, selling, offering for
612+sale, or importing the Program or any portion of it.
613+
614+ 11. Patents.
615+
616+ A "contributor" is a copyright holder who authorizes use under this
617+License of the Program or a work on which the Program is based. The
618+work thus licensed is called the contributor's "contributor version".
619+
620+ A contributor's "essential patent claims" are all patent claims
621+owned or controlled by the contributor, whether already acquired or
622+hereafter acquired, that would be infringed by some manner, permitted
623+by this License, of making, using, or selling its contributor version,
624+but do not include claims that would be infringed only as a
625+consequence of further modification of the contributor version. For
626+purposes of this definition, "control" includes the right to grant
627+patent sublicenses in a manner consistent with the requirements of
628+this License.
629+
630+ Each contributor grants you a non-exclusive, worldwide, royalty-free
631+patent license under the contributor's essential patent claims, to
632+make, use, sell, offer for sale, import and otherwise run, modify and
633+propagate the contents of its contributor version.
634+
635+ In the following three paragraphs, a "patent license" is any express
636+agreement or commitment, however denominated, not to enforce a patent
637+(such as an express permission to practice a patent or covenant not to
638+sue for patent infringement). To "grant" such a patent license to a
639+party means to make such an agreement or commitment not to enforce a
640+patent against the party.
641+
642+ If you convey a covered work, knowingly relying on a patent license,
643+and the Corresponding Source of the work is not available for anyone
644+to copy, free of charge and under the terms of this License, through a
645+publicly available network server or other readily accessible means,
646+then you must either (1) cause the Corresponding Source to be so
647+available, or (2) arrange to deprive yourself of the benefit of the
648+patent license for this particular work, or (3) arrange, in a manner
649+consistent with the requirements of this License, to extend the patent
650+license to downstream recipients. "Knowingly relying" means you have
651+actual knowledge that, but for the patent license, your conveying the
652+covered work in a country, or your recipient's use of the covered work
653+in a country, would infringe one or more identifiable patents in that
654+country that you have reason to believe are valid.
655+
656+ If, pursuant to or in connection with a single transaction or
657+arrangement, you convey, or propagate by procuring conveyance of, a
658+covered work, and grant a patent license to some of the parties
659+receiving the covered work authorizing them to use, propagate, modify
660+or convey a specific copy of the covered work, then the patent license
661+you grant is automatically extended to all recipients of the covered
662+work and works based on it.
663+
664+ A patent license is "discriminatory" if it does not include within
665+the scope of its coverage, prohibits the exercise of, or is
666+conditioned on the non-exercise of one or more of the rights that are
667+specifically granted under this License. You may not convey a covered
668+work if you are a party to an arrangement with a third party that is
669+in the business of distributing software, under which you make payment
670+to the third party based on the extent of your activity of conveying
671+the work, and under which the third party grants, to any of the
672+parties who would receive the covered work from you, a discriminatory
673+patent license (a) in connection with copies of the covered work
674+conveyed by you (or copies made from those copies), or (b) primarily
675+for and in connection with specific products or compilations that
676+contain the covered work, unless you entered into that arrangement,
677+or that patent license was granted, prior to 28 March 2007.
678+
679+ Nothing in this License shall be construed as excluding or limiting
680+any implied license or other defenses to infringement that may
681+otherwise be available to you under applicable patent law.
682+
683+ 12. No Surrender of Others' Freedom.
684+
685+ If conditions are imposed on you (whether by court order, agreement or
686+otherwise) that contradict the conditions of this License, they do not
687+excuse you from the conditions of this License. If you cannot convey a
688+covered work so as to satisfy simultaneously your obligations under this
689+License and any other pertinent obligations, then as a consequence you may
690+not convey it at all. For example, if you agree to terms that obligate you
691+to collect a royalty for further conveying from those to whom you convey
692+the Program, the only way you could satisfy both those terms and this
693+License would be to refrain entirely from conveying the Program.
694+
695+ 13. Use with the GNU Affero General Public License.
696+
697+ Notwithstanding any other provision of this License, you have
698+permission to link or combine any covered work with a work licensed
699+under version 3 of the GNU Affero General Public License into a single
700+combined work, and to convey the resulting work. The terms of this
701+License will continue to apply to the part which is the covered work,
702+but the special requirements of the GNU Affero General Public License,
703+section 13, concerning interaction through a network will apply to the
704+combination as such.
705+
706+ 14. Revised Versions of this License.
707+
708+ The Free Software Foundation may publish revised and/or new versions of
709+the GNU General Public License from time to time. Such new versions will
710+be similar in spirit to the present version, but may differ in detail to
711+address new problems or concerns.
712+
713+ Each version is given a distinguishing version number. If the
714+Program specifies that a certain numbered version of the GNU General
715+Public License "or any later version" applies to it, you have the
716+option of following the terms and conditions either of that numbered
717+version or of any later version published by the Free Software
718+Foundation. If the Program does not specify a version number of the
719+GNU General Public License, you may choose any version ever published
720+by the Free Software Foundation.
721+
722+ If the Program specifies that a proxy can decide which future
723+versions of the GNU General Public License can be used, that proxy's
724+public statement of acceptance of a version permanently authorizes you
725+to choose that version for the Program.
726+
727+ Later license versions may give you additional or different
728+permissions. However, no additional obligations are imposed on any
729+author or copyright holder as a result of your choosing to follow a
730+later version.
731+
732+ 15. Disclaimer of Warranty.
733+
734+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
735+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
736+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
737+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
738+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
739+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
740+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
741+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
742+
743+ 16. Limitation of Liability.
744+
745+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
746+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
747+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
748+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
749+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
750+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
751+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
752+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
753+SUCH DAMAGES.
754+
755+ 17. Interpretation of Sections 15 and 16.
756+
757+ If the disclaimer of warranty and limitation of liability provided
758+above cannot be given local legal effect according to their terms,
759+reviewing courts shall apply local law that most closely approximates
760+an absolute waiver of all civil liability in connection with the
761+Program, unless a warranty or assumption of liability accompanies a
762+copy of the Program in return for a fee.
763+
764+ END OF TERMS AND CONDITIONS
765+
766+ How to Apply These Terms to Your New Programs
767+
768+ If you develop a new program, and you want it to be of the greatest
769+possible use to the public, the best way to achieve this is to make it
770+free software which everyone can redistribute and change under these terms.
771+
772+ To do so, attach the following notices to the program. It is safest
773+to attach them to the start of each source file to most effectively
774+state the exclusion of warranty; and each file should have at least
775+the "copyright" line and a pointer to where the full notice is found.
776+
777+ <one line to give the program's name and a brief idea of what it does.>
778+ Copyright (C) <year> <name of author>
779+
780+ This program is free software: you can redistribute it and/or modify
781+ it under the terms of the GNU General Public License as published by
782+ the Free Software Foundation, either version 3 of the License, or
783+ (at your option) any later version.
784+
785+ This program is distributed in the hope that it will be useful,
786+ but WITHOUT ANY WARRANTY; without even the implied warranty of
787+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
788+ GNU General Public License for more details.
789+
790+ You should have received a copy of the GNU General Public License
791+ along with this program. If not, see <http://www.gnu.org/licenses/>.
792+
793+Also add information on how to contact you by electronic and paper mail.
794+
795+ If the program does terminal interaction, make it output a short
796+notice like this when it starts in an interactive mode:
797+
798+ <program> Copyright (C) <year> <name of author>
799+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
800+ This is free software, and you are welcome to redistribute it
801+ under certain conditions; type `show c' for details.
802+
803+The hypothetical commands `show w' and `show c' should show the appropriate
804+parts of the General Public License. Of course, your program's commands
805+might be different; for a GUI interface, you would use an "about box".
806+
807+ You should also get your employer (if you work as a programmer) or school,
808+if any, to sign a "copyright disclaimer" for the program, if necessary.
809+For more information on this, and how to apply and follow the GNU GPL, see
810+<http://www.gnu.org/licenses/>.
811+
812+ The GNU General Public License does not permit incorporating your program
813+into proprietary programs. If your program is a subroutine library, you
814+may consider it more useful to permit linking proprietary applications with
815+the library. If this is what you want to do, use the GNU Lesser General
816+Public License instead of this License. But first, please read
817+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
818
819=== renamed file 'COPYING' => 'COPYING.moved'
820=== added file 'README'
821--- README 1970-01-01 00:00:00 +0000
822+++ README 2015-03-19 04:32:18 +0000
823@@ -0,0 +1,11 @@
824+Weather app for Ubuntu devices
825+
826+To contribute:
827+ https://wiki.ubuntu.com/Touch/CoreApps/Weather
828+ https://wiki.ubuntu.com/Touch/CoreApps/DevelopmentGuide
829+
830+The following essential packages are required to develop this app:
831+- ubuntu-sdk (see http://developer.ubuntu.com/start)
832+- intltool - run the `sudo apt-get install intltool` command for installation
833+
834+See the debian/control file for an up-to-date list of dependencies
835
836=== renamed file 'README' => 'README.moved'
837=== added file 'README.translations'
838--- README.translations 1970-01-01 00:00:00 +0000
839+++ README.translations 2015-03-19 04:32:18 +0000
840@@ -0,0 +1,40 @@
841+# Updating translations
842+
843+Translations for the Weather app happen in [Launchpad Translations][] and
844+are automatically committed daily on the trunk branch in the po/ folder.
845+
846+They are then built and installed as part of the package build, so that
847+developers don't really need to worry about them.
848+
849+However, there is one task that needs to be taken care of: exposing new
850+translatable messages to translators. So whenever you add new translatable
851+messages in the code, make sure to follow these steps:
852+
853+ 1. Run click-buddy retaining the build directory:
854+ `click-buddy --dir . --no-clean`
855+ 2. Copy the .pot file from the <build dir> mentioned in the output to your
856+ original source:
857+ `cp <build dir>/po/*.pot po/`
858+ 3. Commit the generated .pot file:
859+ `bzr commit -m"Updated translation template"`
860+ 4. Push the branch and send a merge proposal as usual
861+
862+And that's it, once the branch lands Launchpad should take care of all the rest!
863+
864+# Behind the scenes
865+
866+Behind the scenes, whenever the po/*.pot file (also known as translations template)
867+is committed to trunk Launchpad reads it and updates the translatable strings
868+exposed in the web UI. This will enable translators to work on the new strings.
869+The translations template contains all translatable strings that have been
870+extracted from the source code files.
871+
872+Launchpad will then store translations in its database and will commit them daily
873+in the form of textual po/*.po files to trunk. The PO files are also usually
874+referred to as the translations files. You'll find a translation file for each
875+language the app has got at least a translated message available for.
876+
877+Translations for core apps follow the standard [gettext format].
878+
879+ [Launchpad Translations]: https://translations.launchpad.net/ubuntu-weather-app
880+ [gettext format]: https://www.gnu.org/software/gettext/
881
882=== renamed file 'README.translations' => 'README.translations.moved'
883=== added directory 'app'
884=== added file 'app/CMakeLists.txt'
885--- app/CMakeLists.txt 1970-01-01 00:00:00 +0000
886+++ app/CMakeLists.txt 2015-03-19 04:32:18 +0000
887@@ -0,0 +1,18 @@
888+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
889+ file(GLOB QML_JS_FILES *.qml *.js)
890+ add_custom_target(ubuntu-weather-app_QMlFiles ALL SOURCES ${QML_JS_FILES})
891+endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
892+
893+
894+if(CLICK_MODE)
895+ set(ICON ${ICON})
896+ install(FILES ${ICON} DESTINATION ${CMAKE_INSTALL_PREFIX})
897+endif(CLICK_MODE)
898+
899+install(FILES ${MAIN_QML} DESTINATION ${UBUNTU-WEATHER_APP_DIR})
900+
901+add_subdirectory(components)
902+add_subdirectory(data)
903+add_subdirectory(graphics)
904+add_subdirectory(ui)
905+
906
907=== added directory 'app/components'
908=== added file 'app/components/CMakeLists.txt'
909--- app/components/CMakeLists.txt 1970-01-01 00:00:00 +0000
910+++ app/components/CMakeLists.txt 2015-03-19 04:32:18 +0000
911@@ -0,0 +1,7 @@
912+add_subdirectory(ListItemActions)
913+
914+file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)
915+
916+add_custom_target(ubuntu-weather-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})
917+
918+install(FILES ${COMPONENTS_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/components)
919
920=== added file 'app/components/DayDelegate.qml'
921--- app/components/DayDelegate.qml 1970-01-01 00:00:00 +0000
922+++ app/components/DayDelegate.qml 2015-03-19 04:32:18 +0000
923@@ -0,0 +1,95 @@
924+/*
925+ * Copyright (C) 2015 Canonical Ltd
926+ *
927+ * This file is part of Ubuntu Weather App
928+ *
929+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
930+ * it under the terms of the GNU General Public License version 3 as
931+ * published by the Free Software Foundation.
932+ *
933+ * Ubuntu Weather App is distributed in the hope that it will be useful,
934+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
935+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
936+ * GNU General Public License for more details.
937+ *
938+ * You should have received a copy of the GNU General Public License
939+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
940+ */
941+
942+import QtQuick 2.3
943+import Ubuntu.Components 1.1
944+import Ubuntu.Components.ListItems 0.1 as ListItem
945+
946+ListItem.Standard {
947+ height: units.gu(8)
948+
949+ // TODO: will expand when clicked to reveal more info
950+
951+ property alias day: dayLabel.text
952+ property alias image: weatherImage.source
953+ property alias high: highLabel.text
954+ property alias low: lowLabel.text
955+
956+ // Standard divider is not full width so add a ThinDivider to the bottom
957+ showDivider: false
958+
959+ ListItem.ThinDivider {
960+ anchors {
961+ bottom: parent.bottom
962+ }
963+ }
964+
965+ Label {
966+ id: dayLabel
967+ anchors {
968+ left: parent.left
969+ right: weatherImage.left
970+ rightMargin: units.gu(1)
971+ verticalCenter: parent.verticalCenter
972+ }
973+ elide: Text.ElideRight
974+ font.weight: Font.Light
975+ fontSize: "medium"
976+ }
977+
978+ Image {
979+ id: weatherImage
980+ anchors {
981+ horizontalCenter: parent.horizontalCenter
982+ verticalCenter: parent.verticalCenter
983+ }
984+ height: units.gu(3)
985+ width: units.gu(3)
986+ }
987+
988+ Label {
989+ id: lowLabel
990+ anchors {
991+ left: weatherImage.right
992+ right: highLabel.left
993+ rightMargin: units.gu(1)
994+ verticalCenter: parent.verticalCenter
995+ }
996+ elide: Text.ElideRight
997+ font.pixelSize: units.gu(2)
998+ font.weight: Font.Light
999+ fontSize: "medium"
1000+ height: units.gu(2)
1001+ horizontalAlignment: Text.AlignRight
1002+ verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
1003+ }
1004+
1005+ Label {
1006+ id: highLabel
1007+ anchors {
1008+ bottom: lowLabel.bottom
1009+ right: parent.right
1010+ }
1011+ color: UbuntuColors.orange
1012+ elide: Text.ElideRight
1013+ font.pixelSize: units.gu(3)
1014+ font.weight: Font.Normal
1015+ height: units.gu(3)
1016+ verticalAlignment: Text.AlignTop // AlignTop appears to align bottom?
1017+ }
1018+}
1019
1020=== added file 'app/components/FastScroll.js'
1021--- app/components/FastScroll.js 1970-01-01 00:00:00 +0000
1022+++ app/components/FastScroll.js 2015-03-19 04:32:18 +0000
1023@@ -0,0 +1,130 @@
1024+/****************************************************************************
1025+**
1026+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
1027+** Copyright (C) 2014 Canonical Ltda
1028+** All rights reserved.
1029+** Contact: Nokia Corporation (qt-info@nokia.com)
1030+**
1031+** This file is part of the Qt Components project.
1032+**
1033+** $QT_BEGIN_LICENSE:BSD$
1034+** You may use this file under the terms of the BSD license as follows:
1035+**
1036+** "Redistribution and use in source and binary forms, with or without
1037+** modification, are permitted provided that the following conditions are
1038+** met:
1039+** * Redistributions of source code must retain the above copyright
1040+** notice, this list of conditions and the following disclaimer.
1041+** * Redistributions in binary form must reproduce the above copyright
1042+** notice, this list of conditions and the following disclaimer in
1043+** the documentation and/or other materials provided with the
1044+** distribution.
1045+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
1046+** the names of its contributors may be used to endorse or promote
1047+** products derived from this software without specific prior written
1048+** permission.
1049+**
1050+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1051+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1052+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1053+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1054+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1055+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1056+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1057+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1058+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1059+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1060+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
1061+** $QT_END_LICENSE$
1062+**
1063+****************************************************************************/
1064+
1065+// FastScroll.js - this is just SectionScroller.js with a fix for
1066+// section.criteria == ViewSection.FirstCharacter
1067+var sectionData = [];
1068+var _sections = [];
1069+
1070+function initialize(list) {
1071+ initSectionData(list);
1072+}
1073+
1074+function contains(name) {
1075+ return (_sections.indexOf(name) > -1)
1076+}
1077+
1078+function initSectionData(list) {
1079+ if (!list || !list.model) return;
1080+ sectionData = [];
1081+ _sections = [];
1082+ var current = "",
1083+ prop = list.section.property,
1084+ sectionText;
1085+
1086+ if (list.section.criteria === ViewSection.FullString) {
1087+ for (var i = 0, count = list.model.count; i < count; i++) {
1088+ sectionText = list.getSectionText(i)
1089+ if (sectionText !== current) {
1090+ current = sectionText;
1091+ _sections.push(current);
1092+ sectionData.push({ index: i, header: current });
1093+ }
1094+ }
1095+ } else if (list.section.criteria === ViewSection.FirstCharacter) {
1096+ for (var i = 0, count = list.model.count; i < count; i++) {
1097+ sectionText = list.getSectionText(i).substring(0, 1)
1098+ if (sectionText !== current) {
1099+ current = sectionText
1100+ _sections.push(sectionText);
1101+ sectionData.push({ index: i, header: current });
1102+ }
1103+ }
1104+ }
1105+}
1106+
1107+function getSectionPositionString(name) {
1108+ var val = _sections.indexOf(name);
1109+ return val === 0 ? "first" :
1110+ val === _sections.length - 1 ? "last" : false;
1111+}
1112+
1113+function getAt(pos) {
1114+ return _sections[pos] ? _sections[pos] : "";
1115+}
1116+
1117+function getRelativeSections(current) {
1118+ var val = _sections.indexOf(current),
1119+ sect = [],
1120+ sl = _sections.length;
1121+
1122+ val = val < 1 ? 1 : val >= sl-1 ? sl-2 : val;
1123+ sect = [getAt(val - 1), getAt(val), getAt(val + 1)];
1124+
1125+ return sect;
1126+}
1127+
1128+function getClosestSection(pos, down) {
1129+ var tmp = (_sections.length) * pos;
1130+ var val = Math.ceil(tmp) // TODO: better algorithm
1131+ val = val < 2 ? 1 : val;
1132+ return _sections[val-1];
1133+}
1134+
1135+function getNextSection(current) {
1136+ var val = _sections.indexOf(current);
1137+ return (val > -1 ? _sections[(val < _sections.length - 1 ? val + 1 : val)] : _sections[0]) || "";
1138+}
1139+
1140+function getPreviousSection(current) {
1141+ var val = _sections.indexOf(current);
1142+ return (val > -1 ? _sections[(val > 0 ? val - 1 : val)] : _sections[0]) || "";
1143+}
1144+
1145+function getIndexFor(sectionName) {
1146+ var data = sectionData[_sections.indexOf(sectionName)]
1147+ if (data) {
1148+ var val = data.index;
1149+ return val === 0 || val > 0 ? val : -1;
1150+ } else {
1151+ return -1
1152+ }
1153+}
1154
1155=== added file 'app/components/FastScroll.qml'
1156--- app/components/FastScroll.qml 1970-01-01 00:00:00 +0000
1157+++ app/components/FastScroll.qml 2015-03-19 04:32:18 +0000
1158@@ -0,0 +1,321 @@
1159+/****************************************************************************
1160+**
1161+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
1162+** Copyright (C) 2014 Canonical Ltda
1163+** All rights reserved.
1164+** Contact: Nokia Corporation (qt-info@nokia.com)
1165+**
1166+** This file is part of the Qt Components project.
1167+**
1168+** $QT_BEGIN_LICENSE:BSD$
1169+** You may use this file under the terms of the BSD license as follows:
1170+**
1171+** "Redistribution and use in source and binary forms, with or without
1172+** modification, are permitted provided that the following conditions are
1173+** met:
1174+** * Redistributions of source code must retain the above copyright
1175+** notice, this list of conditions and the following disclaimer.
1176+** * Redistributions in binary form must reproduce the above copyright
1177+** notice, this list of conditions and the following disclaimer in
1178+** the documentation and/or other materials provided with the
1179+** distribution.
1180+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
1181+** the names of its contributors may be used to endorse or promote
1182+** products derived from this software without specific prior written
1183+** permission.
1184+**
1185+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1186+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1187+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1188+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1189+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1190+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1191+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1192+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1193+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1194+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1195+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
1196+** $QT_END_LICENSE$
1197+**
1198+****************************************************************************/
1199+
1200+// FastScroll.qml
1201+import QtQuick 2.3
1202+import Ubuntu.Components 1.1
1203+import "FastScroll.js" as Sections
1204+
1205+Item {
1206+ id: root
1207+
1208+ property ListView listView
1209+ property int pinSize: units.gu(2)
1210+
1211+ readonly property var letters: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
1212+ readonly property alias fastScrolling: internal.fastScrolling
1213+ readonly property bool showing: (rail.opacity !== 0.0)
1214+ readonly property double minimumHeight: rail.height
1215+
1216+ width: units.gu(7)
1217+ height: rail.height
1218+
1219+ onListViewChanged: {
1220+ if (listView && listView.model) {
1221+ internal.initDirtyObserver();
1222+ } else if (listView) {
1223+ listView.modelChanged.connect(function() {
1224+ if (listView.model) {
1225+ internal.initDirtyObserver();
1226+ }
1227+ });
1228+ }
1229+ }
1230+
1231+ Connections {
1232+ target: listView
1233+ onCurrentIndexChanged: {
1234+ if (currentIndex != -1) {
1235+ rail.opacity = 0.0
1236+ }
1237+ }
1238+ }
1239+
1240+ Rectangle {
1241+ id: magnified
1242+
1243+ color: Theme.palette.normal.overlay
1244+ radius: height * 0.3
1245+ height: pinSize * 2
1246+ width: height
1247+ opacity: internal.fastScrolling && root.enabled ? 1.0 : 0.0
1248+ x: -cursor.width - units.gu(3)
1249+ y: {
1250+ if (internal.currentItem) {
1251+ var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2)
1252+ return (itemCenterY - (magnified.height / 2))
1253+ } else {
1254+ return 0
1255+ }
1256+ }
1257+
1258+ Label {
1259+ anchors.fill: parent
1260+ horizontalAlignment: Text.AlignHCenter
1261+ verticalAlignment: Text.AlignVCenter
1262+ text: internal.desireSection
1263+ fontSize: "small"
1264+ }
1265+
1266+ Behavior on opacity {
1267+ UbuntuNumberAnimation {}
1268+ }
1269+ }
1270+
1271+ Rectangle {
1272+ id: cursor
1273+
1274+ property bool showLabel: false
1275+ property string currentSectionName: ""
1276+
1277+ radius: pinSize * 0.3
1278+ height: pinSize
1279+ width: height
1280+ color: Theme.palette.normal.foreground
1281+ opacity: rail.opacity
1282+ x: rail.x
1283+ y: {
1284+ if (internal.currentItem) {
1285+ var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2)
1286+ return (itemCenterY - (cursor.height / 2))
1287+ } else {
1288+ return 0
1289+ }
1290+ }
1291+ Behavior on y {
1292+ enabled: !internal.fastScrolling
1293+ UbuntuNumberAnimation { }
1294+ }
1295+ }
1296+
1297+ Column {
1298+ id: rail
1299+
1300+ property bool isVisible: root.enabled &&
1301+ (listView.flicking || dragArea.pressed) &&
1302+ (listView.currentIndex == -1)
1303+ anchors {
1304+ right: parent.right
1305+ rightMargin: units.gu(2)
1306+ left: parent.left
1307+ leftMargin: units.gu(2)
1308+ top: parent.top
1309+ }
1310+ height: childrenRect.height
1311+ opacity: 0.0
1312+ onIsVisibleChanged: {
1313+ if (isVisible) {
1314+ rail.opacity = 1.0
1315+ hideTimer.stop()
1316+ } else if (!root.enabled) {
1317+ rail.opacity = 0.0
1318+ } else {
1319+ hideTimer.restart()
1320+ }
1321+ }
1322+
1323+ Behavior on opacity {
1324+ UbuntuNumberAnimation { }
1325+ }
1326+
1327+ Repeater {
1328+ id: sectionsRepeater
1329+
1330+ model: root.letters
1331+ Label {
1332+ id: lbl
1333+
1334+ anchors.left: parent.left
1335+ height: pinSize
1336+ width: pinSize
1337+ verticalAlignment: Text.AlignVCenter
1338+ horizontalAlignment: Text.AlignHCenter
1339+ text: modelData
1340+ fontSize: "x-small"
1341+ color: cursor.y === y ? "white" : Theme.palette.selected.backgroundText
1342+ opacity: !internal.modelDirty && Sections.contains(text) ? 1.0 : 0.5
1343+ }
1344+ }
1345+
1346+ Timer {
1347+ id: hideTimer
1348+
1349+ running: false
1350+ interval: 2000
1351+ onTriggered: rail.opacity = 0.0
1352+ }
1353+ }
1354+
1355+ MouseArea {
1356+ id: dragArea
1357+
1358+ anchors {
1359+ left: parent.left
1360+ right: parent.right
1361+ }
1362+ y: rail.y
1363+ height: rail.height
1364+ visible: rail.opacity == 1.0
1365+
1366+ preventStealing: true
1367+ onPressed: {
1368+ internal.adjustContentPosition(mouseY)
1369+ dragginTimer.start()
1370+ }
1371+
1372+ onReleased: {
1373+ dragginTimer.stop()
1374+ internal.desireSection = ""
1375+ internal.fastScrolling = false
1376+ }
1377+
1378+ onPositionChanged: internal.adjustContentPosition(mouseY)
1379+
1380+ Timer {
1381+ id: dragginTimer
1382+
1383+ running: false
1384+ interval: 150
1385+ onTriggered: {
1386+ internal.fastScrolling = true
1387+ }
1388+ }
1389+ }
1390+
1391+ Timer {
1392+ id: dirtyTimer
1393+ interval: 500
1394+ running: false
1395+ onTriggered: {
1396+ Sections.initSectionData(listView);
1397+ internal.modelDirty = false;
1398+ }
1399+ }
1400+
1401+ Timer {
1402+ id: timerScroll
1403+
1404+ running: false
1405+ interval: 10
1406+ onTriggered: {
1407+ if (internal.desireSection != internal.currentSection) {
1408+ var idx = Sections.getIndexFor(internal.desireSection)
1409+ if (idx !== -1) {
1410+ listView.cancelFlick()
1411+ listView.positionViewAtIndex(idx, ListView.Beginning)
1412+ }
1413+ }
1414+ }
1415+ }
1416+
1417+ QtObject {
1418+ id: internal
1419+
1420+ property string currentSection: listView.currentSection
1421+ property string desireSection: ""
1422+ property string targetSection: fastScrolling ? desireSection : currentSection
1423+ property int oldY: 0
1424+ property bool modelDirty: false
1425+ property bool down: true
1426+ property bool fastScrolling: false
1427+ property var currentItem: null
1428+
1429+ onTargetSectionChanged: moveIndicator(targetSection)
1430+
1431+ function initDirtyObserver() {
1432+ Sections.initialize(listView);
1433+ function dirtyObserver() {
1434+ if (!internal.modelDirty) {
1435+ internal.modelDirty = true;
1436+ dirtyTimer.running = true;
1437+ }
1438+ }
1439+
1440+ if (listView.model.countChanged)
1441+ listView.model.countChanged.connect(dirtyObserver);
1442+
1443+ if (listView.model.itemsChanged)
1444+ listView.model.itemsChanged.connect(dirtyObserver);
1445+
1446+ if (listView.model.itemsInserted)
1447+ listView.model.itemsInserted.connect(dirtyObserver);
1448+
1449+ if (listView.model.itemsMoved)
1450+ listView.model.itemsMoved.connect(dirtyObserver);
1451+
1452+ if (listView.model.itemsRemoved)
1453+ listView.model.itemsRemoved.connect(dirtyObserver);
1454+ }
1455+
1456+ function adjustContentPosition(mouseY) {
1457+ var child = rail.childAt(rail.width / 2, mouseY)
1458+ if (!child || child.text === "") {
1459+ return
1460+ }
1461+ var section = child.text
1462+ if (internal.desireSection !== section) {
1463+ internal.desireSection = section
1464+ moveIndicator(section)
1465+ if (dragArea.pressed) {
1466+ timerScroll.restart()
1467+ }
1468+ }
1469+ }
1470+
1471+ function moveIndicator(section)
1472+ {
1473+ var index = root.letters.indexOf(section)
1474+ if (index != -1) {
1475+ currentItem = sectionsRepeater.itemAt(index)
1476+ }
1477+ }
1478+ }
1479+}
1480
1481=== added file 'app/components/HeaderRow.qml'
1482--- app/components/HeaderRow.qml 1970-01-01 00:00:00 +0000
1483+++ app/components/HeaderRow.qml 2015-03-19 04:32:18 +0000
1484@@ -0,0 +1,65 @@
1485+/*
1486+ * Copyright (C) 2015 Canonical Ltd
1487+ *
1488+ * This file is part of Ubuntu Weather App
1489+ *
1490+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
1491+ * it under the terms of the GNU General Public License version 3 as
1492+ * published by the Free Software Foundation.
1493+ *
1494+ * Ubuntu Weather App is distributed in the hope that it will be useful,
1495+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1496+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1497+ * GNU General Public License for more details.
1498+ *
1499+ * You should have received a copy of the GNU General Public License
1500+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1501+ */
1502+
1503+import QtQuick 2.3
1504+import Ubuntu.Components 1.1
1505+
1506+
1507+Row {
1508+ spacing: units.gu(2)
1509+ width: parent.width
1510+
1511+ property alias locationName: locationNameLabel.text
1512+
1513+ Label {
1514+ id: locationNameLabel
1515+ color: UbuntuColors.darkGrey
1516+ elide: Text.ElideRight
1517+ font.weight: Font.Normal
1518+ fontSize: "large"
1519+ height: settingsButton.height
1520+ width: parent.width - settingsButton.width - parent.spacing
1521+ verticalAlignment: Text.AlignVCenter
1522+ }
1523+
1524+ AbstractButton {
1525+ id: settingsButton
1526+ height: width
1527+ width: units.gu(4)
1528+
1529+ onClicked: mainPageStack.push(Qt.resolvedUrl("../ui/SettingsPage.qml"))
1530+
1531+ Rectangle {
1532+ anchors {
1533+ fill: parent
1534+ }
1535+ color: Theme.palette.selected.background
1536+ visible: parent.pressed
1537+ }
1538+
1539+ Icon {
1540+ anchors {
1541+ centerIn: parent
1542+ }
1543+ color: UbuntuColors.darkGrey
1544+ name: "settings"
1545+ height: width
1546+ width: units.gu(2.5)
1547+ }
1548+ }
1549+}
1550
1551=== added file 'app/components/HomeGraphic.qml'
1552--- app/components/HomeGraphic.qml 1970-01-01 00:00:00 +0000
1553+++ app/components/HomeGraphic.qml 2015-03-19 04:32:18 +0000
1554@@ -0,0 +1,38 @@
1555+/*
1556+ * Copyright (C) 2015 Canonical Ltd
1557+ *
1558+ * This file is part of Ubuntu Weather App
1559+ *
1560+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
1561+ * it under the terms of the GNU General Public License version 3 as
1562+ * published by the Free Software Foundation.
1563+ *
1564+ * Ubuntu Weather App is distributed in the hope that it will be useful,
1565+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1566+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1567+ * GNU General Public License for more details.
1568+ *
1569+ * You should have received a copy of the GNU General Public License
1570+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1571+ */
1572+
1573+import QtQuick 2.3
1574+import Ubuntu.Components 1.1
1575+
1576+Item {
1577+ height: units.gu(32)
1578+ width: parent.width
1579+
1580+ property alias icon: iconImage.source
1581+
1582+ // TODO: will be on 'rails' (horizontal listview?) to reveal hourly forecast
1583+ Image {
1584+ id: iconImage
1585+ anchors {
1586+ centerIn: parent
1587+ }
1588+ fillMode: Image.PreserveAspectFit
1589+ width: parent.width
1590+ }
1591+}
1592+
1593
1594=== added file 'app/components/HomeHourly.qml'
1595--- app/components/HomeHourly.qml 1970-01-01 00:00:00 +0000
1596+++ app/components/HomeHourly.qml 2015-03-19 04:32:18 +0000
1597@@ -0,0 +1,96 @@
1598+/*
1599+ * Copyright (C) 2015 Canonical Ltd
1600+ *
1601+ * This file is part of Ubuntu Weather App
1602+ *
1603+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
1604+ * it under the terms of the GNU General Public License version 3 as
1605+ * published by the Free Software Foundation.
1606+ *
1607+ * Ubuntu Weather App is distributed in the hope that it will be useful,
1608+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1609+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1610+ * GNU General Public License for more details.
1611+ *
1612+ * You should have received a copy of the GNU General Public License
1613+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1614+ */
1615+
1616+import QtQuick 2.3
1617+import Ubuntu.Components 1.1
1618+import Ubuntu.Components.ListItems 0.1 as ListItem
1619+import QtGraphicalEffects 1.0
1620+
1621+Item {
1622+ id: homeHourly
1623+
1624+ onVisibleChanged: {
1625+ if(visible) {
1626+ ListView.model = forecasts.length
1627+ }
1628+ }
1629+
1630+ ListView {
1631+ id: hourlyForecasts
1632+ width:parent.width
1633+ height:parent.height
1634+ model: forecasts.length
1635+ orientation: ListView.Horizontal
1636+ clip:true
1637+ MouseArea {
1638+ anchors.fill: parent
1639+ onClicked: {
1640+ homeGraphic.visible = true
1641+ }
1642+ }
1643+ delegate: Rectangle {
1644+ width: childrenRect.width
1645+ height: parent.height
1646+ property var hourData: forecasts[index]
1647+ Column {
1648+ id: hourColumn
1649+ width: units.gu(10)
1650+ height: childrenRect.height
1651+ anchors.verticalCenter: parent.verticalCenter
1652+ Label {
1653+ text: formatTimestamp(hourData.date, 'ddd')+" "+formatTime(hourData.date, 'h:mm')
1654+ fontSize: "small"
1655+ font.weight: Font.Light
1656+ anchors.horizontalCenter: parent.horizontalCenter
1657+ }
1658+ Item {
1659+ width: units.gu(7)
1660+ height: units.gu(7)
1661+ anchors.horizontalCenter: parent.horizontalCenter
1662+ Image {
1663+ id: iconImage
1664+ fillMode: Image.PreserveAspectFit
1665+ anchors.fill: parent
1666+ source: (hourData.icon !== undefined && iconMap[hourData.icon] !== undefined) ? iconMap[hourData.icon] : ""
1667+ }
1668+ ColorOverlay {
1669+ anchors.fill: iconImage
1670+ source: iconImage
1671+ color: UbuntuColors.orange
1672+ anchors.horizontalCenter: parent.horizontalCenter
1673+ }
1674+ }
1675+ Label {
1676+ font.pixelSize: units.gu(3)
1677+ font.weight: Font.Light
1678+ anchors.horizontalCenter: parent.horizontalCenter
1679+ text: Math.round(hourData[tempUnits].temp).toString()+settings.tempScale
1680+ }
1681+
1682+ }
1683+ Rectangle {
1684+ anchors.verticalCenter: parent.verticalCenter
1685+ color: UbuntuColors.darkGrey
1686+ height: hourColumn.height
1687+ opacity: 0.2
1688+ visible: index > 0
1689+ width: units.gu(0.1)
1690+ }
1691+ }
1692+ }
1693+}
1694
1695=== added file 'app/components/HomeTempInfo.qml'
1696--- app/components/HomeTempInfo.qml 1970-01-01 00:00:00 +0000
1697+++ app/components/HomeTempInfo.qml 2015-03-19 04:32:18 +0000
1698@@ -0,0 +1,73 @@
1699+/*
1700+ * Copyright (C) 2015 Canonical Ltd
1701+ *
1702+ * This file is part of Ubuntu Weather App
1703+ *
1704+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
1705+ * it under the terms of the GNU General Public License version 3 as
1706+ * published by the Free Software Foundation.
1707+ *
1708+ * Ubuntu Weather App is distributed in the hope that it will be useful,
1709+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1710+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1711+ * GNU General Public License for more details.
1712+ *
1713+ * You should have received a copy of the GNU General Public License
1714+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1715+ */
1716+
1717+import QtQuick 2.3
1718+import Ubuntu.Components 1.1
1719+
1720+
1721+Column {
1722+ anchors {
1723+ left: parent.left
1724+ right: parent.right
1725+ }
1726+ spacing: units.gu(1)
1727+
1728+ property alias description: descriptionLabel.text
1729+ property alias high: highLabel.text
1730+ property alias low: lowLabel.text
1731+ property alias now: nowLabel.text
1732+
1733+ Label {
1734+ font.weight: Font.Light
1735+ fontSize: "small"
1736+ text: i18n.tr("Today")
1737+ }
1738+
1739+ Label {
1740+ id: descriptionLabel
1741+ font.weight: Font.Normal
1742+ fontSize: "large"
1743+ }
1744+
1745+ Row {
1746+ spacing: units.gu(2)
1747+
1748+ Label {
1749+ id: nowLabel
1750+ color: UbuntuColors.orange
1751+ font.pixelSize: units.gu(8)
1752+ font.weight: Font.Light
1753+ height: units.gu(8)
1754+ verticalAlignment: Text.AlignBottom // AlignBottom seems to put it at the top?
1755+ }
1756+
1757+ Column {
1758+ Label {
1759+ id: lowLabel
1760+ font.weight: Font.Light
1761+ fontSize: "medium"
1762+ }
1763+
1764+ Label {
1765+ id: highLabel
1766+ font.weight: Font.Light
1767+ fontSize: "medium"
1768+ }
1769+ }
1770+ }
1771+}
1772
1773=== added directory 'app/components/ListItemActions'
1774=== added file 'app/components/ListItemActions/CMakeLists.txt'
1775--- app/components/ListItemActions/CMakeLists.txt 1970-01-01 00:00:00 +0000
1776+++ app/components/ListItemActions/CMakeLists.txt 2015-03-19 04:32:18 +0000
1777@@ -0,0 +1,5 @@
1778+file(GLOB LISTITEMACTIONS_QML_JS_FILES *.qml *.js)
1779+
1780+add_custom_target(ubuntu-weather-app_listitemactions_QMlFiles ALL SOURCES ${LISTITEMACTIONS_QML_JS_FILES})
1781+
1782+install(FILES ${LISTITEMACTIONS_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/components/ListItemActions)
1783
1784=== added file 'app/components/ListItemActions/CheckBox.qml'
1785--- app/components/ListItemActions/CheckBox.qml 1970-01-01 00:00:00 +0000
1786+++ app/components/ListItemActions/CheckBox.qml 2015-03-19 04:32:18 +0000
1787@@ -0,0 +1,25 @@
1788+/*
1789+ * Copyright (C) 2012-2014 Canonical, Ltd.
1790+ *
1791+ * This program is free software; you can redistribute it and/or modify
1792+ * it under the terms of the GNU General Public License as published by
1793+ * the Free Software Foundation; version 3.
1794+ *
1795+ * This program is distributed in the hope that it will be useful,
1796+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1797+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1798+ * GNU General Public License for more details.
1799+ *
1800+ * You should have received a copy of the GNU General Public License
1801+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1802+ */
1803+
1804+import QtQuick 2.2
1805+import Ubuntu.Components 1.1
1806+
1807+CheckBox {
1808+ checked: root.selected
1809+ width: implicitWidth
1810+ // disable item mouse area to avoid conflicts with parent mouse area
1811+ __mouseArea.enabled: false
1812+}
1813
1814=== added file 'app/components/ListItemActions/Remove.qml'
1815--- app/components/ListItemActions/Remove.qml 1970-01-01 00:00:00 +0000
1816+++ app/components/ListItemActions/Remove.qml 2015-03-19 04:32:18 +0000
1817@@ -0,0 +1,27 @@
1818+/*
1819+ * Copyright (C) 2014 Andrew Hayzen <ahayzen@gmail.com>
1820+ * Daniel Holm <d.holmen@gmail.com>
1821+ * Victor Thompson <victor.thompson@gmail.com>
1822+ *
1823+ * This program is free software; you can redistribute it and/or modify
1824+ * it under the terms of the GNU General Public License as published by
1825+ * the Free Software Foundation; version 3.
1826+ *
1827+ * This program is distributed in the hope that it will be useful,
1828+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1829+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1830+ * GNU General Public License for more details.
1831+ *
1832+ * You should have received a copy of the GNU General Public License
1833+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1834+ */
1835+
1836+import QtQuick 2.3
1837+import Ubuntu.Components 1.1
1838+
1839+Action {
1840+ id: removeAction
1841+ iconName: "delete"
1842+ objectName: "swipeDeleteAction"
1843+ text: i18n.tr("Remove")
1844+}
1845
1846=== added file 'app/components/ListItemReorderComponent.qml'
1847--- app/components/ListItemReorderComponent.qml 1970-01-01 00:00:00 +0000
1848+++ app/components/ListItemReorderComponent.qml 2015-03-19 04:32:18 +0000
1849@@ -0,0 +1,106 @@
1850+/*
1851+ * Copyright (C) 2013, 2014, 2015
1852+ * Andrew Hayzen <ahayzen@gmail.com>
1853+ * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
1854+ * Victor Thompson <victor.thompson@gmail.com>
1855+ *
1856+ * This program is free software; you can redistribute it and/or modify
1857+ * it under the terms of the GNU General Public License as published by
1858+ * the Free Software Foundation; version 3.
1859+ *
1860+ * This program is distributed in the hope that it will be useful,
1861+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1862+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1863+ * GNU General Public License for more details.
1864+ *
1865+ * You should have received a copy of the GNU General Public License
1866+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1867+ */
1868+
1869+import QtQuick 2.3
1870+import Ubuntu.Components 1.1
1871+
1872+
1873+Item {
1874+ id: actionReorder
1875+ width: units.gu(4)
1876+
1877+ Icon {
1878+ anchors {
1879+ horizontalCenter: parent.horizontalCenter
1880+ verticalCenter: parent.verticalCenter
1881+ }
1882+ name: "navigation-menu" // TODO: use proper image
1883+ height: width
1884+ width: units.gu(3)
1885+ }
1886+
1887+ MouseArea {
1888+ id: actionReorderMouseArea
1889+ anchors {
1890+ fill: parent
1891+ }
1892+ property int startY: 0
1893+ property int startContentY: 0
1894+
1895+ onPressed: {
1896+ root.parent.parent.interactive = false; // stop scrolling of listview
1897+ startY = root.y;
1898+ startContentY = root.parent.parent.contentY;
1899+ root.z += 10; // force ontop of other elements
1900+
1901+ console.debug("Reorder listitem pressed", root.y)
1902+ }
1903+ onMouseYChanged: root.y += mouse.y - (root.height / 2);
1904+ onReleased: {
1905+ console.debug("Reorder diff by position", getDiff());
1906+
1907+ var diff = getDiff();
1908+
1909+ // Remove the height of the actual item if moved down
1910+ if (diff > 0) {
1911+ diff -= 1;
1912+ }
1913+
1914+ root.parent.parent.interactive = true; // reenable scrolling
1915+
1916+ if (diff === 0) {
1917+ // Nothing has changed so reset the item
1918+ // z index is restored after animation
1919+ resetListItemYAnimation.start();
1920+ }
1921+ else {
1922+ var newIndex = index + diff;
1923+
1924+ if (newIndex < 0) {
1925+ newIndex = 0;
1926+ }
1927+ else if (newIndex > root.parent.parent.count - 1) {
1928+ newIndex = root.parent.parent.count - 1;
1929+ }
1930+
1931+ root.z -= 10; // restore z index
1932+ reorder(index, newIndex)
1933+ }
1934+ }
1935+
1936+ function getDiff() {
1937+ // Get the amount of items that have been passed over (by centre)
1938+ return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5);
1939+ }
1940+ }
1941+
1942+ SequentialAnimation {
1943+ id: resetListItemYAnimation
1944+ UbuntuNumberAnimation {
1945+ target: root;
1946+ property: "y";
1947+ to: actionReorderMouseArea.startY
1948+ }
1949+ ScriptAction {
1950+ script: {
1951+ root.z -= 10; // restore z index
1952+ }
1953+ }
1954+ }
1955+}
1956
1957=== added file 'app/components/ListItemWithActions.qml'
1958--- app/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
1959+++ app/components/ListItemWithActions.qml 2015-03-19 04:32:18 +0000
1960@@ -0,0 +1,496 @@
1961+/*
1962+ * Copyright (C) 2012-2015 Canonical, Ltd.
1963+ *
1964+ * This program is free software; you can redistribute it and/or modify
1965+ * it under the terms of the GNU General Public License as published by
1966+ * the Free Software Foundation; version 3.
1967+ *
1968+ * This program is distributed in the hope that it will be useful,
1969+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1970+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1971+ * GNU General Public License for more details.
1972+ *
1973+ * You should have received a copy of the GNU General Public License
1974+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1975+ */
1976+
1977+import QtQuick 2.3
1978+import Ubuntu.Components 1.1
1979+import Ubuntu.Components.ListItems 1.0 as ListItem
1980+
1981+
1982+Item {
1983+ id: root
1984+ width: parent.width
1985+
1986+ property Action leftSideAction: null
1987+ property list<Action> rightSideActions
1988+ property double defaultHeight: units.gu(8)
1989+ property bool locked: false
1990+ property Action activeAction: null
1991+ property var activeItem: null
1992+ property bool triggerActionOnMouseRelease: false
1993+ property color color: Theme.palette.normal.background
1994+ property color selectedColor: "#E6E6E6"
1995+ property bool selected: false
1996+ property bool selectionMode: false
1997+ property alias internalAnchors: mainContents.anchors
1998+ default property alias contents: mainContents.children
1999+
2000+ readonly property double actionWidth: units.gu(4)
2001+ readonly property double leftActionWidth: units.gu(10)
2002+ readonly property double actionThreshold: actionWidth * 0.4
2003+ readonly property double threshold: 0.4
2004+ readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
2005+ readonly property alias swipping: mainItemMoving.running
2006+ readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
2007+
2008+ property alias _main: main // CUSTOM
2009+ property alias pressed: mouseArea.pressed // CUSTOM
2010+
2011+ /* internal */
2012+ property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
2013+
2014+ signal itemClicked(var mouse)
2015+ signal itemPressAndHold(var mouse)
2016+
2017+ function returnToBoundsRTL(direction)
2018+ {
2019+ var actionFullWidth = actionWidth + units.gu(2)
2020+
2021+ // go back to normal state if swipping reverse
2022+ if (direction === "LTR") {
2023+ updatePosition(0)
2024+ return
2025+ } else if (!triggerActionOnMouseRelease) {
2026+ updatePosition(-rightActionsView.width + units.gu(2))
2027+ return
2028+ }
2029+
2030+ var xOffset = Math.abs(main.x)
2031+ var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
2032+ var newX = 0
2033+
2034+ if (index === _visibleRightSideActions.length) {
2035+ newX = -(rightActionsView.width - units.gu(2))
2036+ } else if (index >= 1) {
2037+ newX = -(actionFullWidth * index)
2038+ }
2039+
2040+ updatePosition(newX)
2041+ }
2042+
2043+ function returnToBoundsLTR(direction)
2044+ {
2045+ var finalX = leftActionWidth
2046+ if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
2047+ finalX = 0
2048+ updatePosition(finalX)
2049+ }
2050+
2051+ function returnToBounds(direction)
2052+ {
2053+ if (main.x < 0) {
2054+ returnToBoundsRTL(direction)
2055+ } else if (main.x > 0) {
2056+ returnToBoundsLTR(direction)
2057+ } else {
2058+ updatePosition(0)
2059+ }
2060+ }
2061+
2062+ function contains(item, point, marginX)
2063+ {
2064+ var itemStartX = item.x - marginX
2065+ var itemEndX = item.x + item.width + marginX
2066+ return (point.x >= itemStartX) && (point.x <= itemEndX) &&
2067+ (point.y >= item.y) && (point.y <= (item.y + item.height));
2068+ }
2069+
2070+ function getActionAt(point)
2071+ {
2072+ if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
2073+ return leftSideAction
2074+ } else if (contains(rightActionsView, point, 0)) {
2075+ var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
2076+ for (var i = 0; i < rightActionsRepeater.count; i++) {
2077+ var child = rightActionsRepeater.itemAt(i)
2078+ if (contains(child, newPoint, units.gu(1))) {
2079+ return i
2080+ }
2081+ }
2082+ }
2083+ return -1
2084+ }
2085+
2086+ function updateActiveAction()
2087+ {
2088+ if (triggerActionOnMouseRelease &&
2089+ (main.x <= -(root.actionWidth + units.gu(2))) &&
2090+ (main.x > -(rightActionsView.width - units.gu(2)))) {
2091+ var actionFullWidth = actionWidth + units.gu(2)
2092+ var xOffset = Math.abs(main.x)
2093+ var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
2094+ index = index - 1
2095+ if (index > -1) {
2096+ root.activeItem = rightActionsRepeater.itemAt(index)
2097+ root.activeAction = root._visibleRightSideActions[index]
2098+ }
2099+ } else {
2100+ root.activeAction = null
2101+ }
2102+ }
2103+
2104+ function resetSwipe()
2105+ {
2106+ updatePosition(0)
2107+ }
2108+
2109+ function filterVisibleActions(actions)
2110+ {
2111+ var visibleActions = []
2112+ for(var i = 0; i < actions.length; i++) {
2113+ var action = actions[i]
2114+ if (action.visible) {
2115+ visibleActions.push(action)
2116+ }
2117+ }
2118+ return visibleActions
2119+ }
2120+
2121+ function updatePosition(pos)
2122+ {
2123+ if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
2124+ mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
2125+ } else {
2126+ mouseArea.state = ""
2127+ }
2128+ main.x = pos
2129+ }
2130+
2131+ // CUSTOM remove animation
2132+ SequentialAnimation {
2133+ id: removeAnimation
2134+
2135+ property var action
2136+
2137+ UbuntuNumberAnimation {
2138+ target: root
2139+ duration: UbuntuAnimation.BriskDuration
2140+ property: "height";
2141+ to: 0
2142+ }
2143+ ScriptAction {
2144+ script: removeAnimation.action.trigger()
2145+ }
2146+ }
2147+
2148+ states: [
2149+ State {
2150+ name: "select"
2151+ when: selectionMode || selected
2152+ PropertyChanges {
2153+ target: selectionIcon
2154+ source: Qt.resolvedUrl("ListItemActions/CheckBox.qml")
2155+ anchors.leftMargin: units.gu(2)
2156+ }
2157+ PropertyChanges {
2158+ target: root
2159+ locked: true
2160+ }
2161+ PropertyChanges {
2162+ target: main
2163+ x: 0
2164+ }
2165+ }
2166+ ]
2167+
2168+ height: defaultHeight
2169+ //clip: height !== defaultHeight // CUSTOM
2170+
2171+ Loader { // CUSTOM
2172+ id: leftActionViewLoader
2173+ anchors {
2174+ top: parent.top
2175+ bottom: parent.bottom
2176+ right: main.left
2177+ }
2178+ asynchronous: true
2179+ sourceComponent: leftSideAction ? leftActionViewComponent : undefined
2180+ }
2181+
2182+ Component { // CUSTOM
2183+ id: leftActionViewComponent
2184+
2185+ Rectangle {
2186+ id: leftActionView
2187+ width: root.leftActionWidth + actionThreshold
2188+ color: UbuntuColors.red
2189+
2190+ Icon {
2191+ id: leftActionIcon
2192+ anchors {
2193+ centerIn: parent
2194+ horizontalCenterOffset: actionThreshold / 2
2195+ }
2196+ objectName: "swipeDeleteAction" // CUSTOM
2197+ name: leftSideAction && _showActions ? leftSideAction.iconName : ""
2198+ color: Theme.palette.selected.field
2199+ height: units.gu(3)
2200+ width: units.gu(3)
2201+ }
2202+ }
2203+ }
2204+
2205+ //Rectangle {
2206+ Item { // CUSTOM
2207+ id: rightActionsView
2208+
2209+ anchors {
2210+ top: main.top
2211+ left: main.right
2212+ bottom: main.bottom
2213+ }
2214+ visible: _visibleRightSideActions.length > 0
2215+ width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
2216+ // color: "white" // CUSTOM
2217+
2218+ Row {
2219+ anchors{
2220+ top: parent.top
2221+ left: parent.left
2222+ leftMargin: units.gu(2)
2223+ right: parent.right
2224+ rightMargin: units.gu(2)
2225+ bottom: parent.bottom
2226+ }
2227+ spacing: units.gu(2)
2228+ Repeater {
2229+ id: rightActionsRepeater
2230+
2231+ model: _showActions ? _visibleRightSideActions : []
2232+ Item {
2233+ property alias image: img
2234+
2235+ height: rightActionsView.height
2236+ width: root.actionWidth
2237+
2238+ Icon {
2239+ id: img
2240+
2241+ anchors.centerIn: parent
2242+ objectName: rightSideActions[index].objectName // CUSTOM
2243+ width: units.gu(3)
2244+ height: units.gu(3)
2245+ name: modelData.iconName
2246+ color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.coolGrey // CUSTOM
2247+ }
2248+ }
2249+ }
2250+ }
2251+ }
2252+
2253+ Rectangle {
2254+ id: main
2255+ objectName: "mainItem"
2256+
2257+ anchors {
2258+ top: parent.top
2259+ bottom: parent.bottom
2260+ }
2261+
2262+ width: parent.width
2263+ color: root.selected ? root.selectedColor : root.color
2264+
2265+ Loader {
2266+ id: selectionIcon
2267+
2268+ anchors {
2269+ left: main.left
2270+ verticalCenter: main.verticalCenter
2271+ }
2272+ asynchronous: true // CUSTOM
2273+ width: (status === Loader.Ready) ? item.implicitWidth : 0
2274+ visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
2275+
2276+ Behavior on width {
2277+ NumberAnimation {
2278+ duration: UbuntuAnimation.SnapDuration
2279+ }
2280+ }
2281+ }
2282+
2283+ Item {
2284+ id: mainContents
2285+
2286+ anchors {
2287+ left: selectionIcon.right
2288+ //leftMargin: units.gu(2) // CUSTOM
2289+ top: parent.top
2290+ //topMargin: units.gu(1) // CUSTOM
2291+ right: parent.right
2292+ //rightMargin: units.gu(2) // CUSTOM
2293+ bottom: parent.bottom
2294+ //bottomMargin: units.gu(1) // CUSTOM
2295+ }
2296+ }
2297+
2298+ Behavior on x {
2299+ UbuntuNumberAnimation {
2300+ id: mainItemMoving
2301+
2302+ easing.type: Easing.OutElastic
2303+ duration: UbuntuAnimation.SlowDuration
2304+ }
2305+ }
2306+ }
2307+
2308+ SequentialAnimation {
2309+ id: triggerAction
2310+
2311+ property var currentItem: root.activeItem ? root.activeItem.image : null
2312+
2313+ running: false
2314+ ParallelAnimation {
2315+ UbuntuNumberAnimation {
2316+ target: triggerAction.currentItem
2317+ property: "opacity"
2318+ from: 1.0
2319+ to: 0.0
2320+ duration: UbuntuAnimation.SlowDuration
2321+ easing {type: Easing.InOutBack; }
2322+ }
2323+ UbuntuNumberAnimation {
2324+ target: triggerAction.currentItem
2325+ properties: "width, height"
2326+ from: units.gu(3)
2327+ to: root.actionWidth
2328+ duration: UbuntuAnimation.SlowDuration
2329+ easing {type: Easing.InOutBack; }
2330+ }
2331+ }
2332+ PropertyAction {
2333+ target: triggerAction.currentItem
2334+ properties: "width, height"
2335+ value: units.gu(3)
2336+ }
2337+ PropertyAction {
2338+ target: triggerAction.currentItem
2339+ properties: "opacity"
2340+ value: 1.0
2341+ }
2342+ ScriptAction {
2343+ script: {
2344+ root.activeAction.triggered(root)
2345+ mouseArea.state = ""
2346+ }
2347+ }
2348+ PauseAnimation {
2349+ duration: 500
2350+ }
2351+ UbuntuNumberAnimation {
2352+ target: main
2353+ property: "x"
2354+ to: 0
2355+ }
2356+ }
2357+
2358+ MouseArea {
2359+ id: mouseArea
2360+
2361+ property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM
2362+ property bool manual: false
2363+ property string direction: "None"
2364+ property real lastX: -1
2365+
2366+ anchors.fill: parent
2367+ drag {
2368+ target: locked ? null : main
2369+ axis: Drag.XAxis
2370+ minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
2371+ maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
2372+ threshold: root.actionThreshold
2373+ }
2374+
2375+ states: [
2376+ State {
2377+ name: "LeftToRight"
2378+ PropertyChanges {
2379+ target: mouseArea
2380+ drag.maximumX: 0
2381+ }
2382+ },
2383+ State {
2384+ name: "RightToLeft"
2385+ PropertyChanges {
2386+ target: mouseArea
2387+ drag.minimumX: 0
2388+ }
2389+ }
2390+ ]
2391+
2392+ onMouseXChanged: {
2393+ var offset = (lastX - mouseX)
2394+ if (Math.abs(offset) <= root.actionThreshold) {
2395+ return
2396+ }
2397+ lastX = mouseX
2398+ direction = offset > 0 ? "RTL" : "LTR";
2399+ }
2400+
2401+ onPressed: {
2402+ lastX = mouse.x
2403+ }
2404+
2405+ onReleased: {
2406+ if (root.triggerActionOnMouseRelease && root.activeAction) {
2407+ triggerAction.start()
2408+ } else {
2409+ root.returnToBounds()
2410+ root.activeAction = null
2411+ }
2412+ lastX = -1
2413+ direction = "None"
2414+ }
2415+ onClicked: {
2416+ if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode
2417+ selected = !selected
2418+ return
2419+ } else if (main.x === 0) {
2420+ root.itemClicked(mouse)
2421+ } else if (main.x > 0) {
2422+ var action = getActionAt(Qt.point(mouse.x, mouse.y))
2423+ if (action && action !== -1) {
2424+ //action.triggered(root)
2425+ removeAnimation.action = action // CUSTOM - use our animation instead
2426+ removeAnimation.start() // CUSTOM
2427+ }
2428+ } else {
2429+ var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
2430+
2431+ if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction
2432+ root.activeItem = rightActionsRepeater.itemAt(actionIndex)
2433+ root.activeAction = root.rightSideActions[actionIndex]
2434+ triggerAction.start()
2435+ return
2436+ }
2437+ }
2438+ root.resetSwipe()
2439+ }
2440+
2441+ onPositionChanged: {
2442+ if (mouseArea.pressed) {
2443+ updateActiveAction()
2444+
2445+ listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe
2446+ }
2447+ }
2448+ onPressAndHold: {
2449+ if (main.x === 0) {
2450+ root.itemPressAndHold(mouse)
2451+ }
2452+ }
2453+
2454+ z: -1
2455+ }
2456+}
2457
2458=== added file 'app/components/MultiSelectHeadState.qml'
2459--- app/components/MultiSelectHeadState.qml 1970-01-01 00:00:00 +0000
2460+++ app/components/MultiSelectHeadState.qml 2015-03-19 04:32:18 +0000
2461@@ -0,0 +1,72 @@
2462+/*
2463+ * Copyright (C) 2015
2464+ * Andrew Hayzen <ahayzen@gmail.com>
2465+ * Victor Thompson <victor.thompson@gmail.com>
2466+ *
2467+ * This program is free software; you can redistribute it and/or modify
2468+ * it under the terms of the GNU General Public License as published by
2469+ * the Free Software Foundation; version 3.
2470+ *
2471+ * This program is distributed in the hope that it will be useful,
2472+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2473+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2474+ * GNU General Public License for more details.
2475+ *
2476+ * You should have received a copy of the GNU General Public License
2477+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2478+ */
2479+
2480+import QtQuick 2.3
2481+import Ubuntu.Components 1.1
2482+
2483+PageHeadState {
2484+ id: selectionState
2485+ actions: [
2486+ Action {
2487+ iconName: "select"
2488+ text: i18n.tr("Select All")
2489+ onTriggered: {
2490+ if (listview.selectedItems.length === listview.model.count) {
2491+ listview.clearSelection()
2492+ } else {
2493+ listview.selectAll()
2494+ }
2495+ }
2496+ },
2497+ Action {
2498+ enabled: listview.selectedItems.length > 0
2499+ iconName: "delete"
2500+ text: i18n.tr("Delete")
2501+ visible: removable
2502+
2503+ onTriggered: {
2504+ removed(listview.selectedItems)
2505+
2506+ listview.closeSelection()
2507+ }
2508+ }
2509+
2510+ ]
2511+ backAction: Action {
2512+ text: i18n.tr("Cancel selection")
2513+ iconName: "back"
2514+ onTriggered: {
2515+ listview.clearSelection()
2516+ listview.state = "normal"
2517+ }
2518+ }
2519+ head: thisPage.head
2520+ name: "selection"
2521+
2522+ PropertyChanges {
2523+ target: thisPage.head
2524+ backAction: selectionState.backAction
2525+ actions: selectionState.actions
2526+ }
2527+
2528+ property ListView listview
2529+ property bool removable: false
2530+ property Page thisPage
2531+
2532+ signal removed(var selectedItems)
2533+}
2534
2535=== added file 'app/components/MultiSelectListView.qml'
2536--- app/components/MultiSelectListView.qml 1970-01-01 00:00:00 +0000
2537+++ app/components/MultiSelectListView.qml 2015-03-19 04:32:18 +0000
2538@@ -0,0 +1,52 @@
2539+/*
2540+ * Copyright (C) 2013, 2014, 2015
2541+ * Andrew Hayzen <ahayzen@gmail.com>
2542+ * Daniel Holm <d.holmen@gmail.com>
2543+ * Victor Thompson <victor.thompson@gmail.com>
2544+ *
2545+ * This program is free software; you can redistribute it and/or modify
2546+ * it under the terms of the GNU General Public License as published by
2547+ * the Free Software Foundation; version 3.
2548+ *
2549+ * This program is distributed in the hope that it will be useful,
2550+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2551+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2552+ * GNU General Public License for more details.
2553+ *
2554+ * You should have received a copy of the GNU General Public License
2555+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2556+ */
2557+
2558+import QtQuick 2.3
2559+import Ubuntu.Components 1.1
2560+
2561+
2562+WeatherListView {
2563+ property var selectedItems: []
2564+
2565+ signal clearSelection()
2566+ signal closeSelection()
2567+ signal selectAll()
2568+
2569+ onClearSelection: selectedItems = []
2570+ onCloseSelection: {
2571+ clearSelection()
2572+ state = "normal"
2573+ }
2574+ onSelectAll: {
2575+ var tmp = selectedItems
2576+
2577+ for (var i=0; i < model.count; i++) {
2578+ if (tmp.indexOf(i) === -1) {
2579+ tmp.push(i)
2580+ }
2581+ }
2582+
2583+ selectedItems = tmp
2584+ }
2585+ onVisibleChanged: {
2586+ if (!visible) {
2587+ closeSelection()
2588+ }
2589+ }
2590+}
2591
2592=== added file 'app/components/PageWithBottomEdge.qml'
2593--- app/components/PageWithBottomEdge.qml 1970-01-01 00:00:00 +0000
2594+++ app/components/PageWithBottomEdge.qml 2015-03-19 04:32:18 +0000
2595@@ -0,0 +1,411 @@
2596+/*
2597+ * Copyright (C) 2014 Canonical, Ltd.
2598+ *
2599+ * This program is free software; you can redistribute it and/or modify
2600+ * it under the terms of the GNU General Public License as published by
2601+ * the Free Software Foundation; version 3.
2602+ *
2603+ * This program is distributed in the hope that it will be useful,
2604+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2605+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2606+ * GNU General Public License for more details.
2607+ *
2608+ * You should have received a copy of the GNU General Public License
2609+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2610+ */
2611+
2612+/*
2613+ Example:
2614+
2615+ MainView {
2616+ objectName: "mainView"
2617+
2618+ applicationName: "com.ubuntu.developer.boiko.bottomedge"
2619+
2620+ width: units.gu(100)
2621+ height: units.gu(75)
2622+
2623+ Component {
2624+ id: pageComponent
2625+
2626+ PageWithBottomEdge {
2627+ id: mainPage
2628+ title: i18n.tr("Main Page")
2629+
2630+ Rectangle {
2631+ anchors.fill: parent
2632+ color: "white"
2633+ }
2634+
2635+ bottomEdgePageComponent: Page {
2636+ title: "Contents"
2637+ anchors.fill: parent
2638+ //anchors.topMargin: contentsPage.flickable.contentY
2639+
2640+ ListView {
2641+ anchors.fill: parent
2642+ model: 50
2643+ delegate: ListItems.Standard {
2644+ text: "One Content Item: " + index
2645+ }
2646+ }
2647+ }
2648+ bottomEdgeTitle: i18n.tr("Bottom edge action")
2649+ }
2650+ }
2651+
2652+ PageStack {
2653+ id: stack
2654+ Component.onCompleted: stack.push(pageComponent)
2655+ }
2656+ }
2657+
2658+*/
2659+
2660+import QtQuick 2.2
2661+import Ubuntu.Components 1.1
2662+
2663+Page {
2664+ id: page
2665+
2666+ property alias bottomEdgePageComponent: edgeLoader.sourceComponent
2667+ property alias bottomEdgePageSource: edgeLoader.source
2668+ property alias bottomEdgeTitle: tipLabel.text
2669+ property bool bottomEdgeEnabled: true
2670+ property int bottomEdgeExpandThreshold: page.height * 0.2
2671+ property int bottomEdgeExposedArea: bottomEdge.state !== "expanded" ? (page.height - bottomEdge.y - bottomEdge.tipHeight) : _areaWhenExpanded
2672+ property bool reloadBottomEdgePage: true
2673+
2674+ readonly property alias bottomEdgePage: edgeLoader.item
2675+ readonly property bool isReady: ((bottomEdge.y === 0) && bottomEdgePageLoaded && edgeLoader.item.active)
2676+ readonly property bool isCollapsed: (bottomEdge.y === page.height)
2677+ readonly property bool bottomEdgePageLoaded: (edgeLoader.status == Loader.Ready)
2678+
2679+ property bool _showEdgePageWhenReady: false
2680+ property int _areaWhenExpanded: 0
2681+
2682+ // CUSTOM properties to allow changing of color
2683+ property alias tipColor: tip.color
2684+ property alias tipLabelColor: tipLabel.color
2685+
2686+ signal bottomEdgeReleased()
2687+ signal bottomEdgeDismissed()
2688+
2689+
2690+ function showBottomEdgePage(source, properties)
2691+ {
2692+ edgeLoader.setSource(source, properties)
2693+ _showEdgePageWhenReady = true
2694+ }
2695+
2696+ function setBottomEdgePage(source, properties)
2697+ {
2698+ edgeLoader.setSource(source, properties)
2699+ }
2700+
2701+ function _pushPage()
2702+ {
2703+ if (edgeLoader.status === Loader.Ready) {
2704+ edgeLoader.item.active = true
2705+ page.pageStack.push(edgeLoader.item)
2706+ if (edgeLoader.item.flickable) {
2707+ edgeLoader.item.flickable.contentY = -page.header.height
2708+ edgeLoader.item.flickable.returnToBounds()
2709+ }
2710+ if (edgeLoader.item.ready)
2711+ edgeLoader.item.ready()
2712+ }
2713+ }
2714+
2715+
2716+ Component.onCompleted: {
2717+ // avoid a binding on the expanded height value
2718+ var expandedHeight = height;
2719+ _areaWhenExpanded = expandedHeight;
2720+ }
2721+
2722+ onActiveChanged: {
2723+ if (active) {
2724+ bottomEdge.state = "collapsed"
2725+ }
2726+ }
2727+
2728+ onBottomEdgePageLoadedChanged: {
2729+ if (_showEdgePageWhenReady && bottomEdgePageLoaded) {
2730+ bottomEdge.state = "expanded"
2731+ _showEdgePageWhenReady = false
2732+ }
2733+ }
2734+
2735+ Rectangle {
2736+ id: bgVisual
2737+
2738+ color: "black"
2739+ anchors.fill: page
2740+ opacity: 0.7 * ((page.height - bottomEdge.y) / page.height)
2741+ z: 1
2742+ }
2743+
2744+ UbuntuShape {
2745+ id: tip
2746+ objectName: "bottomEdgeTip"
2747+
2748+ property bool hidden: (activeFocus === false) || ((bottomEdge.y - units.gu(1)) < tip.y)
2749+
2750+ enabled: mouseArea.enabled
2751+ visible: page.bottomEdgeEnabled
2752+ anchors {
2753+ bottom: parent.bottom
2754+ horizontalCenter: bottomEdge.horizontalCenter
2755+ bottomMargin: hidden ? - height + units.gu(1) : -units.gu(1)
2756+ Behavior on bottomMargin {
2757+ SequentialAnimation {
2758+ // wait some msecs in case of the focus change again, to avoid flickering
2759+ PauseAnimation {
2760+ duration: 300
2761+ }
2762+ UbuntuNumberAnimation {
2763+ duration: UbuntuAnimation.SnapDuration
2764+ }
2765+ }
2766+ }
2767+ }
2768+
2769+ z: 1
2770+ width: tipLabel.paintedWidth + units.gu(6)
2771+ height: bottomEdge.tipHeight + units.gu(1)
2772+ color: Theme.palette.normal.overlay
2773+ Label {
2774+ id: tipLabel
2775+
2776+ anchors {
2777+ top: parent.top
2778+ left: parent.left
2779+ right: parent.right
2780+ }
2781+ height: bottomEdge.tipHeight
2782+ verticalAlignment: Text.AlignVCenter
2783+ horizontalAlignment: Text.AlignHCenter
2784+ opacity: tip.hidden ? 0.0 : 1.0
2785+ Behavior on opacity {
2786+ UbuntuNumberAnimation {
2787+ duration: UbuntuAnimation.SnapDuration
2788+ }
2789+ }
2790+ }
2791+ }
2792+
2793+ Rectangle {
2794+ id: shadow
2795+
2796+ anchors {
2797+ left: parent.left
2798+ right: parent.right
2799+ bottom: parent.bottom
2800+ }
2801+ height: units.gu(1)
2802+ z: 1
2803+ opacity: 0.0
2804+ gradient: Gradient {
2805+ GradientStop { position: 0.0; color: "transparent" }
2806+ GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.2) }
2807+ }
2808+ }
2809+
2810+ MouseArea {
2811+ id: mouseArea
2812+
2813+ property real previousY: -1
2814+ property string dragDirection: "None"
2815+
2816+ preventStealing: true
2817+ drag {
2818+ axis: Drag.YAxis
2819+ target: bottomEdge
2820+ minimumY: bottomEdge.pageStartY
2821+ maximumY: page.height
2822+ }
2823+ enabled: edgeLoader.status == Loader.Ready
2824+ visible: page.bottomEdgeEnabled
2825+
2826+ anchors {
2827+ left: parent.left
2828+ right: parent.right
2829+ bottom: parent.bottom
2830+
2831+ }
2832+ height: bottomEdge.tipHeight
2833+ z: 1
2834+
2835+ onReleased: {
2836+ page.bottomEdgeReleased()
2837+ if ((dragDirection === "BottomToTop") &&
2838+ bottomEdge.y < (page.height - bottomEdgeExpandThreshold - bottomEdge.tipHeight)) {
2839+ bottomEdge.state = "expanded"
2840+ } else {
2841+ bottomEdge.state = "collapsed"
2842+ }
2843+ previousY = -1
2844+ dragDirection = "None"
2845+ }
2846+
2847+ onPressed: {
2848+ previousY = mouse.y
2849+ tip.forceActiveFocus()
2850+ }
2851+
2852+ onMouseYChanged: {
2853+ var yOffset = previousY - mouseY
2854+ // skip if was a small move
2855+ if (Math.abs(yOffset) <= units.gu(2)) {
2856+ return
2857+ }
2858+ previousY = mouseY
2859+ dragDirection = yOffset > 0 ? "BottomToTop" : "TopToBottom"
2860+ }
2861+ }
2862+
2863+ Rectangle {
2864+ id: bottomEdge
2865+ objectName: "bottomEdge"
2866+
2867+ readonly property int tipHeight: units.gu(3)
2868+ readonly property int pageStartY: 0
2869+
2870+ z: 1
2871+ color: Theme.palette.normal.background
2872+ clip: true
2873+ anchors {
2874+ left: parent.left
2875+ right: parent.right
2876+ }
2877+ height: page.height
2878+ y: height
2879+ visible: !page.isCollapsed
2880+ state: "collapsed"
2881+ states: [
2882+ State {
2883+ name: "collapsed"
2884+ PropertyChanges {
2885+ target: bottomEdge
2886+ y: bottomEdge.height
2887+ }
2888+ },
2889+ State {
2890+ name: "expanded"
2891+ PropertyChanges {
2892+ target: bottomEdge
2893+ y: bottomEdge.pageStartY
2894+ }
2895+ },
2896+ State {
2897+ name: "floating"
2898+ when: mouseArea.drag.active
2899+ PropertyChanges {
2900+ target: shadow
2901+ opacity: 1.0
2902+ }
2903+ }
2904+ ]
2905+
2906+ transitions: [
2907+ Transition {
2908+ to: "expanded"
2909+ SequentialAnimation {
2910+ alwaysRunToEnd: true
2911+
2912+ SmoothedAnimation {
2913+ target: bottomEdge
2914+ property: "y"
2915+ duration: UbuntuAnimation.FastDuration
2916+ easing.type: Easing.Linear
2917+ }
2918+ SmoothedAnimation {
2919+ target: edgeLoader
2920+ property: "anchors.topMargin"
2921+ to: - units.gu(4)
2922+ duration: UbuntuAnimation.FastDuration
2923+ easing.type: Easing.Linear
2924+ }
2925+ SmoothedAnimation {
2926+ target: edgeLoader
2927+ property: "anchors.topMargin"
2928+ to: 0
2929+ duration: UbuntuAnimation.FastDuration
2930+ easing: UbuntuAnimation.StandardEasing
2931+ }
2932+ ScriptAction {
2933+ script: page._pushPage()
2934+ }
2935+ }
2936+ },
2937+ Transition {
2938+ from: "expanded"
2939+ to: "collapsed"
2940+ SequentialAnimation {
2941+ alwaysRunToEnd: true
2942+
2943+ ScriptAction {
2944+ script: {
2945+ Qt.inputMethod.hide()
2946+ edgeLoader.item.parent = edgeLoader
2947+ edgeLoader.item.anchors.fill = edgeLoader
2948+ edgeLoader.item.active = false
2949+ }
2950+ }
2951+ SmoothedAnimation {
2952+ target: bottomEdge
2953+ property: "y"
2954+ duration: UbuntuAnimation.SlowDuration
2955+ }
2956+ ScriptAction {
2957+ script: {
2958+ // destroy current bottom page
2959+ if (page.reloadBottomEdgePage) {
2960+ edgeLoader.active = false
2961+ // tip will receive focus on page active true
2962+ } else {
2963+ tip.forceActiveFocus()
2964+ }
2965+
2966+ // notify
2967+ page.bottomEdgeDismissed()
2968+
2969+ edgeLoader.active = true
2970+ }
2971+ }
2972+ }
2973+ },
2974+ Transition {
2975+ from: "floating"
2976+ to: "collapsed"
2977+ SmoothedAnimation {
2978+ target: bottomEdge
2979+ property: "y"
2980+ duration: UbuntuAnimation.FastDuration
2981+ }
2982+ }
2983+ ]
2984+
2985+ Loader {
2986+ id: edgeLoader
2987+
2988+ asynchronous: true
2989+ anchors.fill: parent
2990+ //WORKAROUND: The SDK move the page contents down to allocate space for the header we need to avoid that during the page dragging
2991+ Binding {
2992+ target: edgeLoader.status === Loader.Ready ? edgeLoader : null
2993+ property: "anchors.topMargin"
2994+ value: edgeLoader.item && edgeLoader.item.flickable ? edgeLoader.item.flickable.contentY : 0
2995+ when: !page.isReady
2996+ }
2997+
2998+ onLoaded: {
2999+ tip.forceActiveFocus()
3000+ if (page.isReady && edgeLoader.item.active !== true) {
3001+ page._pushPage()
3002+ }
3003+ }
3004+ }
3005+ }
3006+}
3007
3008=== added file 'app/components/WeatherListItem.qml'
3009--- app/components/WeatherListItem.qml 1970-01-01 00:00:00 +0000
3010+++ app/components/WeatherListItem.qml 2015-03-19 04:32:18 +0000
3011@@ -0,0 +1,139 @@
3012+/*
3013+ * Copyright (C) 2013, 2014, 2015
3014+ * Andrew Hayzen <ahayzen@gmail.com>
3015+ * Nekhelesh Ramananthan <krnekhelesh@gmail.com>
3016+ * Victor Thompson <victor.thompson@gmail.com>
3017+ *
3018+ * This program is free software; you can redistribute it and/or modify
3019+ * it under the terms of the GNU General Public License as published by
3020+ * the Free Software Foundation; version 3.
3021+ *
3022+ * This program is distributed in the hope that it will be useful,
3023+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3024+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3025+ * GNU General Public License for more details.
3026+ *
3027+ * You should have received a copy of the GNU General Public License
3028+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3029+ */
3030+
3031+import QtQuick 2.3
3032+import Ubuntu.Components 1.1
3033+import Ubuntu.Components.ListItems 0.1 as ListItem
3034+
3035+
3036+ListItemWithActions {
3037+ id: root
3038+
3039+ property int listItemIndex: index
3040+ property bool multiselectable: false
3041+ property int previousListItemIndex: -1
3042+ property bool reorderable: false
3043+
3044+ signal reorder(int from, int to)
3045+
3046+ onItemPressAndHold: {
3047+ if (multiselectable) {
3048+ selectionMode = true
3049+ }
3050+ }
3051+
3052+ onListItemIndexChanged: {
3053+ var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex)
3054+
3055+ if (i !== -1) {
3056+ parent.parent.selectedItems[i] = listItemIndex
3057+ }
3058+
3059+ previousListItemIndex = listItemIndex
3060+ }
3061+
3062+ onSelectedChanged: {
3063+ if (selectionMode) {
3064+ var tmp = parent.parent.selectedItems
3065+
3066+ if (selected) {
3067+ if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) {
3068+ tmp.push(listItemIndex)
3069+ parent.parent.selectedItems = tmp
3070+ }
3071+ } else {
3072+ tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1)
3073+ parent.parent.selectedItems = tmp
3074+ }
3075+ }
3076+ }
3077+
3078+ onSelectionModeChanged: {
3079+ if (reorderable && selectionMode) {
3080+ resetSwipe()
3081+ }
3082+
3083+ for (var j=0; j < _main.children.length; j++) {
3084+ if (_main.children[j] !== actionReorderLoader) {
3085+ _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
3086+ }
3087+ }
3088+
3089+ parent.parent.state = selectionMode ? "multiselectable" : "normal"
3090+
3091+ if (!selectionMode) {
3092+ selected = false
3093+ }
3094+ }
3095+
3096+ /* Highlight the listitem on press */
3097+ Rectangle {
3098+ id: listItemBrighten
3099+ color: root.pressed ? UbuntuColors.coolGrey : "transparent"
3100+ opacity: 0.1
3101+ height: root.height
3102+ x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions
3103+ width: root.width
3104+ }
3105+
3106+ /* Reorder Component */
3107+ Loader {
3108+ id: actionReorderLoader
3109+ active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
3110+ anchors {
3111+ bottom: parent.bottom
3112+ right: parent.right
3113+ rightMargin: units.gu(1)
3114+ top: parent.top
3115+ }
3116+ asynchronous: true
3117+ source: "ListItemReorderComponent.qml"
3118+ }
3119+
3120+ Item {
3121+ Connections { // Only allow one ListItem to be swiping at any time
3122+ target: weatherApp
3123+ onListItemSwiping: {
3124+ if (i !== index) {
3125+ root.resetSwipe();
3126+ }
3127+ }
3128+ }
3129+
3130+ Connections { // Connections from signals in the ListView
3131+ target: root.parent.parent
3132+ onClearSelection: selected = false
3133+ onFlickingChanged: {
3134+ if (root.parent.parent.flicking) {
3135+ root.resetSwipe()
3136+ }
3137+ }
3138+ onSelectAll: selected = true
3139+ onStateChanged: selectionMode = root.parent.parent.state === "multiselectable"
3140+ }
3141+ }
3142+
3143+ Component.onCompleted: { // reload settings as delegates are destroyed
3144+ if (parent.parent.selectedItems.indexOf(index) !== -1) {
3145+ selected = true
3146+ }
3147+
3148+ selectionMode = root.parent.parent.state === "multiselectable"
3149+ }
3150+}
3151
3152=== added file 'app/components/WeatherListView.qml'
3153--- app/components/WeatherListView.qml 1970-01-01 00:00:00 +0000
3154+++ app/components/WeatherListView.qml 2015-03-19 04:32:18 +0000
3155@@ -0,0 +1,32 @@
3156+/*
3157+ * Copyright (C) 2013, 2014, 2015
3158+ * Andrew Hayzen <ahayzen@gmail.com>
3159+ * Daniel Holm <d.holmen@gmail.com>
3160+ * Victor Thompson <victor.thompson@gmail.com>
3161+ *
3162+ * This program is free software; you can redistribute it and/or modify
3163+ * it under the terms of the GNU General Public License as published by
3164+ * the Free Software Foundation; version 3.
3165+ *
3166+ * This program is distributed in the hope that it will be useful,
3167+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3168+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3169+ * GNU General Public License for more details.
3170+ *
3171+ * You should have received a copy of the GNU General Public License
3172+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3173+ */
3174+
3175+import QtQuick 2.3
3176+import Ubuntu.Components 1.1
3177+
3178+
3179+ListView {
3180+ Component.onCompleted: {
3181+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
3182+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
3183+ var scaleFactor = units.gridUnit / 8;
3184+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
3185+ flickDeceleration = flickDeceleration * scaleFactor;
3186+ }
3187+}
3188
3189=== added directory 'app/data'
3190=== added file 'app/data/CMakeLists.txt'
3191--- app/data/CMakeLists.txt 1970-01-01 00:00:00 +0000
3192+++ app/data/CMakeLists.txt 2015-03-19 04:32:18 +0000
3193@@ -0,0 +1,5 @@
3194+file(GLOB DATA_QML_JS_FILES *.qml *.js)
3195+
3196+add_custom_target(ubuntu-weather-app_data_QMlFiles ALL SOURCES ${DATA_QML_JS_FILES})
3197+
3198+install(FILES ${DATA_QML_JS_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/data)
3199
3200=== added file 'app/data/CitiesList.js'
3201--- app/data/CitiesList.js 1970-01-01 00:00:00 +0000
3202+++ app/data/CitiesList.js 2015-03-19 04:32:18 +0000
3203@@ -0,0 +1,65 @@
3204+.pragma library
3205+/*
3206+ * Copyright (C) 2013 Canonical Ltd
3207+ *
3208+ * This program is free software: you can redistribute it and/or modify
3209+ * it under the terms of the GNU General Public License version 3 as
3210+ * published by the Free Software Foundation.
3211+ *
3212+ * This program is distributed in the hope that it will be useful,
3213+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3214+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3215+ * GNU General Public License for more details.
3216+ *
3217+ * You should have received a copy of the GNU General Public License
3218+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3219+ *
3220+ * Authored by: Martin Borho <martin@borho.net>
3221+ */
3222+
3223+var preList = [
3224+ {"coord":{"lon":"4.88969","lat":"52.37403"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Amsterdam"},"population":741636,"adminName2":"Gemeente Amsterdam","name":"Amsterdam","country":"NL","countryName":"Netherlands","adminName1":"North Holland","adminName3":"","services":{"geonames":2759794},"areaLabel":"North Holland, Netherlands"},
3225+ {"coord":{"lon":"116.39723","lat":"39.9075"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Shanghai"},"population":7480601,"adminName2":"","name":"Beijing","country":"CN","countryName":"China","adminName1":"Beijing","adminName3":"","services":{"geonames":1816670},"areaLabel":"Beijing, China"},
3226+ {"coord":{"lon":"-74.08175","lat":"4.60971"},"timezone":{"gmtOffset":-5,"dstOffset":-5,"timeZoneId":"America/Bogota"},"population":7674366,"adminName2":"","name":"Bogotá","country":"CO","countryName":"Colombia","adminName1":"Bogota D.C.","adminName3":"","services":{"geonames":3688689},"areaLabel":"Bogota D.C., Colombia"},
3227+ {"coord":{"lon":"-58.37723","lat":"-34.61315"},"timezone":{"gmtOffset":-3,"dstOffset":-3,"timeZoneId":"America/Argentina/Buenos_Aires"},"population":13076300,"adminName2":"","name":"Buenos Aires","country":"AR","countryName":"Argentina","adminName1":"Buenos Aires F.D.","adminName3":"","services":{"geonames":3435910},"areaLabel":"Buenos Aires F.D., Argentina"},
3228+ {"coord":{"lon":"31.24967","lat":"30.06263"},"timezone":{"gmtOffset":2,"dstOffset":2,"timeZoneId":"Africa/Cairo"},"population":7734614,"adminName2":"","name":"Cairo","country":"EG","countryName":"Egypt","adminName1":"Al Qāhirah","adminName3":"","services":{"geonames":360630},"areaLabel":"Al Qāhirah, Egypt"},
3229+ {"coord":{"lon":"-66.87919","lat":"10.48801"},"timezone":{"gmtOffset":-4.5,"dstOffset":-4.5,"timeZoneId":"America/Caracas"},"population":3000000,"adminName2":"Municipio Libertador","name":"Caracas","country":"VE","countryName":"Venezuela","adminName1":"Distrito Federal","adminName3":"","services":{"geonames":3646738},"areaLabel":"Distrito Federal, Venezuela, Bolivarian Republic of"},
3230+ {"coord":{"lon":"-87.65005","lat":"41.85003"},"timezone":{"gmtOffset":-6,"dstOffset":-5,"timeZoneId":"America/Chicago"},"population":2695598,"adminName2":"Cook County","name":"Chicago","country":"US","countryName":"United States","adminName1":"Illinois","adminName3":"","services":{"geonames":4887398},"areaLabel":"Illinois, United States"},
3231+ {"coord":{"lon":"77.22897","lat":"28.65381"},"timezone":{"gmtOffset":5.5,"dstOffset":5.5,"timeZoneId":"Asia/Kolkata"},"population":10927986,"adminName2":"","name":"Dehli","country":"IN","countryName":"India","adminName1":"NCT","adminName3":"","services":{"geonames":1273294},"areaLabel":"NCT, India"},
3232+ {"coord":{"lon":"55.30472","lat":"25.25817"},"timezone":{"gmtOffset":4,"dstOffset":4,"timeZoneId":"Asia/Dubai"},"population":1137347,"adminName2":"","name":"Dubai","country":"AE","countryName":"United Arab Emirates","adminName1":"Dubai","adminName3":"","services":{"geonames":292223},"areaLabel":"Dubai, United Arab Emirates"},
3233+ {"coord":{"lon":"113.25","lat":"23.11667"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Shanghai"},"population":3152825,"adminName2":"","name":"Guangzhou","country":"CN","countryName":"China","adminName1":"Guangdong Province","adminName3":"","services":{"geonames":1809858},"areaLabel":"Guangdong Province, China"},
3234+ {"coord":{"lon":"10.01534","lat":"53.57532"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Berlin"},"population":1739117,"adminName2":"","name":"Hamburg","country":"DE","countryName":"Germany","adminName1":"Hamburg","adminName3":"","services":{"geonames":2911298},"areaLabel":"Hamburg, Germany"},
3235+ {"coord":{"lon":"-95.36327","lat":"29.76328"},"timezone":{"gmtOffset":-6,"dstOffset":-5,"timeZoneId":"America/Chicago"},"population":2099451,"adminName2":"Harris County","name":"Houston","country":"US","countryName":"United States","adminName1":"Texas","adminName3":"","services":{"geonames":4699066},"areaLabel":"Texas, United States"},
3236+ {"coord":{"lon":"28.94966","lat":"41.01384"},"timezone":{"gmtOffset":2,"dstOffset":3,"timeZoneId":"Europe/Istanbul"},"population":11174257,"adminName2":"","name":"Istanbul","country":"TR","countryName":"Turkey","adminName1":"Istanbul","adminName3":"","services":{"geonames":745044},"areaLabel":"Istanbul, Turkey"},
3237+ {"coord":{"lon":"106.84513","lat":"-6.21462"},"timezone":{"gmtOffset":7,"dstOffset":7,"timeZoneId":"Asia/Jakarta"},"population":8540121,"adminName2":"","name":"Jakarta","country":"ID","countryName":"Indonesia","adminName1":"Jakarta Raya","adminName3":"","services":{"geonames":1642911},"areaLabel":"Jakarta Raya, Indonesia"},
3238+ {"coord":{"lon":"28.04363","lat":"-26.20227"},"timezone":{"gmtOffset":2,"dstOffset":2,"timeZoneId":"Africa/Johannesburg"},"population":2026469,"adminName2":"City of Johannesburg Metropolitan Municipality","name":"Johannesburg","country":"ZA","countryName":"South Africa","adminName1":"Gauteng","adminName3":"City of Johannesburg","services":{"geonames":993800},"areaLabel":"Gauteng, South Africa"},
3239+ {"coord":{"lon":"67.0822","lat":"24.9056"},"timezone":{"gmtOffset":5,"dstOffset":5,"timeZoneId":"Asia/Karachi"},"population":11624219,"adminName2":"Karāchi District","name":"Karachi","country":"PK","countryName":"Pakistan","adminName1":"Sindh","adminName3":"","services":{"geonames":1174872},"areaLabel":"Sindh, Pakistan"},
3240+ {"coord":{"lon":"15.30807","lat":"-4.32142"},"timezone":{"gmtOffset":1,"dstOffset":1,"timeZoneId":"Africa/Kinshasa"},"population":7785965,"adminName2":"","name":"Kinshasa","country":"CD","countryName":"Democratic Republic of the Congo","adminName1":"Kinshasa","adminName3":"","services":{"geonames":2314302},"areaLabel":"Kinshasa, Congo, the Democratic Republic of the"},
3241+ {"coord":{"lon":"88.36304","lat":"22.56263"},"timezone":{"gmtOffset":5.5,"dstOffset":5.5,"timeZoneId":"Asia/Kolkata"},"population":4631392,"adminName2":"","name":"Kolkata","country":"IN","countryName":"India","adminName1":"Bengal","adminName3":"","services":{"geonames":1275004},"areaLabel":"Bengal, India"},
3242+ {"coord":{"lon":"3.39583","lat":"6.45306"},"timezone":{"gmtOffset":1,"dstOffset":1,"timeZoneId":"Africa/Lagos"},"population":9000000,"adminName2":"","name":"Lagos","country":"NG","countryName":"Nigeria","adminName1":"Lagos","adminName3":"","services":{"geonames":2332459},"areaLabel":"Lagos, Nigeria"},
3243+ {"coord":{"lon":"-77.02824","lat":"-12.04318"},"timezone":{"gmtOffset":-5,"dstOffset":-5,"timeZoneId":"America/Lima"},"population":7737002,"adminName2":"","name":"Lima","country":"PE","countryName":"Peru","adminName1":"Provincia de Lima","adminName3":"","services":{"geonames":3936456},"areaLabel":"Provincia de Lima, Peru"},
3244+ {"coord":{"lon":"-0.12574","lat":"51.50853"},"timezone":{"gmtOffset":0,"dstOffset":1,"timeZoneId":"Europe/London"},"population":7556900,"adminName2":"Greater London","name":"London","country":"GB","countryName":"United Kingdom","adminName1":"England","adminName3":"","services":{"geonames":2643743},"areaLabel":"England, Greater London, United Kingdom"},
3245+ {"coord":{"lon":"-118.24368","lat":"34.05223"},"timezone":{"gmtOffset":-8,"dstOffset":-7,"timeZoneId":"America/Los_Angeles"},"population":3792621,"adminName2":"Los Angeles County","name":"Los Angeles","country":"US","countryName":"United States","adminName1":"California","adminName3":"","services":{"geonames":5368361},"areaLabel":"California, United States"},
3246+ {"coord":{"lon":"-3.70256","lat":"40.4165"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Madrid"},"population":3255944,"adminName2":"Madrid","name":"Madrid","country":"ES","countryName":"Spain","adminName1":"Madrid","adminName3":"Madrid","services":{"geonames":3117735},"areaLabel":"Madrid, Spain"},
3247+ {"coord":{"lon":"120.9822","lat":"14.6042"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Manila"},"population":10444527,"adminName2":"PH.NCR.D9","name":"Manila","country":"PH","countryName":"Philippines","adminName1":"National Capital Region","adminName3":"","services":{"geonames":1701668},"areaLabel":"National Capital, Philippines"},
3248+ {"coord":{"lon":"-73.58781","lat":"45.50884"},"timezone":{"gmtOffset":-5,"dstOffset":-4,"timeZoneId":"America/Montreal"},"population":3268513,"adminName2":"Montréal","name":"Montreal","country":"CA","countryName":"Canada","adminName1":"Quebec","adminName3":"","services":{"geonames":6077243},"areaLabel":"Quebec, Canada"},
3249+ {"coord":{"lon":"-99.12766","lat":"19.42847"},"timezone":{"gmtOffset":-6,"dstOffset":-5,"timeZoneId":"America/Mexico_City"},"population":12294193,"adminName2":"","name":"Mexico City","country":"MX","countryName":"Mexico","adminName1":"The Federal District","adminName3":"","services":{"geonames":3530597},"areaLabel":"The Federal District, Mexico"},
3250+ {"coord":{"lon":"37.61556","lat":"55.75222"},"timezone":{"gmtOffset":4,"dstOffset":4,"timeZoneId":"Europe/Moscow"},"population":10381222,"adminName2":"","name":"Moscow","country":"RU","countryName":"Russia","adminName1":"Moscow","adminName3":"","services":{"geonames":524901},"areaLabel":"Moscow, Russian Federation"},
3251+ {"coord":{"lon":"72.88261","lat":"19.07283"},"timezone":{"gmtOffset":5.5,"dstOffset":5.5,"timeZoneId":"Asia/Kolkata"},"population":12691836,"adminName2":"Konkan Division","name":"Mumbai","country":"IN","countryName":"India","adminName1":"Mahārāshtra","adminName3":"","services":{"geonames":1275339},"areaLabel":"Mahārāshtra, India"},
3252+ {"coord":{"lon":"36.81667","lat":"-1.28333"},"timezone":{"gmtOffset":3,"dstOffset":3,"timeZoneId":"Africa/Nairobi"},"population":2750547,"adminName2":"","name":"Nairobi","country":"KE","countryName":"Kenya","adminName1":"Nairobi Area","adminName3":"","services":{"geonames":184745},"areaLabel":"Nairobi Area, Kenya"},
3253+ {"coord":{"lon":"-74.00597","lat":"40.71427"},"timezone":{"gmtOffset":-5,"dstOffset":-4,"timeZoneId":"America/New_York"},"population":8175133,"adminName2":"","name":"New York City","country":"US","countryName":"United States","adminName1":"New York","adminName3":"","services":{"geonames":5128581},"areaLabel":"New York, United States"},
3254+ {"coord":{"lon":"135.50218","lat":"34.69374"},"timezone":{"gmtOffset":9,"dstOffset":9,"timeZoneId":"Asia/Tokyo"},"population":2592413,"adminName2":"","name":"Osaka","country":"JP","countryName":"Japan","adminName1":"Ōsaka","adminName3":"","services":{"geonames":1853909},"areaLabel":"Ōsaka, Japan"},
3255+ {"coord":{"lon":"-43.2075","lat":"-22.90278"},"timezone":{"gmtOffset":-2,"dstOffset":-3,"timeZoneId":"America/Sao_Paulo"},"population":6023699,"adminName2":"Rio de Janeiro","name":"Rio de Janeiro","country":"BR","countryName":"Brazil","adminName1":"Rio de Janeiro","adminName3":"","services":{"geonames":3451190},"areaLabel":"Rio de Janeiro, Brazil"},
3256+ {"coord":{"lon":"12.4839","lat":"41.89474"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Rome"},"population":2563241,"adminName2":"Rome","name":"Rome","country":"IT","countryName":"Italy","adminName1":"Latium","adminName3":"Rome","services":{"geonames":3169070},"areaLabel":"Latium, Italy"},
3257+ {"coord":{"lon":"126.97783","lat":"37.56826"},"timezone":{"gmtOffset":9,"dstOffset":9,"timeZoneId":"Asia/Seoul"},"population":10349312,"adminName2":"","name":"Seoul","country":"KR","countryName":"South Korea","adminName1":"Seoul","adminName3":"","services":{"geonames":1835848},"areaLabel":"Seoul, Korea, Republic of"},
3258+ {"coord":{"lon":"-122.41942","lat":"37.77493"},"timezone":{"gmtOffset":-8,"dstOffset":-7,"timeZoneId":"America/Los_Angeles"},"population":805235,"adminName2":"San Francisco County","name":"San Francisco","country":"US","countryName":"United States","adminName1":"California","adminName3":"","services":{"geonames":5391959},"areaLabel":"California, United States"},
3259+ {"coord":{"lon":"-46.63611","lat":"-23.5475"},"timezone":{"gmtOffset":-2,"dstOffset":-3,"timeZoneId":"America/Sao_Paulo"},"population":10021295,"adminName2":"São Paulo","name":"São Paulo","country":"BR","countryName":"Brazil","adminName1":"São Paulo","adminName3":"","services":{"geonames":3448439},"areaLabel":"São Paulo, Brazil"},
3260+ {"coord":{"lon":"121.45806","lat":"31.22222"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Shanghai"},"population":14608512,"adminName2":"","name":"Shanghai","country":"CN","countryName":"China","adminName1":"Shanghai Shi","adminName3":"","services":{"geonames":1796236},"areaLabel":"Shanghai Shi, China"},
3261+ {"coord":{"lon":"114.0683","lat":"22.54554"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Shanghai"},"population":3000000,"adminName2":"Shenzhen","name":"Shenzhen","country":"CN","countryName":"China","adminName1":"Guangdong Province","adminName3":"","services":{"geonames":1795565},"areaLabel":"Guangdong Province, Shenzhen, China"},
3262+ {"coord":{"lon":"103.85007","lat":"1.28967"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Singapore"},"population":3547809,"adminName2":"","name":"Singapore","country":"SG","countryName":"Singapore","adminName1":"","adminName3":"","services":{"geonames":1880252},"areaLabel":"Singapore"},
3263+ {"coord":{"lon":"151.20732","lat":"-33.86785"},"timezone":{"gmtOffset":11,"dstOffset":10,"timeZoneId":"Australia/Sydney"},"population":4627345,"adminName2":"City of Sydney","name":"Sydney","country":"AU","countryName":"Australia","adminName1":"New South Wales","adminName3":"","services":{"geonames":2147714},"areaLabel":"New South Wales, Australia"},
3264+ {"coord":{"lon":"51.42151","lat":"35.69439"},"timezone":{"gmtOffset":3.5,"dstOffset":4.5,"timeZoneId":"Asia/Tehran"},"population":7153309,"adminName2":"","name":"Tehran","country":"IR","countryName":"Iran","adminName1":"Tehrān","adminName3":"","services":{"geonames":112931},"areaLabel":"Tehrān, Iran, Islamic Republic of"},
3265+ {"coord":{"lon":"117.17667","lat":"39.14222"},"timezone":{"gmtOffset":8,"dstOffset":8,"timeZoneId":"Asia/Shanghai"},"population":3766207,"adminName2":"","name":"Tianjin","country":"CN","countryName":"China","adminName1":"Tianjin Shi","adminName3":"","services":{"geonames":1792947},"areaLabel":"Tianjin Shi, China"},
3266+ {"coord":{"lon":"139.69171","lat":"35.6895"},"timezone":{"gmtOffset":9,"dstOffset":9,"timeZoneId":"Asia/Tokyo"},"population":8336599,"adminName2":"","name":"Tokyo","country":"JP","countryName":"Japan","adminName1":"Tōkyō","adminName3":"","services":{"geonames":1850147},"areaLabel":"Tōkyō, Japan"},
3267+ {"coord":{"lon":"-79.4163","lat":"43.70011"},"timezone":{"gmtOffset":-5,"dstOffset":-4,"timeZoneId":"America/Toronto"},"population":4612191,"adminName2":"","name":"Toronto","country":"CA","countryName":"Canada","adminName1":"Ontario","adminName3":"","services":{"geonames":6167865},"areaLabel":"Ontario, Canada"}
3268+]
3269
3270=== added file 'app/data/Storage.qml'
3271--- app/data/Storage.qml 1970-01-01 00:00:00 +0000
3272+++ app/data/Storage.qml 2015-03-19 04:32:18 +0000
3273@@ -0,0 +1,189 @@
3274+/*
3275+ * Copyright (C) 2013, 2014, 2015 Canonical Ltd
3276+ *
3277+ * This program is free software: you can redistribute it and/or modify
3278+ * it under the terms of the GNU General Public License version 3 as
3279+ * published by the Free Software Foundation.
3280+ *
3281+ * This program is distributed in the hope that it will be useful,
3282+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3283+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3284+ * GNU General Public License for more details.
3285+ *
3286+ * You should have received a copy of the GNU General Public License
3287+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3288+ *
3289+ * Authored by: Martin Borho <martin@borho.net>
3290+ */
3291+import QtQuick.LocalStorage 2.0
3292+import QtQuick 2.3
3293+
3294+Item {
3295+ property var db: null
3296+
3297+ function openDB() {
3298+ if(db !== null) return;
3299+
3300+ db = LocalStorage.openDatabaseSync("com.ubuntu.weather", "", "Default Ubuntu weather app", 100000);
3301+
3302+ if (db.version === "") {
3303+ db.changeVersion("", "0.1",
3304+ function(tx) {
3305+ tx.executeSql('CREATE TABLE IF NOT EXISTS Locations(id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT, date TEXT)');
3306+ console.log('Database created');
3307+ });
3308+ // reopen database with new version number
3309+ db = LocalStorage.openDatabaseSync("com.ubuntu.weather", "", "Default Ubuntu weather app", 100000);
3310+ }
3311+
3312+ if(db.version === "0.1") {
3313+ db.changeVersion("0.1", "0.2",
3314+ function(tx) {
3315+ tx.executeSql('CREATE TABLE IF NOT EXISTS settings(key TEXT UNIQUE, value TEXT)');
3316+ console.log('Settings table added, Database upgraded to v0.2');
3317+ });
3318+ // reopen database with new version number
3319+ db = LocalStorage.openDatabaseSync("com.ubuntu.weather", "", "Default Ubuntu weather app", 100000);
3320+ }
3321+
3322+ if(db.version === "0.2") {
3323+ db.changeVersion("0.2", "0.3",
3324+ function(tx) {
3325+ tx.executeSql('DELETE FROM Locations WHERE 1');
3326+ console.log('Removed old locations, Database upgraded to v0.3');
3327+ });
3328+ }
3329+
3330+ if (!settings.migrated) {
3331+ try { // attempt to read the old settings
3332+ var oldSettings = {};
3333+
3334+ // Load old settings
3335+ db.readTransaction( function(tx) {
3336+ var rs = tx.executeSql("SELECT * FROM settings")
3337+
3338+ for(var i = 0; i < rs.rows.length; i++) {
3339+ var row = rs.rows.item(i);
3340+ oldSettings[row.key] = row.value;
3341+ }
3342+ });
3343+
3344+ console.debug("Migrating old data:", JSON.stringify(oldSettings))
3345+
3346+ // Move to new Settings API
3347+ settings.migrated = true
3348+ settings.precipUnits = oldSettings["precip_units"]
3349+ settings.service = oldSettings["service"]
3350+ settings.tempScale = "°" + (oldSettings["units"] === "metric" ? "C" : "F")
3351+ settings.units = oldSettings["units"]
3352+ settings.windUnits = oldSettings["wind_units"]
3353+
3354+ /*
3355+ TODO: uncomment when reboot is ready to replace existing app
3356+ db.transaction( function(tx) {
3357+ tx.executeSql("DROP TABLE IF EXISTS settings")
3358+ });
3359+ */
3360+ } catch (e) { // likely table did not exist
3361+ console.debug("No old data to migrate.")
3362+ settings.migrated = true
3363+ }
3364+ }
3365+ }
3366+
3367+ function insertLocation(data) {
3368+ openDB();
3369+ var res;
3370+
3371+ db.transaction( function(tx){
3372+ var r = tx.executeSql('INSERT INTO Locations(data, date) VALUES(?, ?)', [JSON.stringify(data), new Date().getTime()]);
3373+ res = r.insertId;
3374+ });
3375+ return res;
3376+ }
3377+
3378+ function updateLocation(dbId, data) {
3379+ openDB();
3380+ db.transaction( function(tx){
3381+ var r = tx.executeSql('UPDATE Locations SET data = ?, date=? WHERE id = ?', [JSON.stringify(data), new Date().getTime(), dbId])
3382+ });
3383+ }
3384+
3385+ function getLocations(callback) {
3386+ openDB();
3387+ db.readTransaction(
3388+ function(tx){
3389+ var locations = [];
3390+ var rs = tx.executeSql('SELECT * FROM Locations');
3391+ for(var i = 0; i < rs.rows.length; i++) {
3392+ var row = rs.rows.item(i),
3393+ locData = JSON.parse(row.data);
3394+ locData["updated"] = parseInt(row.date, 10);
3395+ locData["db"] = {id: row.id, updated: new Date(parseInt(row.date, 10))};
3396+ locations.push(locData);
3397+ }
3398+ callback(locations);
3399+ }
3400+ );
3401+ }
3402+
3403+ function clearLocation(location_id) {
3404+ openDB();
3405+ db.transaction(function(tx){
3406+ tx.executeSql('DELETE FROM Locations WHERE id = ?', [location_id]);
3407+ });
3408+ }
3409+
3410+ function clearMultiLocation(locations) {
3411+ openDB();
3412+
3413+ db.transaction(function (tx) {
3414+ // Remove all the deleted indexes
3415+ for (var i=0; i < locations.length; i++) {
3416+ tx.executeSql('DELETE FROM Locations WHERE id=?;', [locations[i]])
3417+ }
3418+
3419+ // Rebuild locations in order
3420+ var rs = tx.executeSql('SELECT id FROM Locations ORDER BY id ASC')
3421+
3422+ for (i=0; i < rs.rows.length; i++) {
3423+ tx.executeSql('UPDATE Locations SET id=? WHERE id=?;',
3424+ [i, rs.rows.item(i).id])
3425+ }
3426+ })
3427+ }
3428+
3429+ function clearDB() { // for dev purposes
3430+ openDB();
3431+ db.transaction(function(tx){
3432+ tx.executeSql('DELETE FROM Locations WHERE 1');
3433+ });
3434+ }
3435+
3436+ function reorder(from, to) {
3437+ openDB();
3438+
3439+ db.transaction(function(tx) {
3440+ // Track to move put as -1 for now
3441+ tx.executeSql('UPDATE Locations SET id=? WHERE id=?;',
3442+ [-1, from])
3443+
3444+ // Shuffle locations inbetween from->to
3445+ if (from > to) {
3446+ for (var i = from-1; i >= to; i--) {
3447+ tx.executeSql('UPDATE Locations SET id=? WHERE id=?;',
3448+ [i+1, i])
3449+ }
3450+ } else {
3451+ for (var j = from+1; j <= to; j++) {
3452+ tx.executeSql('UPDATE Locations SET id=? WHERE id=?;',
3453+ [j-1, j])
3454+ }
3455+ }
3456+
3457+ // Switch moving location to its new position
3458+ tx.executeSql('UPDATE Locations SET id=? WHERE id=?;',
3459+ [to, -1])
3460+ })
3461+ }
3462+}
3463
3464=== added file 'app/data/WeatherApi.js'
3465--- app/data/WeatherApi.js 1970-01-01 00:00:00 +0000
3466+++ app/data/WeatherApi.js 2015-03-19 04:32:18 +0000
3467@@ -0,0 +1,744 @@
3468+.pragma library
3469+/*
3470+ * Copyright (C) 2013 Canonical Ltd
3471+ *
3472+ * This program is free software: you can redistribute it and/or modify
3473+ * it under the terms of the GNU General Public License version 3 as
3474+ * published by the Free Software Foundation.
3475+ *
3476+ * This program is distributed in the hope that it will be useful,
3477+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3478+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3479+ * GNU General Public License for more details.
3480+ *
3481+ * You should have received a copy of the GNU General Public License
3482+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3483+ *
3484+ * Authored by: Raúl Yeguas <neokore@gmail.com>
3485+ * Martin Borho <martin@borho.net>
3486+ * Andrew Starr-Bochicchio <a.starr.b@gmail.com>
3487+ */
3488+
3489+/**
3490+* Version of the response data format.
3491+* Increase this number to force a refresh.
3492+*/
3493+var RESPONSE_DATA_VERSION = 20150307;
3494+
3495+/**
3496+* Helper functions
3497+*/
3498+function debug(obj) {
3499+ print(JSON.stringify(obj))
3500+}
3501+//
3502+function calcFahrenheit(celsius) {
3503+ return celsius * 1.8 + 32;
3504+}
3505+//
3506+function calcMph(ms) {
3507+ return ms*2.24;
3508+}
3509+//
3510+function calcInch(mm) {
3511+ return mm/25.4;
3512+}
3513+//
3514+function calcKmh(ms) {
3515+ return ms*3.6;
3516+}
3517+//
3518+function convertKmhToMph(kmh) {
3519+ return kmh*0.621;
3520+}
3521+//
3522+function calcWindDir(degrees) {
3523+ var direction = "?";
3524+ if(degrees >=0 && degrees <= 30){
3525+ direction = "N";
3526+ } else if(degrees >30 && degrees <= 60){
3527+ direction = "NE";
3528+ } else if(degrees >60 && degrees <= 120){
3529+ direction = "E";
3530+ } else if(degrees >120 && degrees <= 150){
3531+ direction = "SE";
3532+ } else if(degrees >150 && degrees <= 210){
3533+ direction = "S";
3534+ } else if(degrees >210 && degrees <= 240){
3535+ direction = "SW";
3536+ } else if(degrees >240 && degrees <= 300){
3537+ direction = "W";
3538+ } else if(degrees >300 && degrees <= 330){
3539+ direction = "NW";
3540+ } else if(degrees >330 && degrees <= 360){
3541+ direction = "N";
3542+ }
3543+ return direction;
3544+}
3545+
3546+//
3547+function getLocationTime(tstamp) {
3548+ var locTime = new Date(tstamp);
3549+ return {
3550+ year: locTime.getUTCFullYear(),
3551+ month: locTime.getUTCMonth(),
3552+ date: locTime.getUTCDate(),
3553+ hours: locTime.getUTCHours(),
3554+ minutes: locTime.getUTCMinutes()
3555+ }
3556+}
3557+// Serialize a JavaScript object to URL parameters
3558+// E.g. {param1: value1, param2: value2} to "param1=value&param2=value"
3559+// TODO: it'd be nice to make it work with either passing a single object
3560+// or several at once
3561+function parameterize(obj) {
3562+ var str = [];
3563+ for(var param in obj) {
3564+ str.push(encodeURIComponent(param) + "=" + encodeURIComponent(obj[param]));
3565+ }
3566+ return str.join("&");
3567+}
3568+
3569+var GeoipApi = (function() {
3570+ var _baseUrl = "http://geoip.ubuntu.com/lookup";
3571+ return {
3572+ getLatLong: function(params, apiCaller, onSuccess, onError) {
3573+ var request = { type: "geolookup",url: _baseUrl},
3574+ resultHandler = (function(request, xmlDoc) {
3575+ var coords = {},
3576+ childNodes = xmlDoc.childNodes;
3577+ for(var i=0;i<childNodes.length;i++) {
3578+ if(childNodes[i].nodeName === "Latitude") {
3579+ coords.lat = childNodes[i].firstChild.nodeValue;
3580+ } else if(childNodes[i].nodeName === "Longitude") {
3581+ coords.lon = childNodes[i].firstChild.nodeValue;
3582+ }
3583+ }
3584+ onSuccess(coords);
3585+ }),
3586+ retryHandler = (function(err) {
3587+ console.log("geolookup retry of "+err.request.url);
3588+ apiCaller(request, resultHandler, onError);
3589+ });
3590+ apiCaller(request, resultHandler, retryHandler);
3591+ }
3592+ }
3593+})();
3594+
3595+var GeonamesApi = (function() {
3596+ /**
3597+ provides neccessary methods for requesting and preparing data from Geonames.org
3598+ */
3599+ var _baseUrl = "http://api.geonames.org/";
3600+ var _username = "uweatherdev"
3601+ var _addParams = "&maxRows=25&featureClass=P"
3602+ //
3603+ function _buildSearchResult(request, data) {
3604+ var searchResult = { locations: [], request: request };
3605+ if(data.geonames) {
3606+ data.geonames.forEach(function(r) {
3607+ searchResult.locations.push({
3608+ name: r.name,
3609+ coord: {lat: r.lat, lon: r.lng},
3610+ country: r.countryCode,
3611+ countryName: r.countryName,
3612+ timezone: r.timezone,
3613+ adminName1: r.adminName1,
3614+ adminName2: r.adminName2,
3615+ adminName3: r.adminName3,
3616+ population: r.population,
3617+ services: {
3618+ "geonames": r.geonameId
3619+ }
3620+ });
3621+ })
3622+ }
3623+ return searchResult;
3624+ }
3625+ //
3626+ return {
3627+ //
3628+ search: function(mode, params, apiCaller, onSuccess, onError) {
3629+ var request,
3630+ retryHandler = (function(err) {
3631+ console.log("search retry of "+err.request.url);
3632+ apiCaller(request, searchResponseHandler, onError);
3633+ }),
3634+ searchResponseHandler = function(request, data) {
3635+ onSuccess(_buildSearchResult(request, data));
3636+ };
3637+ if(mode === "point") {
3638+ request = { type: "search",
3639+ url: _baseUrl+ "findNearbyPlaceNameJSON?style=full&username="+encodeURIComponent(_username)
3640+ +"&lat="+encodeURIComponent(params.coords.lat)+"&lng="+encodeURIComponent(params.coords.lon)
3641+ +_addParams}
3642+ } else {
3643+ request = { type: "search",
3644+ url: _baseUrl+ "searchJSON?style=full&username="+encodeURIComponent(_username)
3645+ +"&name_startsWith="+encodeURIComponent(params.name)+_addParams}
3646+ }
3647+ apiCaller(request, searchResponseHandler, retryHandler);
3648+ }
3649+ }
3650+
3651+})();
3652+
3653+var OpenWeatherMapApi = (function() {
3654+ /**
3655+ provides neccessary methods for requesting and preparing data from OpenWeatherMap.org
3656+ */
3657+ var _baseUrl = "http://api.openweathermap.org/data/2.5/";
3658+ //
3659+ var _serviceName = "openweathermap";
3660+ //
3661+ var _icon_map = {
3662+ "01d": "sun",
3663+ "01n": "moon",
3664+ "02d": "cloud_sun",
3665+ "02n": "cloud_moon",
3666+ "03d": "cloud_sun",
3667+ "03n": "cloud_moon",
3668+ "04d": "cloud",
3669+ "04n": "cloud",
3670+ "09d": "rain",
3671+ "09n": "rain",
3672+ "10d": "rain",
3673+ "10n": "rain",
3674+ "11d": "thunder",
3675+ "11n": "thunder",
3676+ "13d": "snow_shower",
3677+ "13n": "snow_shower",
3678+ "50d": "fog",
3679+ "50n": "fog"
3680+ }
3681+ //
3682+ function _buildDataPoint(date, data) {
3683+ var result = {
3684+ timestamp: data.dt,
3685+ date: date,
3686+ metric: {
3687+ temp:data.main.temp,
3688+ windSpeed: calcKmh(data.wind.speed),
3689+ rain: data.main.rain || ((data.rain) ? data.rain["3h"] : false ) || 0,
3690+ snow: data.main.snow || ((data.snow) ? data.snow["3h"] : false ) || 0
3691+ },
3692+ imperial: {
3693+ temp: calcFahrenheit(data.main.temp),
3694+ windSpeed: calcMph(data.wind.speed),
3695+ rain: calcInch(data.main.rain || ((data.rain) ? data.rain["3h"] : false ) || 0),
3696+ snow: calcInch(data.main.snow || ((data.snow) ? data.snow["3h"] : false ) ||0)
3697+ },
3698+ humidity: data.main.humidity,
3699+ pressure: data.main.pressure,
3700+ windDeg: data.wind.deg,
3701+ windDir: calcWindDir(data.wind.deg),
3702+ icon: _icon_map[data.weather[0].icon],
3703+ condition: data.weather[0].main
3704+ };
3705+ if(data.id !== undefined) {
3706+ result["service"] = _serviceName;
3707+ result["service_id"] = data.id;
3708+ }
3709+ return result;
3710+ }
3711+ //
3712+ function _buildDayFormat(date, data) {
3713+ var result = {
3714+ date: date,
3715+ timestamp: data.dt,
3716+ metric: {
3717+ tempMin: data.temp.min,
3718+ tempMax: data.temp.max,
3719+ windSpeed: calcKmh(data.speed),
3720+ rain: data.rain || 0,
3721+ snow: data.snow || 0
3722+ },
3723+ imperial: {
3724+ tempMin: calcFahrenheit(data.temp.min),
3725+ tempMax: calcFahrenheit(data.temp.max),
3726+ windSpeed: calcMph(data.speed),
3727+ rain: calcInch(data.rain || 0),
3728+ snow: calcInch(data.snow || 0)
3729+ },
3730+ pressure: data.pressure,
3731+ humidity: data.humidity,
3732+ icon: _icon_map[data.weather[0].icon],
3733+ condition: data.weather[0].main,
3734+ windDeg: data.deg,
3735+ windDir: calcWindDir(data.deg),
3736+ hourly: []
3737+ }
3738+ return result;
3739+ }
3740+ //
3741+ function formatResult(data, location) {
3742+ var tmpResult = {},
3743+ result = [],
3744+ day=null,
3745+ offset=(location.timezone && location.timezone.gmtOffset) ? location.timezone.gmtOffset*60*60*1000: 0,
3746+ localNow = getLocationTime(new Date().getTime()+offset),
3747+ todayDate;
3748+ print("["+location.name+"] "+JSON.stringify(localNow))
3749+ // add openweathermap id for faster responses
3750+ if(location.services && !location.services[_serviceName] && data["current"].id) {
3751+ location.services[_serviceName] = data["current"].id
3752+ }
3753+ //
3754+ data["daily"]["list"].forEach(function(dayData) {
3755+ var date = getLocationTime(((dayData.dt*1000)-1000)+offset), // minus 1 sec to handle +/-12 TZ
3756+ day = date.year+"-"+date.month+"-"+date.date;
3757+ if(!todayDate) {
3758+ if(localNow.year+"-"+localNow.month+"-"+localNow.date > day) {
3759+ // skip "yesterday"
3760+ return;
3761+ }
3762+ todayDate = date;
3763+ }
3764+ tmpResult[day] = _buildDayFormat(date, dayData);
3765+ })
3766+ //
3767+ var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date
3768+ tmpResult[today]["current"] = _buildDataPoint(todayDate, data["current"]);
3769+ if(data["forecast"] !== undefined) {
3770+ data["forecast"]["list"].forEach(function(hourData) {
3771+ var dateData = getLocationTime((hourData.dt*1000)+offset),
3772+ day = dateData.year+"-"+dateData.month+"-"+dateData.date;
3773+ if(tmpResult[day]) {
3774+ tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
3775+ }
3776+ })
3777+ }
3778+ //
3779+ for(var d in tmpResult) {
3780+ result.push(tmpResult[d]);
3781+ }
3782+ return result;
3783+ }
3784+ //
3785+ function _getUrls(params) {
3786+ var urls = {
3787+ current: "",
3788+ daily: "",
3789+ forecast: ""
3790+ },
3791+ latLongParams = "&lat="+encodeURIComponent(params.location.coord.lat)
3792+ + "&lon="+encodeURIComponent(params.location.coord.lon);
3793+ if(params.location.services && params.location.services[_serviceName]) {
3794+ urls.current = _baseUrl + "weather?units="+params.units+"&id="+params.location.services[_serviceName];
3795+ urls.daily = _baseUrl + "forecast/daily?id="+params.location.services[_serviceName]+"&cnt=10&units="+params.units
3796+ urls.forecast = _baseUrl + "forecast?id="+params.location.services[_serviceName]+"&units="+params.units
3797+
3798+ } else if (params.location.coord) {
3799+ urls.current = _baseUrl + "weather?units="+params.units+latLongParams;
3800+ urls.daily = _baseUrl+"forecast/daily?cnt=10&units="+params.units+latLongParams;
3801+ urls.forecast = _baseUrl+"forecast?units="+params.units+latLongParams;
3802+ }
3803+ return urls;
3804+ }
3805+ //
3806+ return {
3807+ //
3808+ getData: function(params, apiCaller, onSuccess, onError) {
3809+ var urls = _getUrls(params),
3810+ handlerMap = {
3811+ current: { type: "current",url: urls.current},
3812+ daily: { type: "daily",url: urls.daily},
3813+ forecast: { type: "forecast", url: urls.forecast}},
3814+ response = {
3815+ location: params.location,
3816+ db: (params.db) ? params.db : null,
3817+ format: RESPONSE_DATA_VERSION
3818+ },
3819+ respData = {},
3820+ addDataToResponse = (function(request, data) {
3821+ var formattedResult;
3822+ respData[request.type] = data;
3823+ if(respData["current"] !== undefined
3824+ && respData["forecast"] !== undefined
3825+ && respData["daily"] !== undefined) {
3826+ response["data"] = formatResult(respData, params.location)
3827+ onSuccess(response);
3828+ }
3829+ }),
3830+ onErrorHandler = (function(err) {
3831+ onError(err);
3832+ }),
3833+ retryHandler = (function(err) {
3834+ console.log("retry of "+err.request.url);
3835+ var retryFunc = handlerMap[err.request.type];
3836+ apiCaller(retryFunc, addDataToResponse, onErrorHandler);
3837+ });
3838+ //
3839+ apiCaller(handlerMap.current, addDataToResponse, retryHandler);
3840+ apiCaller(handlerMap.forecast, addDataToResponse, retryHandler);
3841+ apiCaller(handlerMap.daily, addDataToResponse, retryHandler);
3842+ }
3843+ }
3844+
3845+})();
3846+
3847+var WeatherChannelApi = (function() {
3848+ /**
3849+ provides neccessary methods for requesting and preparing data from OpenWeatherMap.org
3850+ */
3851+ var _baseUrl = "http://wxdata.weather.com/wxdata/";
3852+ //
3853+ var _serviceName = "weatherchannel";
3854+ //
3855+ // see http://s.imwx.com/v.20131006.223722/img/wxicon/72/([0-9]+).png
3856+ var _iconMap = {
3857+ "0": "thunder", // ??
3858+ "1": "thunder", // ??
3859+ "2": "thunder", // ??
3860+ "3": "thunder", // ??
3861+ "4": "thunder", //T-Storms
3862+ "5": "snow_rain", //Rain / Snow
3863+ "6": "snow_rain", // ??
3864+ "7": "snow_rain", //Wintry Mix
3865+ "8": "scattered", //Freezing Drizzle
3866+ "9": "scattered", //Drizzle
3867+ "10": "rain", // ??
3868+ "11": "rain", //Showers
3869+ "12": "rain", //Rain
3870+ "13": "snow_shower", // ??
3871+ "14": "snow_shower", //Snow shower/Light snow
3872+ "15": "snow_shower", //
3873+ "16": "snow_shower", //Snow
3874+ "17": "thunder", // Hail??
3875+ "18": "snow_rain", // Rain / Snow ??
3876+ "19": "fog", //Fog ??
3877+ "20": "fog", //Fog
3878+ "21": "fog", //Haze
3879+ "22": "fog", // ??
3880+ "23": "fog", // Wind ??
3881+ "24": "overcast", //Partly Cloudy / Wind
3882+ "25": "overcast", // ??
3883+ "26": "overcast",//Cloudy
3884+ "27": "cloud_moon",//Mostly Cloudy
3885+ "28": "cloud_sun", //Mostly Cloudy
3886+ "29": "cloud_moon", //Partly Cloudy
3887+ "30": "cloud_sun", //Partly Cloudy
3888+ "31": "moon", //Clear
3889+ "32": "sun", //Sunny
3890+ "33": "cloud_moon", //Mostly Clear
3891+ "34": "cloud_sun", //Mostly Sunny
3892+ "35": "snow_rain", // ??
3893+ "36": "sun", //Sunny
3894+ "37": "thunder", //Isolated T-Storms
3895+ "38": "thunder", //Scattered T-Storms
3896+ "39": "scattered", //Scattered Showers
3897+ "40": "rain", // ??
3898+ "41": "snow", //Scattered Snow Showers
3899+ "42": "snow_shower", // ??
3900+ "43": "snow_shower", // ??
3901+ "44": "fog", // ??
3902+ "45": "scattered", // ??
3903+ "46": "snow_shower", //Snow Showers Early
3904+ "47": "thunder" //Isolated T-Storms
3905+ };
3906+ //
3907+ function _buildDataPoint(date, dataObj) {
3908+ var data = dataObj["Observation"] || dataObj,
3909+ result = {
3910+ timestamp: data.date || data.dateTime,
3911+ date: date,
3912+ metric: {
3913+ temp: data.temp,
3914+ tempFeels: data.feelsLike,
3915+ windSpeed: data.wSpeed
3916+ },
3917+ imperial: {
3918+ temp: calcFahrenheit(data.temp),
3919+ tempFeels: calcFahrenheit(data.feelsLike),
3920+ windSpeed: convertKmhToMph(data.wSpeed)
3921+ },
3922+ precipType: (data.precip_type !== undefined) ? data.precip_type : null,
3923+ propPrecip: (data.pop !== undefined) ? data.pop : null,
3924+ humidity: data.humid,
3925+ pressure: data.pressure,
3926+ windDeg: data.wDir,
3927+ windDir: data.wDirText,
3928+ icon: _iconMap[(data.wxIcon||data.icon)],
3929+ condition: data.text || data.wDesc,
3930+ uv: data.uv
3931+ };
3932+ if(_iconMap[data.wxIcon||data.icon] === undefined) {
3933+ print("ICON MISSING POINT: "+(data.wxIcon||data.icon)+" "+result.condition)
3934+ }
3935+ return result;
3936+ }
3937+ //
3938+ function _buildDayFormat(date, data, now) {
3939+ var partData = (now > data.validDate || data.day === undefined) ? data.night : data.day,
3940+ result = {
3941+ date: date,
3942+ timestamp: data.validDate,
3943+ metric: {
3944+ tempMin: data.minTemp,
3945+ tempMax: data.maxTemp,
3946+ windSpeed: partData.wSpeed
3947+ },
3948+ imperial: {
3949+ tempMin: calcFahrenheit(data.minTemp),
3950+ tempMax: calcFahrenheit(data.maxTemp !== undefined ? data.maxTemp : data.minTemp),
3951+ windSpeed: convertKmhToMph(partData.wSpeed)
3952+ },
3953+ precipType: partData.precip_type,
3954+ propPrecip: partData.pop,
3955+ pressure: null,
3956+ humidity: partData.humid,
3957+ icon: _iconMap[partData.icon],
3958+ condition: partData.phrase,
3959+ windDeg: partData.wDir,
3960+ windDir: partData.wDirText,
3961+ uv: partData.uv,
3962+ hourly: []
3963+ }
3964+ if(_iconMap[partData.icon] === undefined) {
3965+ print("ICON MISSING DAY: "+partData.icon+" "+result.condition)
3966+ }
3967+ return result;
3968+ }
3969+ //
3970+ function formatResult(combinedData, location) {
3971+ var tmpResult = {}, result = [],
3972+ day=null, todayDate,
3973+ offset=(location.timezone && location.timezone.gmtOffset) ? location.timezone.gmtOffset*60*60*1000: 0,
3974+ now = new Date().getTime(),
3975+ nowMs = parseInt(now/1000),
3976+ localNow = getLocationTime(now+offset),
3977+ data = {
3978+ "location": combinedData[0]["Location"],
3979+ "daily": combinedData[0]["DailyForecasts"],
3980+ "forecast": combinedData[0]["HourlyForecasts"],
3981+ "current": combinedData[0]["StandardObservation"],
3982+ };
3983+ print("["+location.name+"] "+JSON.stringify(localNow));
3984+ // add openweathermap id for faster responses
3985+ if(location.services && !location.services[_serviceName] && data["location"].key) {
3986+ location.services[_serviceName] = data["location"].key
3987+ }
3988+ // only 5 days of forecast for TWC
3989+ for(var x=0;x<5;x++) {
3990+ var dayData = data["daily"][x],
3991+ date = getLocationTime(((dayData.validDate*1000)-1000)+offset); // minus 1 sec to handle +/-12 TZ
3992+ day = date.year+"-"+date.month+"-"+date.date;
3993+ if(!todayDate) {
3994+ if(localNow.year+"-"+localNow.month+"-"+localNow.date > day) {
3995+ // skip "yesterday"
3996+ continue;
3997+ }
3998+ todayDate = date;
3999+ }
4000+ tmpResult[day] = _buildDayFormat(date, dayData, nowMs);
4001+ }
4002+ //
4003+ if(data["current"]) {
4004+ var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date
4005+ tmpResult[today]["current"] = _buildDataPoint(todayDate, data["current"]);
4006+ }
4007+ if(data["forecast"] !== undefined) {
4008+ data["forecast"].forEach(function(hourData) {
4009+ var dateData = getLocationTime((hourData.dateTime*1000)+offset),
4010+ day = dateData.year+"-"+dateData.month+"-"+dateData.date;
4011+ if(tmpResult[day]) {
4012+ tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
4013+ }
4014+ })
4015+ }
4016+ //
4017+ for(var d in tmpResult) {
4018+ result.push(tmpResult[d]);
4019+ }
4020+ return result;
4021+ }
4022+ //
4023+ function _getUrl(params) {
4024+ var url, serviceId,
4025+ baseParams = {
4026+ key: params.api_key,
4027+ units: (params.units === "metric") ? "m" : "e",
4028+ locale: Qt.locale().name,
4029+ hours: "48",
4030+ },
4031+ commands = {
4032+ "mobileaggregation": "mobile/mobagg/",
4033+ };
4034+ if(params.location.services && params.location.services[_serviceName]) {
4035+ serviceId = encodeURIComponent(params.location.services[_serviceName]);
4036+ url = _baseUrl+commands["mobileaggregation"]+serviceId+".js?"+parameterize(baseParams);
4037+ } else if (params.location.coord) {
4038+ var coord = {lat: params.location.coord.lat, lng: params.location.coord.lon};
4039+ url = _baseUrl+commands["mobileaggregation"]+"get.js?"+parameterize(baseParams)+"&"+
4040+ parameterize(coord);
4041+ }
4042+ return url;
4043+ }
4044+ //
4045+ return {
4046+ getData: function(params, apiCaller, onSuccess, onError) {
4047+ var url = _getUrl(params),
4048+ handlerMap = {
4049+ all: { type: "all", url: url}
4050+ },
4051+ response = {
4052+ location: params.location,
4053+ db: (params.db) ? params.db : null,
4054+ format: RESPONSE_DATA_VERSION
4055+ },
4056+ addDataToResponse = (function(request, data) {
4057+ var formattedResult;
4058+ response["data"] = formatResult(data, params.location);
4059+ onSuccess(response);
4060+ }),
4061+ onErrorHandler = (function(err) {
4062+ onError(err);
4063+ });
4064+ apiCaller(handlerMap.all, addDataToResponse, onErrorHandler);
4065+ }
4066+ }
4067+})();
4068+
4069+var WeatherApi = (function(_services) {
4070+ /**
4071+ proxy for requesting weather apis, the passed _services are providing the respective api endpoints
4072+ and formatters to build a uniform response object
4073+ */
4074+ function _getService(name) {
4075+ if(_services[name] !== undefined) {
4076+ return _services[name];
4077+ }
4078+ return _services["weatherchannel"];
4079+ }
4080+ //
4081+ function _sendRequest(request, onSuccess, onError) {
4082+ var xmlHttp = new XMLHttpRequest();
4083+ if (xmlHttp) {
4084+ console.log("Sent request URL: " + request.url);
4085+ xmlHttp.open('GET', request.url, true);
4086+ xmlHttp.onreadystatechange = function () {
4087+ try {
4088+ if (xmlHttp.readyState == 4) {
4089+ if(xmlHttp.status === 200) {
4090+ if(xmlHttp.responseXML) {
4091+ onSuccess(request, xmlHttp.responseXML.documentElement);
4092+ } else {
4093+ var json = JSON.parse(xmlHttp.responseText);
4094+ onSuccess(request,json);
4095+ }
4096+ } else {
4097+ onError({
4098+ msg: "wrong response http code, got "+xmlHttp.status,
4099+ request: request
4100+ });
4101+ }
4102+ }
4103+ } catch (e) {
4104+ print("Exception: "+e)
4105+ onError({msg: "wrong response data format", request: request});
4106+ }
4107+ };
4108+ xmlHttp.send(null);
4109+ }
4110+ }
4111+ //
4112+ return {
4113+ //
4114+ geoLookup: function(params, onSuccess, onError) {
4115+ var service = _getService('geoip'),
4116+ geoNameService = _getService('geonames'),
4117+ lookupHandler = function(data) {
4118+ print("Geolookup: "+JSON.stringify(data))
4119+ geoNameService.search("point", {coords:data}, _sendRequest, onSuccess, onError);
4120+ };
4121+ service.getLatLong(params, _sendRequest, lookupHandler, onError)
4122+ },
4123+ //
4124+ search: function(mode, params, onSuccess, onError) {
4125+ var service = _getService('geonames');
4126+ service.search(mode, params, _sendRequest, onSuccess, onError);
4127+ },
4128+ //
4129+ getLocationData: function(params, onSuccess, onError) {
4130+ var service = _getService(params.service);
4131+ service.getData(params, _sendRequest, onSuccess, onError);
4132+ },
4133+ }
4134+})({
4135+ "openweathermap": OpenWeatherMapApi,
4136+ "weatherchannel": WeatherChannelApi,
4137+ "geonames": GeonamesApi,
4138+ "geoip": GeoipApi
4139+});
4140+
4141+var sendRequest = function(message, responseCallback) {
4142+ // handles the response data
4143+ var finished = function(result) {
4144+ // print result to get data for test json files
4145+ // print(JSON.stringify(result));
4146+ //WorkerScript.sendMessage({
4147+ responseCallback({
4148+ action: message.action,
4149+ result: result
4150+ })
4151+ }
4152+ // handles errors
4153+ var onError = function(err) {
4154+ console.log(JSON.stringify(err, null, true));
4155+ //WorkerScript.sendMessage({ 'error': err})
4156+ responseCallback({ 'error': err})
4157+ }
4158+ // keep order of locations, sort results
4159+ var sortDataResults = function(locA, locB) {
4160+ return locA.db.id - locB.db.id;
4161+ }
4162+ // perform the api calls
4163+ if(message.action === "searchByName") {
4164+ WeatherApi.search("name", message.params, finished, onError);
4165+ } else if(message.action === "searchByPoint") {
4166+ WeatherApi.search("point", message.params, finished, onError);
4167+ } else if(message.action === "getGeoIp") {
4168+ WeatherApi.geoLookup(message.params, finished, onError);
4169+ } else if(message.action === "updateData") {
4170+ var locLength = message.params.locations.length,
4171+ locUpdated = 0,
4172+ result = [],
4173+ now = new Date().getTime();
4174+ if(locLength > 0) {
4175+ message.params.locations.forEach(function(loc) {
4176+ var updatedHnd = function (newData, cached) {
4177+ locUpdated += 1;
4178+ if(cached === true) {
4179+ newData["save"] = false;
4180+ } else {
4181+ newData["save"] = true;
4182+ newData["updated"] = new Date().getTime();
4183+ }
4184+ result.push(newData);
4185+ if(locUpdated === locLength) {
4186+ result.sort(sortDataResults);
4187+ finished(result);
4188+ }
4189+ },
4190+ params = {
4191+ location:loc.location,
4192+ db: loc.db,
4193+ units: 'metric',
4194+ service: message.params.service,
4195+ api_key: message.params.api_key,
4196+ interval: message.params.interval
4197+ },
4198+ secsFromLastFetch = (now-loc.updated)/1000;
4199+ if( message.params.force===true || loc.format !== RESPONSE_DATA_VERSION || secsFromLastFetch > params.interval){
4200+ // data older than 30min, location is new or data format is deprecated
4201+ WeatherApi.getLocationData(params, updatedHnd, onError);
4202+ } else {
4203+ console.log("["+loc.location.name+"] returning cached data, time from last fetch: "+secsFromLastFetch)
4204+ updatedHnd(loc, true);
4205+ }
4206+ })
4207+ } else {
4208+ finished(result);
4209+ }
4210+ }
4211+}
4212
4213=== added file 'app/data/key.js'
4214--- app/data/key.js 1970-01-01 00:00:00 +0000
4215+++ app/data/key.js 2015-03-19 04:32:18 +0000
4216@@ -0,0 +1,1 @@
4217+var twcKey = "";
4218
4219=== added directory 'app/graphics'
4220=== added file 'app/graphics/Big-Rain.png'
4221Binary files app/graphics/Big-Rain.png 1970-01-01 00:00:00 +0000 and app/graphics/Big-Rain.png 2015-03-19 04:32:18 +0000 differ
4222=== added file 'app/graphics/CMakeLists.txt'
4223--- app/graphics/CMakeLists.txt 1970-01-01 00:00:00 +0000
4224+++ app/graphics/CMakeLists.txt 2015-03-19 04:32:18 +0000
4225@@ -0,0 +1,5 @@
4226+file(GLOB IMAGE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png *.svg)
4227+
4228+add_custom_target(ubuntu-weather-app_graphics_IMAGEFiles ALL SOURCES ${IMAGE_FILES})
4229+
4230+install(FILES ${IMAGE_FILES} DESTINATION ${UBUNTU-WEATHER_APP_DIR}/graphics)
4231
4232=== added file 'app/graphics/Cloudy-Circles.png'
4233Binary files app/graphics/Cloudy-Circles.png 1970-01-01 00:00:00 +0000 and app/graphics/Cloudy-Circles.png 2015-03-19 04:32:18 +0000 differ
4234=== added file 'app/graphics/Cloudy-Night.png'
4235Binary files app/graphics/Cloudy-Night.png 1970-01-01 00:00:00 +0000 and app/graphics/Cloudy-Night.png 2015-03-19 04:32:18 +0000 differ
4236=== added file 'app/graphics/Cloudy-Snow.png'
4237Binary files app/graphics/Cloudy-Snow.png 1970-01-01 00:00:00 +0000 and app/graphics/Cloudy-Snow.png 2015-03-19 04:32:18 +0000 differ
4238=== added file 'app/graphics/Cloudy.png'
4239Binary files app/graphics/Cloudy.png 1970-01-01 00:00:00 +0000 and app/graphics/Cloudy.png 2015-03-19 04:32:18 +0000 differ
4240=== added file 'app/graphics/Fog.png'
4241Binary files app/graphics/Fog.png 1970-01-01 00:00:00 +0000 and app/graphics/Fog.png 2015-03-19 04:32:18 +0000 differ
4242=== added file 'app/graphics/Raindrop.png'
4243Binary files app/graphics/Raindrop.png 1970-01-01 00:00:00 +0000 and app/graphics/Raindrop.png 2015-03-19 04:32:18 +0000 differ
4244=== added file 'app/graphics/Showers.png'
4245Binary files app/graphics/Showers.png 1970-01-01 00:00:00 +0000 and app/graphics/Showers.png 2015-03-19 04:32:18 +0000 differ
4246=== added file 'app/graphics/Starry-Night.png'
4247Binary files app/graphics/Starry-Night.png 1970-01-01 00:00:00 +0000 and app/graphics/Starry-Night.png 2015-03-19 04:32:18 +0000 differ
4248=== added file 'app/graphics/Stormy.png'
4249Binary files app/graphics/Stormy.png 1970-01-01 00:00:00 +0000 and app/graphics/Stormy.png 2015-03-19 04:32:18 +0000 differ
4250=== added file 'app/graphics/Sunny.png'
4251Binary files app/graphics/Sunny.png 1970-01-01 00:00:00 +0000 and app/graphics/Sunny.png 2015-03-19 04:32:18 +0000 differ
4252=== added file 'app/graphics/Windy-n-Snow.png'
4253Binary files app/graphics/Windy-n-Snow.png 1970-01-01 00:00:00 +0000 and app/graphics/Windy-n-Snow.png 2015-03-19 04:32:18 +0000 differ
4254=== added file 'app/graphics/clouds.svg'
4255--- app/graphics/clouds.svg 1970-01-01 00:00:00 +0000
4256+++ app/graphics/clouds.svg 2015-03-19 04:32:18 +0000
4257@@ -0,0 +1,22 @@
4258+<?xml version="1.0" encoding="utf-8"?>
4259+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4260+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4261+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4262+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4263+<path fill="#818181" d="M59.975,15.531c-6.848,0.01-13.273,3.294-17.295,8.844l-0.411,0.567l-0.671-0.19
4264+ c-1.473-0.416-2.996-0.631-4.526-0.637c-9.091,0.014-16.524,7.214-16.842,16.316l-0.031,0.855l-0.849,0.102
4265+ c-6.084,0.731-10.651,5.881-10.661,12.02v0.002c0.001,6.707,5.407,12.121,12.102,12.121h3.322c0.589-1.477,1.377-2.828,2.297-4.092
4266+ l-5.6,0.092H20.8c-4.47,0-8.115-3.646-8.115-8.115c0-3.366,1.763-5.854,4.17-7.211c2.048-1.154,4.522-1.433,6.938-1.211
4267+ c-0.458-4.202,0.209-8.238,2.176-11.357c2.15-3.412,5.85-5.666,10.734-5.666c2.806,0,5.319,1.063,7.457,2.701
4268+ c2.545-6.614,8.791-11.138,15.965-11.141c9.521,0.001,17.26,7.74,17.26,17.26v0.002v0.002c-0.005,1.498-0.358,2.956-0.745,4.399
4269+ c5.03,0.398,9.048,4.506,9.048,9.638c0.001,4.139-2.635,7.588-6.279,9.016c0.326,1.08,0.611,2.18,0.791,3.318
4270+ c0.511,0.35,0.987,0.742,1.451,1.146c5.283-2.223,9.037-7.371,9.037-13.481c0-5.812-3.426-11.069-8.73-13.424l-0.58-0.257
4271+ l-0.014-0.636C81.113,24.848,71.623,15.539,59.975,15.531 M57.005,48.5c-7.043,0-13.026,4.346-15.889,10.567l-0.246,0.537
4272+ l-0.59,0.043c-6.467,0.471-11.592,6.07-11.592,12.9c0,7.137,5.573,12.984,12.455,12.984h15.861H71.79
4273+ c5.129,0,9.283-4.365,9.283-9.666c0-4.021-2.406-7.385-5.82-8.838l-0.58-0.246l-0.027-0.629C74.202,56.361,66.522,48.5,57.005,48.5
4274+ M57.079,52.549h0.002c6.954,0,12.623,5.336,13.289,12.119l0.105-0.105l-0.01,1.07c0.003,0.113,0.033,0.221,0.033,0.336v0.002
4275+ c0,0.309-0.021,0.602-0.043,0.895v0.141c0,0.033-0.009,0.041-0.01,0.074c0,0.004,0,0.004,0,0.008
4276+ c-0.02,0.967-0.148,1.457-0.273,2.15c0.313-0.035,0.307-0.07,0.711-0.076h0.01h0.01c3.422,0,6.217,2.797,6.217,6.219
4277+ s-2.795,6.217-6.217,6.219l-29.236,0.012c-4.991,0-9.058-4.066-9.059-9.057c0-4.992,4.066-9.059,9.059-9.059
4278+ c0.797,0,1.559,0.252,2.324,0.459C44.999,57.496,50.432,52.555,57.079,52.549"/>
4279+</svg>
4280
4281=== added file 'app/graphics/cloudy-night.svg'
4282--- app/graphics/cloudy-night.svg 1970-01-01 00:00:00 +0000
4283+++ app/graphics/cloudy-night.svg 2015-03-19 04:32:18 +0000
4284@@ -0,0 +1,38 @@
4285+<?xml version="1.0" encoding="utf-8"?>
4286+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4287+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4288+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4289+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4290+<path fill="#818181" d="M22.384,58.326c0.157,0.785,0.342,1.566,0.555,2.34C22.726,59.893,22.541,59.111,22.384,58.326"/>
4291+<path fill="#818181" d="M33.675,14.738v0.007h-0.012c-1.445,2.071-2.622,4.172-3.442,5.757c-1.776,0.263-4.07,0.684-6.311,1.341
4292+ v0.007c0,0.003,0.012,0,0.012,0v0.007c1.472,2.028,3.06,3.815,4.286,5.108c-0.262,1.768-0.519,4.046-0.54,6.352
4293+ c0,0.003,0.012,0,0.012,0c0,0.003,0.012,0,0.012,0c2.334-0.807,4.47-1.787,6.056-2.578c1.612,0.814,3.758,1.801,6,2.564
4294+ c0-0.002,0.012,0.003,0.012,0c0-0.002,0-0.006,0-0.006c0-0.003,0-0.007,0-0.007c-0.037-2.434-0.288-4.731-0.539-6.477
4295+ c1.256-1.303,2.847-3.076,4.244-5.004c0-0.003,0,0-0.012,0l-0.013-0.007c-2.329-0.681-4.598-1.122-6.338-1.396
4296+ c-0.836-1.613-2.019-3.708-3.415-5.668C33.687,14.738,33.675,14.735,33.675,14.738z"/>
4297+<path fill="#818181" d="M14.458,35.462v0.005c-0.91,1.304-1.652,2.628-2.169,3.627c-1.119,0.166-2.563,0.431-3.976,0.845v0.004
4298+ c0,0.003,0,0,0,0v0.005c0.928,1.278,1.928,2.404,2.7,3.218c-0.165,1.114-0.326,2.549-0.34,4.002c0,0.001,0,0,0,0c0,0.001,0,0,0,0
4299+ c1.47-0.509,2.815-1.126,3.814-1.624c1.016,0.513,2.367,1.135,3.779,1.615c0-0.001,0,0.001,0,0s0-0.004,0-0.004
4300+ c0-0.001,0-0.004,0-0.005c-0.021-1.533-0.181-2.98-0.339-4.08c0.791-0.821,1.794-1.938,2.673-3.153c0-0.001,0,0,0,0v-0.005
4301+ c-1.468-0.429-2.896-0.706-3.993-0.879C16.083,38.018,15.338,36.698,14.458,35.462C14.458,35.462,14.458,35.461,14.458,35.462"/>
4302+<path fill="#818181" d="M67.917,53.49c-6.222,0-11.51,3.842-14.033,9.324v0.004l-0.133,0.291l-0.322,0.021
4303+ c-5.765,0.422-10.324,5.414-10.324,11.483c0,6.342,4.962,11.556,11.098,11.556h13.719h12.787c4.62,0,8.354-3.929,8.354-8.685
4304+ c0-3.607-2.164-6.637-5.232-7.942v-0.004l-0.311-0.132l-0.02-0.338v-0.002c-0.392-8.631-7.17-15.576-15.579-15.576H67.917z
4305+ M67.987,57.638L67.987,57.638h0.264v0.056c6.099,0.145,11.026,5.094,11.026,11.228c0,0.206-0.015,0.397-0.026,0.58v0.015v0.301
4306+ v0.002c-0.011,0.988-0.195,1.824-0.291,2.295c0.228-0.043,0.428-0.098,0.99-0.108c2.786,0.001,5.051,2.272,5.051,5.058
4307+ c0,2.784-2.267,5.053-5.051,5.055l-25.287,0.009c-4.142,0.001-7.514-3.366-7.515-7.507c0-4.143,3.372-7.514,7.515-7.512
4308+ c0.78,0,1.523,0.201,2.246,0.44c0.699-5.594,5.373-9.894,11.073-9.905v-0.005H67.987z M67.987,57.645l-0.248,0.248v0.012
4309+ c0,0,0.01,0,0.014,0v-0.017l0.016,0.017c0.073-0.002,0.145-0.012,0.218-0.012v-0.002L67.987,57.645L67.987,57.645z"/>
4310+<path fill="#818181" d="M67.329,20.841c4.776,7.285,6.465,16.21,4.197,24.725v0.002c-1.296,4.837-3.683,9.09-6.816,12.581
4311+ c1.036-0.322,2.132-0.504,3.273-0.506v-0.005h0.004h0.264v0.056c0.62,0.015,1.223,0.09,1.814,0.201
4312+ c2.396-3.314,4.242-7.105,5.361-11.284v-0.008c1.096-4.116,1.181-8.337,0.744-12.537l-0.354-3.391h0.002l2.129,2.662
4313+ c5.514,6.899,7.812,16.207,5.35,25.422v0.002c-0.878,3.277-2.283,6.265-4.094,8.904c0.047,0.413,0.074,0.831,0.074,1.256
4314+ c0,0.206-0.016,0.397-0.027,0.58v0.015v0.301v0.002c-0.012,0.987-0.195,1.824-0.291,2.295c0.228-0.043,0.428-0.098,0.991-0.108
4315+ c0.324,0,0.642,0.035,0.95,0.095c2.86-3.5,5.048-7.642,6.295-12.294c4.364-16.322-4.422-32.944-19.865-38.965H67.329z
4316+ M24.888,63.143c3.756,9.717,11.88,17.168,22.051,19.907v-0.002c6.843,1.834,13.753,1.362,19.92-0.926l-12.195,0.004
4317+ c-2.345,0.001-4.441-1.08-5.82-2.767c-0.287-0.068-0.574-0.133-0.861-0.209v-0.002c-3.729-1.006-6.977-2.896-9.885-5.123
4318+ l-2.717-2.08l3.408,0.291c3.014,0.256,6.002,0.108,8.9-0.396c1.107-2.771,3.814-4.735,6.975-4.733c0.78,0,1.523,0.201,2.245,0.44
4319+ c0.174-1.376,0.589-2.672,1.198-3.847c-7.001,4.381-15.729,5.963-24.326,3.66v-0.002C30.58,66.49,27.638,64.969,24.888,63.143"/>
4320+<path fill="#818181" d="M67.987,57.645l-0.248,0.248v0.012c0,0,0.01,0,0.014,0v-0.017l0.017,0.017
4321+ c0.072-0.002,0.144-0.012,0.217-0.012v-0.002L67.987,57.645L67.987,57.645z"/>
4322+</svg>
4323
4324=== added file 'app/graphics/cloudy.svg'
4325--- app/graphics/cloudy.svg 1970-01-01 00:00:00 +0000
4326+++ app/graphics/cloudy.svg 2015-03-19 04:32:18 +0000
4327@@ -0,0 +1,12 @@
4328+<?xml version="1.0" encoding="utf-8"?>
4329+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4330+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4331+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4332+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4333+<path fill="#818285" d="M53.295,21.823c-11.104,0-20.535,6.845-25.036,16.612l-0.246,0.534l-0.59,0.043
4334+ c-10.279,0.748-18.41,9.636-18.41,20.439c0,11.291,8.845,20.57,19.783,20.57h24.499H76.13c8.231,0,14.883-6.986,14.883-15.449
4335+ c0-6.416-3.855-11.809-9.324-14.13l-0.58-0.246l-0.028-0.629C80.383,34.195,68.294,21.823,53.295,21.823 M53.524,25.834h0.008
4336+ c12.847,0,23.281,10.436,23.281,23.281v0.002v0.004c-0.008,1.425-0.246,2.832-0.512,4.232c5.966,0.365,10.747,5.225,10.746,11.279
4337+ c0.001,6.295-5.123,11.418-11.418,11.418L29.604,75.91c-9.086-0.002-16.473-7.389-16.473-16.475c0-9.089,7.389-16.478,16.477-16.478
4338+ c0.507,0.004,1.011,0.07,1.517,0.121C33.848,32.968,42.981,25.844,53.524,25.834"/>
4339+</svg>
4340
4341=== added file 'app/graphics/fog.svg'
4342--- app/graphics/fog.svg 1970-01-01 00:00:00 +0000
4343+++ app/graphics/fog.svg 2015-03-19 04:32:18 +0000
4344@@ -0,0 +1,13 @@
4345+<?xml version="1.0" encoding="utf-8"?>
4346+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4347+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4348+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4349+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4350+<path fill="#818181" d="M52.593,12.922c-10.004,0.005-18.5,6.132-22.555,14.873l-0.246,0.536l-0.588,0.043
4351+ c-9.254,0.669-16.569,8.611-16.568,18.269v1.711v0.568v4h4.169v-4v-0.568v-1.635c0-7.826,6.401-14.187,14.268-14.186
4352+ c0.548,0.004,1.09,0.09,1.633,0.154c2.178-9.186,10.397-15.778,19.969-15.783c11.354,0,20.587,9.168,20.586,20.459v0.002v0.005
4353+ c-0.008,1.419-0.303,2.811-0.602,4.198c0.026,0,0.053-0.006,0.08-0.006c5.362,0,9.737,4.343,9.737,9.683
4354+ c0,5.338-4.375,9.68-9.737,9.68l-60.115-0.004v4h60.631c7.406,0,13.369-6.129,13.369-13.676c0-5.726-3.46-10.533-8.375-12.607
4355+ l-0.582-0.246l-0.028-0.631c-0.627-13.758-11.518-24.833-25.035-24.84H52.593z M12.624,76.922h74v-4h-74V76.922z M12.624,88.922h74
4356+ v-4h-74V88.922z"/>
4357+</svg>
4358
4359=== added file 'app/graphics/partly-cloudy.svg'
4360--- app/graphics/partly-cloudy.svg 1970-01-01 00:00:00 +0000
4361+++ app/graphics/partly-cloudy.svg 2015-03-19 04:32:18 +0000
4362@@ -0,0 +1,21 @@
4363+<?xml version="1.0" encoding="utf-8"?>
4364+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4365+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4366+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4367+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4368+<path fill="#818285" d="M52.013,12.326l-4,1.332v7.279h4V12.326z M31.745,17.295l-3.465,2l4,6.929l3.465-2L31.745,17.295z
4369+ M68.28,17.295l-4,6.929l3.465,2l4-6.929L68.28,17.295z M50.013,26.937c-14.371,0-26,11.629-26,26
4370+ c0.008,11.83,7.988,22.154,19.436,25.141l0.131,0.033c0.488,5.753,5.141,10.326,10.828,10.326h13.412h12.498
4371+ c4.533,0,8.195-3.854,8.195-8.518c0-3.537-2.122-6.509-5.132-7.789l-0.289-0.125l-0.015-0.312
4372+ c-0.255-5.624-3.288-10.506-7.711-13.15l0.039-0.172c0.394-1.785,0.596-3.609,0.607-5.438
4373+ C76.011,38.564,64.383,26.937,50.013,26.937 M50.013,30.937c12.139,0,22,9.862,22,22v0.004v0.004
4374+ c-0.01,1.154-0.109,2.306-0.298,3.445l-0.095,0.564c-1.216-0.326-2.483-0.518-3.801-0.518c-6.097,0-11.277,3.765-13.748,9.135
4375+ l-0.123,0.268l-0.295,0.021c-4.655,0.339-8.502,3.721-9.717,8.225l-0.468-0.146c-9.189-2.863-15.455-11.379-15.456-21.002
4376+ C28.013,40.799,37.874,30.937,50.013,30.937 M16.37,31.205l-2,3.465l6.931,4l2-3.465L16.37,31.205z M83.655,31.205l-6.932,4
4377+ l2.002,3.465l6.93-4L83.655,31.205z M10.013,54.938h8v-4h-8V54.938z M82.013,54.938h8v-4h-8V54.938z M67.872,60.551h0.002h0.009
4378+ c6.065,0.004,10.993,4.935,10.993,11.002c0,0.201-0.018,0.392-0.029,0.586v0.287c-0.011,0.986-0.192,1.777-0.291,2.279
4379+ c0.302-0.049,0.428-0.098,1.002-0.107h0.012c2.706,0,4.91,2.203,4.91,4.91s-2.203,4.914-4.91,4.914l-24.717,0.01
4380+ c-4.032,0-7.314-3.28-7.314-7.312c-0.001-4.033,3.281-7.312,7.314-7.312c0.759,0,1.493,0.205,2.213,0.438
4381+ C57.735,64.773,62.304,60.562,67.872,60.551 M21.301,67.205l-6.931,4l2,3.465l6.931-4L21.301,67.205z M32.28,79.65l-4,6.93l3.465,2
4382+ l4-6.93L32.28,79.65z"/>
4383+</svg>
4384
4385=== added file 'app/graphics/rain.svg'
4386--- app/graphics/rain.svg 1970-01-01 00:00:00 +0000
4387+++ app/graphics/rain.svg 2015-03-19 04:32:18 +0000
4388@@ -0,0 +1,22 @@
4389+<?xml version="1.0" encoding="utf-8"?>
4390+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4391+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4392+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4393+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4394+<path fill="#818181" d="M67.463,68.004c-2.34,5.406-4.102,10.639-4.219,11.028l-0.016,0.043l-0.014,0.043
4395+ c0.009-0.024-0.006,0.019-0.043,0.132c-0.15,0.455-0.232,0.928-0.232,1.418c0,2.518,2.01,4.526,4.527,4.526
4396+ c2.513-0.006,4.516-2.013,4.516-4.526c0-0.496-0.08-0.969-0.229-1.418l-0.01-0.021l-0.01-0.022
4397+ C71.734,79.207,69.963,73.832,67.463,68.004 M32.829,69.213c-2.008,4.703-3.531,9.19-3.633,9.53l-0.016,0.046l-0.017,0.045
4398+ c0.017-0.043,0.003-0.002-0.034,0.11v0.002c-0.129,0.392-0.199,0.796-0.199,1.22c0,2.174,1.73,3.903,3.905,3.903
4399+ c2.167-0.007,3.892-1.733,3.892-3.903c0-0.427-0.069-0.834-0.197-1.222l-0.01-0.022l-0.01-0.021
4400+ C36.51,78.901,34.975,74.278,32.829,69.213 M50.146,70.35c-2.967,6.725-5.175,13.365-5.322,13.855l-0.012,0.041l-0.018,0.038
4401+ c0.012-0.034-0.003,0.028-0.052,0.175v0.002c-0.189,0.571-0.293,1.168-0.293,1.785c0,3.166,2.535,5.7,5.703,5.7
4402+ c3.161-0.007,5.687-2.538,5.687-5.7c0-0.625-0.102-1.223-0.287-1.787l-0.01-0.021l-0.01-0.022
4403+ C55.533,84.416,53.318,77.611,50.146,70.35"/>
4404+<path fill="#818181" d="M52.523,8.96c-9.938,0-18.38,6.125-22.41,14.871l-0.246,0.537l-0.59,0.043
4405+ C20.092,25.08,12.825,33.02,12.825,42.68c0,10.095,7.905,18.386,17.679,18.386h22.02h20.525c7.342,0,13.275-6.232,13.275-13.784
4406+ c0-5.727-3.439-10.535-8.318-12.608l-0.58-0.246l-0.027-0.629C76.775,20.033,65.949,8.96,52.523,8.96 M52.6,12.942h0.012
4407+ c11.287,0,20.457,9.172,20.457,20.459v0.002v0.002c-0.004,1.421-0.3,2.814-0.598,4.201c0.023,0,0.048-0.006,0.072-0.006
4408+ c5.336,0,9.682,4.347,9.682,9.682s-4.346,9.681-9.682,9.681l-41.402-0.021c-7.823,0-14.186-6.362-14.186-14.185
4409+ c0-7.822,6.363-14.185,14.186-14.185c0.543,0.003,1.079,0.089,1.617,0.154C34.922,19.542,43.085,12.947,52.6,12.942"/>
4410+</svg>
4411
4412=== added file 'app/graphics/snow.svg'
4413--- app/graphics/snow.svg 1970-01-01 00:00:00 +0000
4414+++ app/graphics/snow.svg 2015-03-19 04:32:18 +0000
4415@@ -0,0 +1,21 @@
4416+<?xml version="1.0" encoding="utf-8"?>
4417+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4418+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4419+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4420+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4421+<path fill="#818181" d="M52.523,10.719c-9.938,0-18.379,6.125-22.41,14.871l-0.246,0.537l-0.59,0.043
4422+ c-9.186,0.669-16.453,8.609-16.453,18.269c0,10.094,7.905,18.387,17.679,18.387h22.02h20.525c7.342,0,13.275-6.232,13.275-13.786
4423+ c0-5.727-3.439-10.535-8.318-12.607l-0.58-0.246l-0.027-0.629C76.775,21.792,65.949,10.719,52.523,10.719 M52.6,14.701h0.012
4424+ c11.287,0,20.457,9.172,20.457,20.459v0.002v0.002c-0.004,1.421-0.299,2.814-0.598,4.201c0.024,0,0.049-0.006,0.072-0.006
4425+ c5.336,0,9.682,4.347,9.682,9.682c0,5.334-4.346,9.682-9.682,9.682l-41.402-0.021c-7.823,0-14.186-6.363-14.186-14.186
4426+ c0-7.822,6.363-14.186,14.186-14.186c0.543,0.003,1.079,0.089,1.617,0.154C34.922,21.301,43.085,14.706,52.6,14.701"/>
4427+<polygon fill="#818181" points="51.199,73.178 47.95,73.828 47.95,79.105 43.092,76.301 41.467,79.113 46.325,81.92 41.467,84.725
4428+ 43.092,87.537 47.95,84.732 47.95,90.344 51.199,90.344 51.199,84.732 56.057,87.537 57.682,84.725 52.824,81.92 57.682,79.113
4429+ 56.057,76.301 51.199,79.105 "/>
4430+<polygon fill="#818181" points="34.26,68.629 32.006,69.078 32.006,72.705 28.666,70.777 27.539,72.73 30.879,74.658 27.539,76.586
4431+ 28.666,78.539 32.006,76.611 32.006,80.469 34.26,80.469 34.26,76.611 37.602,78.539 38.729,76.586 35.389,74.658 38.729,72.73
4432+ 37.602,70.777 34.26,72.705 "/>
4433+<polygon fill="#818181" points="68.324,66.795 65.662,67.326 65.662,71.455 61.852,69.256 60.52,71.561 64.332,73.762 60.52,75.963
4434+ 61.852,78.268 65.662,76.066 65.662,80.469 68.324,80.469 68.324,76.066 72.138,78.268 73.467,75.963 69.654,73.762 73.467,71.561
4435+ 72.138,69.256 68.324,71.455 "/>
4436+</svg>
4437
4438=== added file 'app/graphics/starry.svg'
4439--- app/graphics/starry.svg 1970-01-01 00:00:00 +0000
4440+++ app/graphics/starry.svg 2015-03-19 04:32:18 +0000
4441@@ -0,0 +1,22 @@
4442+<?xml version="1.0" encoding="utf-8"?>
4443+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4444+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4445+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4446+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4447+<path fill="#818181" d="M67.59,20.306c4.775,7.285,6.465,16.21,4.197,24.726v0.002C67.385,61.461,50.47,71.227,34.041,66.826v-0.002
4448+ c-3.2-0.867-6.142-2.391-8.893-4.217c3.757,9.717,11.88,17.166,22.051,19.908v-0.002c17.547,4.701,35.555-5.697,40.258-23.242
4449+ c4.365-16.322-4.422-32.944-19.865-38.965H67.59z M76.08,30.14h0.002l2.129,2.662c5.514,6.899,7.812,16.207,5.35,25.422v0.002
4450+ C79.425,73.662,63.679,82.75,48.244,78.615v-0.002c-3.729-1.006-6.977-2.896-9.885-5.123l-2.717-2.08l3.409,0.291
4451+ c16.48,1.4,32.213-9.111,36.639-25.625v-0.009c1.097-4.115,1.181-8.337,0.744-12.536L76.08,30.14z"/>
4452+<path fill="#818181" d="M33.936,14.203v0.007h-0.012c-1.445,2.071-2.622,4.173-3.442,5.758c-1.777,0.263-4.07,0.684-6.311,1.341
4453+ v0.007c0,0.004,0.012,0,0.012,0v0.007c1.472,2.028,3.06,3.815,4.286,5.108c-0.262,1.768-0.518,4.046-0.54,6.352
4454+ c0,0.003,0.012,0,0.012,0c0,0.003,0.012,0,0.012,0c2.333-0.807,4.469-1.787,6.055-2.578c1.612,0.814,3.758,1.802,6,2.564
4455+ c0-0.002,0.012,0.003,0.012,0c0-0.002,0-0.006,0-0.006c0-0.003,0-0.008,0-0.008c-0.037-2.434-0.288-4.73-0.539-6.477
4456+ c1.256-1.303,2.847-3.076,4.244-5.004c0-0.003,0,0-0.012,0l-0.012-0.007c-2.33-0.682-4.598-1.122-6.338-1.396
4457+ c-0.836-1.612-2.019-3.708-3.415-5.668C33.947,14.203,33.936,14.201,33.936,14.203z"/>
4458+<path fill="#818181" d="M14.719,34.928v0.005c-0.91,1.304-1.652,2.628-2.169,3.627c-1.119,0.166-2.563,0.431-3.975,0.845v0.004
4459+ c0,0.003,0,0,0,0v0.005c0.927,1.278,1.927,2.404,2.7,3.219c-0.165,1.113-0.326,2.549-0.34,4.002c1.47-0.51,2.815-1.126,3.814-1.624
4460+ c1.016,0.513,2.368,1.135,3.78,1.614c0-0.001,0,0.001,0,0s0-0.004,0-0.004c0-0.001,0-0.004,0-0.005
4461+ c-0.022-1.533-0.181-2.979-0.339-4.08c0.791-0.821,1.794-1.938,2.673-3.152c0-0.001,0,0,0,0v-0.006
4462+ c-1.468-0.429-2.896-0.706-3.993-0.879C16.344,37.483,15.599,36.163,14.719,34.928C14.719,34.928,14.719,34.927,14.719,34.928z"/>
4463+</svg>
4464
4465=== added file 'app/graphics/sunny.svg'
4466--- app/graphics/sunny.svg 1970-01-01 00:00:00 +0000
4467+++ app/graphics/sunny.svg 2015-03-19 04:32:18 +0000
4468@@ -0,0 +1,13 @@
4469+<?xml version="1.0" encoding="utf-8"?>
4470+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4471+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4472+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4473+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4474+<path fill="#818285" d="M52.013,10.225l-4,1.332v7.279h4V10.225z M31.745,15.194l-3.464,2l4,6.93l3.464-2L31.745,15.194z
4475+ M68.281,15.194l-4,6.93l3.464,2l4-6.93L68.281,15.194z M50.013,24.836c-14.371,0-26,11.629-26,26c0,14.373,11.629,26,26,26
4476+ s26-11.627,26-26C76.013,36.465,64.384,24.836,50.013,24.836 M50.013,28.836c12.139,0,22,9.862,22,22c0,12.138-9.861,22-22,22
4477+ c-12.138,0-22-9.861-22-22C28.013,38.698,37.875,28.836,50.013,28.836 M16.37,29.104l-2,3.465l6.93,4l2-3.465L16.37,29.104z
4478+ M83.656,29.104l-6.933,4l2.002,3.465l6.931-4L83.656,29.104z M10.013,52.836h8v-4h-8V52.836z M82.013,52.836h8v-4h-8V52.836z
4479+ M21.3,65.104l-6.93,4l2,3.465l6.93-4L21.3,65.104z M78.726,65.104l-2.002,3.465l6.933,4l2-3.465L78.726,65.104z M32.281,77.549
4480+ l-4,6.93l3.464,2l4-6.93L32.281,77.549z M67.745,77.549l-3.464,2l4,6.93l3.464-2L67.745,77.549z M48.013,90.836h4v-8h-4V90.836z"/>
4481+</svg>
4482
4483=== added file 'app/graphics/thunder.svg'
4484--- app/graphics/thunder.svg 1970-01-01 00:00:00 +0000
4485+++ app/graphics/thunder.svg 2015-03-19 04:32:18 +0000
4486@@ -0,0 +1,14 @@
4487+<?xml version="1.0" encoding="utf-8"?>
4488+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4489+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4490+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4491+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4492+<path fill="#818181" d="M52.573,8.953c-9.938,0-18.38,6.125-22.41,14.871l-0.246,0.537l-0.59,0.043
4493+ c-9.186,0.669-16.453,8.609-16.453,18.269c0,10.094,7.905,18.387,17.679,18.387h22.02h20.524c7.343,0,13.276-6.233,13.276-13.785
4494+ c0-5.727-3.44-10.535-8.319-12.608l-0.58-0.246l-0.026-0.629C76.824,20.026,65.999,8.953,52.573,8.953 M52.649,12.935h0.012
4495+ c11.287,0,20.457,9.172,20.457,20.459v0.002v0.002c-0.005,1.421-0.3,2.814-0.599,4.201c0.024,0,0.049-0.006,0.072-0.006
4496+ c5.336,0,9.683,4.347,9.683,9.682s-4.347,9.682-9.683,9.682L31.19,56.936c-7.823,0-14.186-6.363-14.186-14.186
4497+ c0-7.822,6.363-14.185,14.186-14.185c0.543,0.003,1.079,0.089,1.617,0.154C34.971,19.535,43.134,12.94,52.649,12.935"/>
4498+<polygon fill="#818181" points="43.806,56.953 42.515,74.045 50.502,74.045 48.624,91.953 62.321,66.953 52.867,66.953
4499+ 54.472,56.953 "/>
4500+</svg>
4501
4502=== added file 'app/graphics/windy-snow.svg'
4503--- app/graphics/windy-snow.svg 1970-01-01 00:00:00 +0000
4504+++ app/graphics/windy-snow.svg 2015-03-19 04:32:18 +0000
4505@@ -0,0 +1,42 @@
4506+<?xml version="1.0" encoding="utf-8"?>
4507+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
4508+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4509+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4510+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
4511+<path fill="#818181" d="M51.571,15.195c-0.906,0-1.818,0.151-2.74,0.459l-0.018,0.006l-0.02,0.007
4512+ c-0.888,0.258-1.664,0.676-2.365,1.267v0.002v0.002c-0.644,0.536-1.198,1.251-1.652,2.199v0.008v0.008
4513+ c-0.04,0.08-0.075,0.247-0.113,0.355l2.098,1.209c0.027-0.074,0.007-0.116,0.041-0.193l0.01-0.016l0.01-0.014
4514+ c0.312-0.624,0.756-1.17,1.326-1.572c0.501-0.393,1.048-0.687,1.635-0.85c0.592-0.193,1.179-0.293,1.746-0.293
4515+ c1.209,0,2.363,0.473,3.348,1.299c1.135,0.872,1.715,2.258,1.715,3.824c0,1.649-0.584,3.115-1.771,4.039
4516+ c-1.13,0.909-2.661,1.297-4.494,1.297H49.43h-5.028H41.47H25.175v3.912h23.486c3.466,0,6.062-0.713,7.869-2.031
4517+ c1.718-1.253,2.631-3.407,2.641-6.805v-0.025c0-1.669-0.282-2.966-0.782-3.924v-0.008v-0.008c-0.534-1.075-1.18-1.872-1.933-2.445
4518+ l-0.012-0.008l-0.012-0.01c-0.794-0.643-1.605-1.058-2.471-1.273l-0.025-0.006l-0.023-0.008c-0.908-0.276-1.685-0.404-2.317-0.404
4519+ H51.571z M81.45,26.9c-0.922,0-1.849,0.154-2.787,0.467l-0.018,0.006l-0.021,0.007c-0.903,0.263-1.695,0.688-2.408,1.291v0.001
4520+ v0.002c-0.654,0.546-1.218,1.272-1.68,2.238v0.009v0.007c-0.044,0.088-0.08,0.259-0.121,0.375l2.16,1.244
4521+ c0.03-0.082,0.006-0.129,0.045-0.215l0.01-0.016l0.012-0.014c0.314-0.63,0.763-1.183,1.34-1.589c0.509-0.399,1.062-0.695,1.657-0.86
4522+ c0.597-0.196,1.191-0.299,1.769-0.299c1.224,0,2.393,0.479,3.391,1.316c1.149,0.884,1.734,2.286,1.734,3.873
4523+ c0,1.672-0.591,3.153-1.793,4.088c-1.145,0.921-2.695,1.314-4.555,1.314h-0.906h-5.109h-2.977H18.825v0.004h-1
4524+ c-1.016,0.001-2.016,0.159-2.939,0.488v0.002v0.002c-0.942,0.327-1.824,0.867-2.525,1.567v0.002v0.002
4525+ c-0.729,0.717-1.272,1.624-1.627,2.606v0.002c-0.373,1.025-0.529,2.134-0.529,3.332c0,1.2,0.157,2.315,0.529,3.348l0.01,0.029
4526+ c0.357,0.967,0.894,1.863,1.607,2.578l0.012,0.012v0.004c0.699,0.684,1.567,1.215,2.496,1.551l0.01,0.002l0.041,0.016
4527+ c0.923,0.316,1.915,0.467,2.932,0.467h1v0.002h40.344h2.98h5.115h0.908c1.861,0,3.414,0.396,4.559,1.316
4528+ c1.203,0.934,1.797,2.418,1.797,4.092c0,1.588-0.587,2.99-1.736,3.875c-0.998,0.838-2.169,1.318-3.395,1.318
4529+ c-0.578,0-1.173-0.104-1.771-0.299c-0.595-0.166-1.149-0.463-1.658-0.861c-0.577-0.408-1.026-0.961-1.342-1.592l-0.01-0.016
4530+ l-0.01-0.016c-0.035-0.084-0.016-0.133-0.045-0.213l-2.166,1.248c0.04,0.115,0.078,0.289,0.121,0.375v0.008v0.008
4531+ c0.463,0.965,1.028,1.695,1.684,2.242v0.002v0.002c0.714,0.604,1.509,1.029,2.412,1.293l0.018,0.006l0.02,0.006
4532+ c0.939,0.312,1.867,0.467,2.791,0.467c0.645,0,1.438-0.131,2.361-0.412l0.021-0.008l0.025-0.006c0.883-0.221,1.71-0.643,2.518-1.297
4533+ l0.012-0.01l0.014-0.008c0.768-0.584,1.425-1.396,1.971-2.492v-0.008v-0.008c0.508-0.979,0.797-2.299,0.797-3.998
4534+ c0-3.477-0.94-5.678-2.697-6.959c-1.842-1.342-4.482-2.068-8.01-2.068H18.812v0.01h-1c-0.629,0-1.163-0.094-1.611-0.244
4535+ l-0.016-0.004l-0.014-0.006c-0.402-0.148-0.757-0.377-1.016-0.627l-0.01-0.01l-0.01-0.01c-0.242-0.248-0.49-0.62-0.67-1.104v-0.014
4536+ c-0.002-0.004-0.003-0.011-0.004-0.015l-0.053-0.14v-0.076c-0.139-0.466-0.234-1.025-0.234-1.758c0-0.723,0.092-1.27,0.227-1.725
4537+ v-0.088l0.059-0.164c0.185-0.511,0.439-0.89,0.676-1.121v-0.004l0.012-0.011c0.256-0.258,0.629-0.49,1.021-0.625l0.025-0.011v-0.002
4538+ c0.456-0.164,0.99-0.254,1.613-0.254h60.67c3.522,0,6.161-0.725,8-2.065c1.755-1.28,2.693-3.479,2.693-6.95
4539+ c0-1.696-0.288-3.017-0.795-3.992v-0.008v-0.007c-0.545-1.095-1.202-1.905-1.969-2.489l-0.012-0.008l-0.012-0.01
4540+ c-0.807-0.652-1.632-1.074-2.514-1.295l-0.025-0.006l-0.023-0.008c-0.923-0.281-1.717-0.412-2.359-0.412H81.45z"/>
4541+<polygon fill="#818181" points="51.683,69.762 48.683,70.361 48.683,75.754 43.746,72.902 42.244,75.5 47.183,78.352 42.244,81.201
4542+ 43.746,83.799 48.683,80.947 48.683,86.65 51.683,86.65 51.683,80.947 56.619,83.799 58.119,81.201 53.183,78.352 58.119,75.5
4543+ 56.619,72.902 51.683,75.754 "/>
4544+<polygon fill="#818181" points="30.938,63.518 28.558,63.994 28.558,68.199 24.702,65.975 23.513,68.037 27.368,70.262
4545+ 23.513,72.486 24.702,74.549 28.558,72.324 28.558,76.775 30.938,76.775 30.938,72.324 34.793,74.549 35.983,72.486 32.13,70.262
4546+ 35.983,68.037 34.793,65.975 30.938,68.199 "/>
4547+</svg>
4548
4549=== added file 'app/ubuntu-weather-app.qml'
4550--- app/ubuntu-weather-app.qml 1970-01-01 00:00:00 +0000
4551+++ app/ubuntu-weather-app.qml 2015-03-19 04:32:18 +0000
4552@@ -0,0 +1,237 @@
4553+/*
4554+ * Copyright (C) 2015 Canonical Ltd
4555+ *
4556+ * This file is part of Ubuntu Weather App
4557+ *
4558+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
4559+ * it under the terms of the GNU General Public License version 3 as
4560+ * published by the Free Software Foundation.
4561+ *
4562+ * Ubuntu Weather App is distributed in the hope that it will be useful,
4563+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4564+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4565+ * GNU General Public License for more details.
4566+ *
4567+ * You should have received a copy of the GNU General Public License
4568+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4569+ */
4570+
4571+import QtQuick 2.3
4572+import Qt.labs.settings 1.0
4573+import Ubuntu.Components 1.1
4574+import "components"
4575+import "data" as Data
4576+import "data/WeatherApi.js" as WeatherApi
4577+import "data/key.js" as Key
4578+import "ui"
4579+
4580+MainView {
4581+ id: weatherApp
4582+
4583+ objectName: "weather"
4584+
4585+ applicationName: "com.ubuntu.weather"
4586+
4587+ automaticOrientation: false
4588+
4589+ width: units.gu(40)
4590+ height: units.gu(70)
4591+
4592+ backgroundColor: "#F5F5F5"
4593+
4594+ useDeprecatedToolbar: false
4595+ anchorToKeyboard: true
4596+
4597+ signal listItemSwiping(int i)
4598+
4599+ /*
4600+ List of locations and their data, accessible through index
4601+ */
4602+ property var locationsList: []
4603+
4604+ /*
4605+ Index of Location before a refresh, to go back after
4606+ */
4607+ property int indexAtRefresh: -1
4608+
4609+ /*
4610+ (re)load the pages on completion
4611+ */
4612+ Component.onCompleted: {
4613+ storage.getLocations(fillPages);
4614+ refreshData();
4615+ }
4616+
4617+ /*
4618+ Handle response data from data backend. Checks if a location
4619+ was updated and has to be stored again.
4620+ */
4621+ function responseDataHandler(messageObject) {
4622+ if(!messageObject.error) {
4623+ if(messageObject.action === "updateData") {
4624+ messageObject.result.forEach(function(loc) {
4625+ // replace location data in cache with refreshed values
4626+ if(loc["save"] === true) {
4627+ storage.updateLocation(loc.db.id, loc);
4628+ }
4629+ });
4630+ //print(JSON.stringify(messageObject.result));
4631+ fillPages(messageObject.result);
4632+ }
4633+ } else {
4634+ console.log(messageObject.error.msg+" / "+messageObject.error.request.url)
4635+ // TODO error handling
4636+ }
4637+ }
4638+
4639+ /* Fill the location pages with their data. */
4640+ function fillPages(locations) {
4641+ locationsList = []
4642+ locationsList = locations;
4643+ }
4644+
4645+ /*
4646+ Refresh data, either directly from storage or by checking against
4647+ API instead.
4648+ */
4649+ function refreshData(from_storage, force_refresh) {
4650+ from_storage = from_storage || false
4651+ force_refresh = force_refresh || false
4652+ if(from_storage === true && force_refresh !== true) {
4653+ storage.getLocations(fillPages);
4654+ } else {
4655+ storage.getLocations(function(locations) {
4656+ WeatherApi.sendRequest({
4657+ action: "updateData",
4658+ params: {
4659+ locations: locations,
4660+ force: force_refresh,
4661+ service: settings.service,
4662+ api_key: Key.twcKey,
4663+ interval: settings.refreshInterval
4664+ }
4665+ }, responseDataHandler)
4666+ });
4667+ }
4668+ }
4669+
4670+ Settings {
4671+ id: settings
4672+ category: "weatherSettings"
4673+ /*
4674+ Index of the current locationList of locations and their data, accessible through index
4675+ */
4676+ property int current: 0
4677+
4678+ property int refreshInterval: 1800
4679+ property string precipUnits
4680+ property string service
4681+ property string tempScale
4682+ property string units
4683+ property string windUnits
4684+
4685+ property bool migrated: false
4686+
4687+ Component.onCompleted: {
4688+ if (units === "") { // No settings so load defaults
4689+ console.debug("No settings, using defaults")
4690+ var metric = Qt.locale().measurementSystem === Locale.MetricSystem
4691+
4692+ precipUnits = metric ? "mm" : "in"
4693+ service = "weatherchannel"
4694+ tempScale = "°" + (metric ? "C" : "F")
4695+ units = metric ? "metric" : "imperial"
4696+ windUnits = metric ? "kmh" : "mph"
4697+ }
4698+ }
4699+ }
4700+
4701+ Data.Storage {
4702+ id: storage
4703+
4704+ // Add the location to the storage and refresh the locationList
4705+ // Return true if a location is added
4706+ function addLocation(location) {
4707+ var exists = checkLocationExists(location)
4708+
4709+ if(!exists) {
4710+ if(location.dbId === undefined || location.dbId=== 0) {
4711+ storage.insertLocation({location: location});
4712+ }
4713+ refreshData();
4714+ }
4715+
4716+ return !exists;
4717+ }
4718+
4719+ // Return true if the location given is already in the locationsList
4720+ function checkLocationExists(location) {
4721+ var exists = false;
4722+
4723+ for (var i=0; !exists && i < locationsList.length; i++) {
4724+ var loc = locationsList[i].location;
4725+
4726+ if (loc.services.geonames && (loc.services.geonames === location.services.geonames)) {
4727+ exists = true;
4728+ }
4729+ }
4730+
4731+ return exists;
4732+ }
4733+
4734+ function moveLocation(from, to) {
4735+ // Update settings to respect new changes
4736+ if (from === settings.current) {
4737+ settings.current = to;
4738+ } else if (from < settings.current && to >= settings.current) {
4739+ settings.current -= 1;
4740+ } else if (from > settings.current && to <= settings.current) {
4741+ settings.current += 1;
4742+ }
4743+
4744+ storage.reorder(locationsList[from].db.id, locationsList[to].db.id);
4745+
4746+ refreshData(true, false);
4747+ }
4748+
4749+ // Remove a location from the list
4750+ function removeLocation(index) {
4751+ if (settings.current >= index) { // Update settings to respect new changes
4752+ settings.current -= settings.current;
4753+ }
4754+
4755+ storage.clearLocation(locationsList[index].db.id);
4756+
4757+ refreshData(true, false);
4758+ }
4759+
4760+ function removeMultiLocations(indexes) {
4761+ var i;
4762+
4763+ // Sort the item indexes as loops below assume *numeric* sort
4764+ indexes.sort(function(a,b) { return a - b })
4765+
4766+ for (i=0; i < indexes.length; i++) {
4767+ if (settings.current >= i) { // Update settings to respect new changes
4768+ settings.current -= settings.current;
4769+ }
4770+ }
4771+
4772+ // Get location db ids to remove
4773+ var locations = []
4774+
4775+ for (i=0; i < indexes.length; i++) {
4776+ locations.push(locationsList[indexes[i]].db.id)
4777+ }
4778+
4779+ storage.clearMultiLocation(locations);
4780+
4781+ refreshData(true, false);
4782+ }
4783+ }
4784+
4785+ PageStack {
4786+ id: mainPageStack
4787+ Component.onCompleted: mainPageStack.push(Qt.resolvedUrl("ui/HomePage.qml"))
4788+ }
4789+}
4790
4791=== added directory 'app/ui'
4792=== added file 'app/ui/AddLocationPage.qml'
4793--- app/ui/AddLocationPage.qml 1970-01-01 00:00:00 +0000
4794+++ app/ui/AddLocationPage.qml 2015-03-19 04:32:18 +0000
4795@@ -0,0 +1,281 @@
4796+/*
4797+ * Copyright (C) 2015 Canonical Ltd
4798+ *
4799+ * This file is part of Ubuntu Weather App
4800+ *
4801+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
4802+ * it under the terms of the GNU General Public License version 3 as
4803+ * published by the Free Software Foundation.
4804+ *
4805+ * Ubuntu Weather App is distributed in the hope that it will be useful,
4806+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4807+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4808+ * GNU General Public License for more details.
4809+ *
4810+ * You should have received a copy of the GNU General Public License
4811+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4812+ */
4813+
4814+import QtQuick 2.3
4815+import Ubuntu.Components 1.1
4816+import Ubuntu.Components.ListItems 1.0 as ListItem
4817+import Ubuntu.Components.Popups 1.0
4818+import "../components"
4819+import "../data/CitiesList.js" as Cities
4820+import "../data/WeatherApi.js" as WeatherApi
4821+
4822+Page {
4823+ id: addLocationPage
4824+
4825+ title: i18n.tr("Select a city")
4826+ visible: false
4827+
4828+ /*
4829+ Flickable is set to null to stop page header from hiding since the fast
4830+ scroll component hides top anchor margin is incorrect.
4831+ */
4832+ flickable: null
4833+
4834+ state: "default"
4835+ states: [
4836+ PageHeadState {
4837+ name: "default"
4838+ head: addLocationPage.head
4839+ actions: [
4840+ Action {
4841+ iconName: "search"
4842+ text: i18n.tr("City")
4843+ onTriggered: {
4844+ addLocationPage.state = "search"
4845+ searchComponentLoader.sourceComponent = searchComponent
4846+ searchComponentLoader.item.forceActiveFocus()
4847+ }
4848+ }
4849+ ]
4850+ },
4851+
4852+ PageHeadState {
4853+ name: "search"
4854+ head: addLocationPage.head
4855+ backAction: Action {
4856+ iconName: "back"
4857+ text: i18n.tr("Back")
4858+ onTriggered: {
4859+ locationList.forceActiveFocus()
4860+ searchComponentLoader.item.text = ""
4861+ addLocationPage.state = "default"
4862+ searchComponentLoader.sourceComponent = undefined
4863+ }
4864+ }
4865+
4866+ contents: Loader {
4867+ id: searchComponentLoader
4868+ anchors {
4869+ left: parent ? parent.left : undefined
4870+ right: parent ? parent.right : undefined
4871+ rightMargin: units.gu(2)
4872+ }
4873+ }
4874+ }
4875+ ]
4876+
4877+ Component {
4878+ id: searchComponent
4879+ TextField {
4880+ id: searchField
4881+ objectName: "searchField"
4882+
4883+ inputMethodHints: Qt.ImhNoPredictiveText
4884+ placeholderText: i18n.tr("Search city")
4885+ hasClearButton: true
4886+
4887+ onTextChanged: {
4888+ if (text.trim() === "") {
4889+ loadEmpty()
4890+ } else {
4891+ loadFromProvider(text)
4892+ }
4893+ }
4894+ }
4895+ }
4896+
4897+ function appendCities(list) {
4898+ list.forEach(function(loc) {
4899+ citiesModel.append(loc);
4900+ })
4901+ }
4902+
4903+ function clearModelForLoading() {
4904+ citiesModel.clear()
4905+ citiesModel.loading = true
4906+ citiesModel.httpError = false
4907+ }
4908+
4909+ function loadEmpty() {
4910+ clearModelForLoading()
4911+
4912+ appendCities(Cities.preList)
4913+
4914+ citiesModel.loading = false
4915+ }
4916+
4917+ function loadFromProvider(search) {
4918+ clearModelForLoading()
4919+
4920+ WeatherApi.sendRequest({
4921+ action: "searchByName",
4922+ params: {
4923+ name: search,
4924+ units: "metric"
4925+ }
4926+ }, searchResponseHandler)
4927+ }
4928+
4929+ function searchResponseHandler(msgObject) {
4930+ if (!msgObject.error) {
4931+ appendCities(msgObject.result.locations)
4932+ } else {
4933+ citiesModel.httpError = true
4934+ }
4935+
4936+ citiesModel.loading = false
4937+ }
4938+
4939+ ListView {
4940+ id: locationList
4941+
4942+ clip: true
4943+ currentIndex: -1
4944+ anchors.fill: parent
4945+ anchors.rightMargin: fastScroll.showing ? fastScroll.width - units.gu(1)
4946+ : 0
4947+
4948+ function getSectionText(index) {
4949+ return citiesModel.get(index).name.substring(0,1)
4950+ }
4951+
4952+ onFlickStarted: {
4953+ forceActiveFocus()
4954+ }
4955+
4956+ section.property: "name"
4957+ section.criteria: ViewSection.FirstCharacter
4958+ section.labelPositioning: ViewSection.InlineLabels
4959+
4960+ section.delegate: ListItem.Header {
4961+ text: section
4962+ }
4963+
4964+ model: ListModel {
4965+ id: citiesModel
4966+
4967+ property bool loading: true
4968+ property bool httpError: false
4969+
4970+ onRowsAboutToBeInserted: loading = false
4971+ }
4972+
4973+ delegate: ListItem.Empty {
4974+ showDivider: false
4975+ Column {
4976+ anchors {
4977+ left: parent.left
4978+ leftMargin: units.gu(2)
4979+ right: parent.right
4980+ rightMargin: units.gu(2)
4981+ verticalCenter: parent.verticalCenter
4982+ }
4983+
4984+ Label {
4985+ color: UbuntuColors.darkGrey
4986+ elide: Text.ElideRight
4987+ fontSize: "medium"
4988+ text: name
4989+ }
4990+
4991+ Label {
4992+ color: UbuntuColors.lightGrey
4993+ elide: Text.ElideRight
4994+ fontSize: "xx-small"
4995+ text: countryName
4996+ }
4997+ }
4998+
4999+ onClicked: {
5000+ if (storage.addLocation(citiesModel.get(index))) {
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches