Merge lp:~sergiusens/ubuntu-clock-app/reboot-packaging into lp:ubuntu-clock-app/saucy

Proposed by Sergio Schvezov
Status: Superseded
Proposed branch: lp:~sergiusens/ubuntu-clock-app/reboot-packaging
Merge into: lp:ubuntu-clock-app/saucy
Diff against target: 10032 lines (+9531/-0) (has conflicts)
91 files modified
.bzrignore (+2/-0)
CMakeLists.txt (+82/-0)
COPYING (+674/-0)
README (+9/-0)
README.autopilot (+45/-0)
README.developers (+28/-0)
app/CMakeLists.txt (+24/-0)
app/alarm/AlarmDelegate.qml (+95/-0)
app/alarm/AlarmLabel.qml (+65/-0)
app/alarm/AlarmList.qml (+147/-0)
app/alarm/AlarmPage.qml (+104/-0)
app/alarm/AlarmRepeat.qml (+114/-0)
app/alarm/AlarmSettingsPage.qml (+231/-0)
app/alarm/AlarmSound.qml (+120/-0)
app/alarm/AlarmUtils.qml (+138/-0)
app/alarm/CMakeLists.txt (+6/-0)
app/alarm/EditAlarmPage.qml (+261/-0)
app/clock/CMakeLists.txt (+6/-0)
app/clock/ClockPage.qml (+197/-0)
app/clock/MainClock.qml (+131/-0)
app/components/AnalogMode.qml (+102/-0)
app/components/AnalogShadow.qml (+83/-0)
app/components/Background.qml (+31/-0)
app/components/CMakeLists.txt (+6/-0)
app/components/Clock.qml (+254/-0)
app/components/ClockCircle.qml (+118/-0)
app/components/DigitalMode.qml (+124/-0)
app/components/DigitalShadow.qml (+83/-0)
app/components/PullToAdd.qml (+90/-0)
app/components/Shadow.qml (+44/-0)
app/components/SubtitledListItem.qml (+55/-0)
app/components/Utils.js (+25/-0)
app/graphics/CMakeLists.txt (+8/-0)
app/ubuntu-clock-app.desktop.in (+10/-0)
app/ubuntu-clock-app.qml (+107/-0)
app/upstreamcomponents/CMakeLists.txt (+6/-0)
app/upstreamcomponents/FastScroll.js (+130/-0)
app/upstreamcomponents/FastScroll.qml (+321/-0)
app/upstreamcomponents/ListItemWithActions.qml (+372/-0)
app/upstreamcomponents/ListItemWithActionsCheckBox.qml (+25/-0)
app/upstreamcomponents/MultipleSelectionListView.qml (+199/-0)
app/upstreamcomponents/MultipleSelectionVisualModel.qml (+31/-0)
app/upstreamcomponents/PageWithBottomEdge.qml (+396/-0)
app/upstreamcomponents/README.components (+33/-0)
app/worldclock/CMakeLists.txt (+6/-0)
app/worldclock/UserWorldCityDelegate.qml (+182/-0)
app/worldclock/UserWorldCityList.qml (+145/-0)
app/worldclock/WorldCityList.qml (+205/-0)
app/worldclock/world-city-list.xml (+1383/-0)
backend/CMakeLists.txt (+77/-0)
backend/modules/Alarm/Settings/alarmsettings.cpp (+172/-0)
backend/modules/Alarm/Settings/alarmsettings.h (+104/-0)
backend/modules/Alarm/Settings/backend.cpp (+34/-0)
backend/modules/Alarm/Settings/backend.h (+35/-0)
backend/modules/Alarm/Settings/qmldir (+2/-0)
backend/modules/DateTime/backend.cpp (+34/-0)
backend/modules/DateTime/backend.h (+35/-0)
backend/modules/DateTime/datetime.cpp (+73/-0)
backend/modules/DateTime/datetime.h (+94/-0)
backend/modules/DateTime/qmldir (+2/-0)
backend/modules/Timezone/backend.cpp (+37/-0)
backend/modules/Timezone/backend.h (+35/-0)
backend/modules/Timezone/generictimezonemodel.cpp (+81/-0)
backend/modules/Timezone/generictimezonemodel.h (+58/-0)
backend/modules/Timezone/qmldir (+2/-0)
backend/modules/Timezone/timezonemodel.cpp (+150/-0)
backend/modules/Timezone/timezonemodel.h (+109/-0)
backend/modules/Timezone/xmltimezonemodel.cpp (+139/-0)
backend/modules/Timezone/xmltimezonemodel.h (+54/-0)
debian/changelog (+197/-0)
debian/compat (+1/-0)
debian/control (+42/-0)
debian/copyright (+54/-0)
debian/rules (+20/-0)
debian/source/format (+1/-0)
debian/tests/control (+13/-0)
debian/tests/make-autopilot (+2/-0)
debian/tests/make-test (+2/-0)
debian/ubuntu-clock-app-autopilot.install (+1/-0)
debian/ubuntu-clock-app.install (+2/-0)
manifest.json (+23/-0)
tests/CMakeLists.txt (+1/-0)
tests/autopilot/CMakeLists.txt (+8/-0)
tests/autopilot/run (+13/-0)
tests/autopilot/ubuntu_clock_app/__init__.py (+18/-0)
tests/autopilot/ubuntu_clock_app/emulators.py (+411/-0)
tests/autopilot/ubuntu_clock_app/tests/__init__.py (+138/-0)
tests/autopilot/ubuntu_clock_app/tests/test_alarm.py (+103/-0)
tests/autopilot/ubuntu_clock_app/tests/test_clock.py (+44/-0)
tests/unit/tst_hellocomponent.qml (+49/-0)
ubuntu-clock-app.json (+8/-0)
Conflict adding file .bzrignore.  Moved existing file to .bzrignore.moved.
Conflict adding file .bzrignore.moved.  Moved existing file to .bzrignore.moved.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 debian.  Moved existing file to debian.moved.
Conflict adding file tests.  Moved existing file to tests.moved.
To merge this branch: bzr merge lp:~sergiusens/ubuntu-clock-app/reboot-packaging
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Pending
Review via email: mp+230551@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-12.

To post a comment you must log in.
84. By Sergio Schvezov

Don't install tests into click package

Unmerged revisions

84. By Sergio Schvezov

Don't install tests into click package

83. By Sergio Schvezov

Provision version and branch to x-source and version in the manifest

82. By Sergio Schvezov

Make it easy for us and let ubuntu-app-lauch use the expected import path

81. By Sergio Schvezov

Install apparmor manifest where manifest.json points to

80. By Sergio Schvezov

adding x-source to manifest for ci

79. By Nekhelesh Ramananthan

Merged trunk

78. By Nicholas Skaggs

fix pep8

77. By Nicholas Skaggs

remove find local path

76. By Daniel Holbach

remove 'builddir' portion from system-installed paths

75. By Daniel Holbach

merged lp:~nskaggs/ubuntu-clock-app/fix-ap-setup - resolve conflicts

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 2014-08-12 22:08:22 +0000
4@@ -0,0 +1,2 @@
5+*.user
6+builddir
7
8=== renamed file '.bzrignore' => '.bzrignore.moved'
9=== renamed file '.bzrignore.moved' => '.bzrignore.moved.moved'
10=== added file 'CMakeLists.txt'
11--- CMakeLists.txt 1970-01-01 00:00:00 +0000
12+++ CMakeLists.txt 2014-08-12 22:08:22 +0000
13@@ -0,0 +1,82 @@
14+project(com.ubuntu.clock.devel C CXX)
15+cmake_minimum_required(VERSION 2.8.9)
16+
17+set (UBUNTU_PROJECT_TYPE "ClickApp" CACHE INTERNAL "Tells QtCreator this is a Click application project")
18+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
19+
20+find_package(Qt5Core)
21+find_package(Qt5Qml)
22+find_package(Qt5Quick)
23+find_package(Qt5DBus)
24+#find_package(ubuntu-sdk-libs)
25+
26+#automatically create moc files
27+set(CMAKE_AUTOMOC ON)
28+
29+option(INSTALL_TESTS "Install the tests on make install" on)
30+option(CLICK_MODE "Build as a click package" on)
31+
32+set(APP_NAME clock)
33+set(APP_HARDCODE ubuntu-clock-app)
34+set(MAIN_QML ${APP_HARDCODE}.qml)
35+set(ICON clock-app)
36+SET(AUTOPILOT_DIR ubuntu_clock_app)
37+
38+# Standard install paths
39+include(GNUInstallDirs)
40+
41+#set install paths
42+if(CLICK_MODE)
43+ set(CMAKE_INSTALL_PREFIX "/")
44+ set(UBUNTU-CLOCK_APP_DIR "${CMAKE_INSTALL_DATADIR}/qml")
45+
46+ set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}")
47+ set(EXEC "qmlscene $@ ${UBUNTU-CLOCK_APP_DIR}/${MAIN_QML}")
48+ set(MODULE_PATH ${QT_IMPORTS_DIR})
49+ if(NOT BZR_REVNO)
50+ execute_process(
51+ COMMAND bzr revno
52+ OUTPUT_VARIABLE BZR_REVNO
53+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
54+ OUTPUT_STRIP_TRAILING_WHITESPACE
55+ )
56+ endif(NOT BZR_REVNO)
57+ if(NOT BZR_SOURCE)
58+ set(BZR_SOURCE lp:ubuntu-clock-app)
59+ endif(NOT BZR_SOURCE)
60+else(CLICK_MODE)
61+ set(UBUNTU-CLOCK_APP_DIR "${CMAKE_INSTALL_DATADIR}/ubuntu-clock-app")
62+ execute_process(
63+ COMMAND qmake -query QT_INSTALL_QML
64+ OUTPUT_VARIABLE QT_IMPORTS_DIR
65+ OUTPUT_STRIP_TRAILING_WHITESPACE
66+ )
67+set(MODULE_PATH ${QT_IMPORTS_DIR}/ClockApp)
68+endif(CLICK_MODE)
69+
70+if(${CLICK_MODE})
71+ configure_file(manifest.json manifest.json)
72+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
73+ install(FILES "${APP_HARDCODE}.json" DESTINATION ${CMAKE_INSTALL_PREFIX})
74+else(CLICK_MODE)
75+ set(EXEC "qmlscene $@ -I ${MODULE_PATH} ${CMAKE_INSTALL_PREFIX}/${UBUNTU-CLOCK_APP_DIR}/${MAIN_QML}")
76+endif()
77+
78+add_subdirectory(app)
79+add_subdirectory(backend)
80+add_subdirectory(tests)
81+
82+add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/tests/autopilot/run
83+ COMMAND ${CMAKE_SOURCE_DIR}/tests/autopilot/run
84+ DEPENDS timezone timezone-qmldir alarmsettings alarmsettings-qmldir datetime datetime-qmldir
85+ WORKING_DIRECTORY ./app)
86+
87+enable_testing()
88+add_test(NAME basic
89+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/app
90+ COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/tests/unit -import ${CMAKE_BINARY_DIR}/backend
91+)
92+
93+add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/ubuntu-clock-app.qml
94+ DEPENDS timezone timezone-qmldir alarmsettings alarmsettings-qmldir datetime datetime-qmldir
95+ WORKING_DIRECTORY ./app)
96
97=== renamed file 'CMakeLists.txt' => 'CMakeLists.txt.moved'
98=== added file 'COPYING'
99--- COPYING 1970-01-01 00:00:00 +0000
100+++ COPYING 2014-08-12 22:08:22 +0000
101@@ -0,0 +1,674 @@
102+ GNU GENERAL PUBLIC LICENSE
103+ Version 3, 29 June 2007
104+
105+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
106+ Everyone is permitted to copy and distribute verbatim copies
107+ of this license document, but changing it is not allowed.
108+
109+ Preamble
110+
111+ The GNU General Public License is a free, copyleft license for
112+software and other kinds of works.
113+
114+ The licenses for most software and other practical works are designed
115+to take away your freedom to share and change the works. By contrast,
116+the GNU General Public License is intended to guarantee your freedom to
117+share and change all versions of a program--to make sure it remains free
118+software for all its users. We, the Free Software Foundation, use the
119+GNU General Public License for most of our software; it applies also to
120+any other work released this way by its authors. You can apply it to
121+your programs, too.
122+
123+ When we speak of free software, we are referring to freedom, not
124+price. Our General Public Licenses are designed to make sure that you
125+have the freedom to distribute copies of free software (and charge for
126+them if you wish), that you receive source code or can get it if you
127+want it, that you can change the software or use pieces of it in new
128+free programs, and that you know you can do these things.
129+
130+ To protect your rights, we need to prevent others from denying you
131+these rights or asking you to surrender the rights. Therefore, you have
132+certain responsibilities if you distribute copies of the software, or if
133+you modify it: responsibilities to respect the freedom of others.
134+
135+ For example, if you distribute copies of such a program, whether
136+gratis or for a fee, you must pass on to the recipients the same
137+freedoms that you received. You must make sure that they, too, receive
138+or can get the source code. And you must show them these terms so they
139+know their rights.
140+
141+ Developers that use the GNU GPL protect your rights with two steps:
142+(1) assert copyright on the software, and (2) offer you this License
143+giving you legal permission to copy, distribute and/or modify it.
144+
145+ For the developers' and authors' protection, the GPL clearly explains
146+that there is no warranty for this free software. For both users' and
147+authors' sake, the GPL requires that modified versions be marked as
148+changed, so that their problems will not be attributed erroneously to
149+authors of previous versions.
150+
151+ Some devices are designed to deny users access to install or run
152+modified versions of the software inside them, although the manufacturer
153+can do so. This is fundamentally incompatible with the aim of
154+protecting users' freedom to change the software. The systematic
155+pattern of such abuse occurs in the area of products for individuals to
156+use, which is precisely where it is most unacceptable. Therefore, we
157+have designed this version of the GPL to prohibit the practice for those
158+products. If such problems arise substantially in other domains, we
159+stand ready to extend this provision to those domains in future versions
160+of the GPL, as needed to protect the freedom of users.
161+
162+ Finally, every program is threatened constantly by software patents.
163+States should not allow patents to restrict development and use of
164+software on general-purpose computers, but in those that do, we wish to
165+avoid the special danger that patents applied to a free program could
166+make it effectively proprietary. To prevent this, the GPL assures that
167+patents cannot be used to render the program non-free.
168+
169+ The precise terms and conditions for copying, distribution and
170+modification follow.
171+
172+ TERMS AND CONDITIONS
173+
174+ 0. Definitions.
175+
176+ "This License" refers to version 3 of the GNU General Public License.
177+
178+ "Copyright" also means copyright-like laws that apply to other kinds of
179+works, such as semiconductor masks.
180+
181+ "The Program" refers to any copyrightable work licensed under this
182+License. Each licensee is addressed as "you". "Licensees" and
183+"recipients" may be individuals or organizations.
184+
185+ To "modify" a work means to copy from or adapt all or part of the work
186+in a fashion requiring copyright permission, other than the making of an
187+exact copy. The resulting work is called a "modified version" of the
188+earlier work or a work "based on" the earlier work.
189+
190+ A "covered work" means either the unmodified Program or a work based
191+on the Program.
192+
193+ To "propagate" a work means to do anything with it that, without
194+permission, would make you directly or secondarily liable for
195+infringement under applicable copyright law, except executing it on a
196+computer or modifying a private copy. Propagation includes copying,
197+distribution (with or without modification), making available to the
198+public, and in some countries other activities as well.
199+
200+ To "convey" a work means any kind of propagation that enables other
201+parties to make or receive copies. Mere interaction with a user through
202+a computer network, with no transfer of a copy, is not conveying.
203+
204+ An interactive user interface displays "Appropriate Legal Notices"
205+to the extent that it includes a convenient and prominently visible
206+feature that (1) displays an appropriate copyright notice, and (2)
207+tells the user that there is no warranty for the work (except to the
208+extent that warranties are provided), that licensees may convey the
209+work under this License, and how to view a copy of this License. If
210+the interface presents a list of user commands or options, such as a
211+menu, a prominent item in the list meets this criterion.
212+
213+ 1. Source Code.
214+
215+ The "source code" for a work means the preferred form of the work
216+for making modifications to it. "Object code" means any non-source
217+form of a work.
218+
219+ A "Standard Interface" means an interface that either is an official
220+standard defined by a recognized standards body, or, in the case of
221+interfaces specified for a particular programming language, one that
222+is widely used among developers working in that language.
223+
224+ The "System Libraries" of an executable work include anything, other
225+than the work as a whole, that (a) is included in the normal form of
226+packaging a Major Component, but which is not part of that Major
227+Component, and (b) serves only to enable use of the work with that
228+Major Component, or to implement a Standard Interface for which an
229+implementation is available to the public in source code form. A
230+"Major Component", in this context, means a major essential component
231+(kernel, window system, and so on) of the specific operating system
232+(if any) on which the executable work runs, or a compiler used to
233+produce the work, or an object code interpreter used to run it.
234+
235+ The "Corresponding Source" for a work in object code form means all
236+the source code needed to generate, install, and (for an executable
237+work) run the object code and to modify the work, including scripts to
238+control those activities. However, it does not include the work's
239+System Libraries, or general-purpose tools or generally available free
240+programs which are used unmodified in performing those activities but
241+which are not part of the work. For example, Corresponding Source
242+includes interface definition files associated with source files for
243+the work, and the source code for shared libraries and dynamically
244+linked subprograms that the work is specifically designed to require,
245+such as by intimate data communication or control flow between those
246+subprograms and other parts of the work.
247+
248+ The Corresponding Source need not include anything that users
249+can regenerate automatically from other parts of the Corresponding
250+Source.
251+
252+ The Corresponding Source for a work in source code form is that
253+same work.
254+
255+ 2. Basic Permissions.
256+
257+ All rights granted under this License are granted for the term of
258+copyright on the Program, and are irrevocable provided the stated
259+conditions are met. This License explicitly affirms your unlimited
260+permission to run the unmodified Program. The output from running a
261+covered work is covered by this License only if the output, given its
262+content, constitutes a covered work. This License acknowledges your
263+rights of fair use or other equivalent, as provided by copyright law.
264+
265+ You may make, run and propagate covered works that you do not
266+convey, without conditions so long as your license otherwise remains
267+in force. You may convey covered works to others for the sole purpose
268+of having them make modifications exclusively for you, or provide you
269+with facilities for running those works, provided that you comply with
270+the terms of this License in conveying all material for which you do
271+not control copyright. Those thus making or running the covered works
272+for you must do so exclusively on your behalf, under your direction
273+and control, on terms that prohibit them from making any copies of
274+your copyrighted material outside their relationship with you.
275+
276+ Conveying under any other circumstances is permitted solely under
277+the conditions stated below. Sublicensing is not allowed; section 10
278+makes it unnecessary.
279+
280+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
281+
282+ No covered work shall be deemed part of an effective technological
283+measure under any applicable law fulfilling obligations under article
284+11 of the WIPO copyright treaty adopted on 20 December 1996, or
285+similar laws prohibiting or restricting circumvention of such
286+measures.
287+
288+ When you convey a covered work, you waive any legal power to forbid
289+circumvention of technological measures to the extent such circumvention
290+is effected by exercising rights under this License with respect to
291+the covered work, and you disclaim any intention to limit operation or
292+modification of the work as a means of enforcing, against the work's
293+users, your or third parties' legal rights to forbid circumvention of
294+technological measures.
295+
296+ 4. Conveying Verbatim Copies.
297+
298+ You may convey verbatim copies of the Program's source code as you
299+receive it, in any medium, provided that you conspicuously and
300+appropriately publish on each copy an appropriate copyright notice;
301+keep intact all notices stating that this License and any
302+non-permissive terms added in accord with section 7 apply to the code;
303+keep intact all notices of the absence of any warranty; and give all
304+recipients a copy of this License along with the Program.
305+
306+ You may charge any price or no price for each copy that you convey,
307+and you may offer support or warranty protection for a fee.
308+
309+ 5. Conveying Modified Source Versions.
310+
311+ You may convey a work based on the Program, or the modifications to
312+produce it from the Program, in the form of source code under the
313+terms of section 4, provided that you also meet all of these conditions:
314+
315+ a) The work must carry prominent notices stating that you modified
316+ it, and giving a relevant date.
317+
318+ b) The work must carry prominent notices stating that it is
319+ released under this License and any conditions added under section
320+ 7. This requirement modifies the requirement in section 4 to
321+ "keep intact all notices".
322+
323+ c) You must license the entire work, as a whole, under this
324+ License to anyone who comes into possession of a copy. This
325+ License will therefore apply, along with any applicable section 7
326+ additional terms, to the whole of the work, and all its parts,
327+ regardless of how they are packaged. This License gives no
328+ permission to license the work in any other way, but it does not
329+ invalidate such permission if you have separately received it.
330+
331+ d) If the work has interactive user interfaces, each must display
332+ Appropriate Legal Notices; however, if the Program has interactive
333+ interfaces that do not display Appropriate Legal Notices, your
334+ work need not make them do so.
335+
336+ A compilation of a covered work with other separate and independent
337+works, which are not by their nature extensions of the covered work,
338+and which are not combined with it such as to form a larger program,
339+in or on a volume of a storage or distribution medium, is called an
340+"aggregate" if the compilation and its resulting copyright are not
341+used to limit the access or legal rights of the compilation's users
342+beyond what the individual works permit. Inclusion of a covered work
343+in an aggregate does not cause this License to apply to the other
344+parts of the aggregate.
345+
346+ 6. Conveying Non-Source Forms.
347+
348+ You may convey a covered work in object code form under the terms
349+of sections 4 and 5, provided that you also convey the
350+machine-readable Corresponding Source under the terms of this License,
351+in one of these ways:
352+
353+ a) Convey the object code in, or embodied in, a physical product
354+ (including a physical distribution medium), accompanied by the
355+ Corresponding Source fixed on a durable physical medium
356+ customarily used for software interchange.
357+
358+ b) Convey the object code in, or embodied in, a physical product
359+ (including a physical distribution medium), accompanied by a
360+ written offer, valid for at least three years and valid for as
361+ long as you offer spare parts or customer support for that product
362+ model, to give anyone who possesses the object code either (1) a
363+ copy of the Corresponding Source for all the software in the
364+ product that is covered by this License, on a durable physical
365+ medium customarily used for software interchange, for a price no
366+ more than your reasonable cost of physically performing this
367+ conveying of source, or (2) access to copy the
368+ Corresponding Source from a network server at no charge.
369+
370+ c) Convey individual copies of the object code with a copy of the
371+ written offer to provide the Corresponding Source. This
372+ alternative is allowed only occasionally and noncommercially, and
373+ only if you received the object code with such an offer, in accord
374+ with subsection 6b.
375+
376+ d) Convey the object code by offering access from a designated
377+ place (gratis or for a charge), and offer equivalent access to the
378+ Corresponding Source in the same way through the same place at no
379+ further charge. You need not require recipients to copy the
380+ Corresponding Source along with the object code. If the place to
381+ copy the object code is a network server, the Corresponding Source
382+ may be on a different server (operated by you or a third party)
383+ that supports equivalent copying facilities, provided you maintain
384+ clear directions next to the object code saying where to find the
385+ Corresponding Source. Regardless of what server hosts the
386+ Corresponding Source, you remain obligated to ensure that it is
387+ available for as long as needed to satisfy these requirements.
388+
389+ e) Convey the object code using peer-to-peer transmission, provided
390+ you inform other peers where the object code and Corresponding
391+ Source of the work are being offered to the general public at no
392+ charge under subsection 6d.
393+
394+ A separable portion of the object code, whose source code is excluded
395+from the Corresponding Source as a System Library, need not be
396+included in conveying the object code work.
397+
398+ A "User Product" is either (1) a "consumer product", which means any
399+tangible personal property which is normally used for personal, family,
400+or household purposes, or (2) anything designed or sold for incorporation
401+into a dwelling. In determining whether a product is a consumer product,
402+doubtful cases shall be resolved in favor of coverage. For a particular
403+product received by a particular user, "normally used" refers to a
404+typical or common use of that class of product, regardless of the status
405+of the particular user or of the way in which the particular user
406+actually uses, or expects or is expected to use, the product. A product
407+is a consumer product regardless of whether the product has substantial
408+commercial, industrial or non-consumer uses, unless such uses represent
409+the only significant mode of use of the product.
410+
411+ "Installation Information" for a User Product means any methods,
412+procedures, authorization keys, or other information required to install
413+and execute modified versions of a covered work in that User Product from
414+a modified version of its Corresponding Source. The information must
415+suffice to ensure that the continued functioning of the modified object
416+code is in no case prevented or interfered with solely because
417+modification has been made.
418+
419+ If you convey an object code work under this section in, or with, or
420+specifically for use in, a User Product, and the conveying occurs as
421+part of a transaction in which the right of possession and use of the
422+User Product is transferred to the recipient in perpetuity or for a
423+fixed term (regardless of how the transaction is characterized), the
424+Corresponding Source conveyed under this section must be accompanied
425+by the Installation Information. But this requirement does not apply
426+if neither you nor any third party retains the ability to install
427+modified object code on the User Product (for example, the work has
428+been installed in ROM).
429+
430+ The requirement to provide Installation Information does not include a
431+requirement to continue to provide support service, warranty, or updates
432+for a work that has been modified or installed by the recipient, or for
433+the User Product in which it has been modified or installed. Access to a
434+network may be denied when the modification itself materially and
435+adversely affects the operation of the network or violates the rules and
436+protocols for communication across the network.
437+
438+ Corresponding Source conveyed, and Installation Information provided,
439+in accord with this section must be in a format that is publicly
440+documented (and with an implementation available to the public in
441+source code form), and must require no special password or key for
442+unpacking, reading or copying.
443+
444+ 7. Additional Terms.
445+
446+ "Additional permissions" are terms that supplement the terms of this
447+License by making exceptions from one or more of its conditions.
448+Additional permissions that are applicable to the entire Program shall
449+be treated as though they were included in this License, to the extent
450+that they are valid under applicable law. If additional permissions
451+apply only to part of the Program, that part may be used separately
452+under those permissions, but the entire Program remains governed by
453+this License without regard to the additional permissions.
454+
455+ When you convey a copy of a covered work, you may at your option
456+remove any additional permissions from that copy, or from any part of
457+it. (Additional permissions may be written to require their own
458+removal in certain cases when you modify the work.) You may place
459+additional permissions on material, added by you to a covered work,
460+for which you have or can give appropriate copyright permission.
461+
462+ Notwithstanding any other provision of this License, for material you
463+add to a covered work, you may (if authorized by the copyright holders of
464+that material) supplement the terms of this License with terms:
465+
466+ a) Disclaiming warranty or limiting liability differently from the
467+ terms of sections 15 and 16 of this License; or
468+
469+ b) Requiring preservation of specified reasonable legal notices or
470+ author attributions in that material or in the Appropriate Legal
471+ Notices displayed by works containing it; or
472+
473+ c) Prohibiting misrepresentation of the origin of that material, or
474+ requiring that modified versions of such material be marked in
475+ reasonable ways as different from the original version; or
476+
477+ d) Limiting the use for publicity purposes of names of licensors or
478+ authors of the material; or
479+
480+ e) Declining to grant rights under trademark law for use of some
481+ trade names, trademarks, or service marks; or
482+
483+ f) Requiring indemnification of licensors and authors of that
484+ material by anyone who conveys the material (or modified versions of
485+ it) with contractual assumptions of liability to the recipient, for
486+ any liability that these contractual assumptions directly impose on
487+ those licensors and authors.
488+
489+ All other non-permissive additional terms are considered "further
490+restrictions" within the meaning of section 10. If the Program as you
491+received it, or any part of it, contains a notice stating that it is
492+governed by this License along with a term that is a further
493+restriction, you may remove that term. If a license document contains
494+a further restriction but permits relicensing or conveying under this
495+License, you may add to a covered work material governed by the terms
496+of that license document, provided that the further restriction does
497+not survive such relicensing or conveying.
498+
499+ If you add terms to a covered work in accord with this section, you
500+must place, in the relevant source files, a statement of the
501+additional terms that apply to those files, or a notice indicating
502+where to find the applicable terms.
503+
504+ Additional terms, permissive or non-permissive, may be stated in the
505+form of a separately written license, or stated as exceptions;
506+the above requirements apply either way.
507+
508+ 8. Termination.
509+
510+ You may not propagate or modify a covered work except as expressly
511+provided under this License. Any attempt otherwise to propagate or
512+modify it is void, and will automatically terminate your rights under
513+this License (including any patent licenses granted under the third
514+paragraph of section 11).
515+
516+ However, if you cease all violation of this License, then your
517+license from a particular copyright holder is reinstated (a)
518+provisionally, unless and until the copyright holder explicitly and
519+finally terminates your license, and (b) permanently, if the copyright
520+holder fails to notify you of the violation by some reasonable means
521+prior to 60 days after the cessation.
522+
523+ Moreover, your license from a particular copyright holder is
524+reinstated permanently if the copyright holder notifies you of the
525+violation by some reasonable means, this is the first time you have
526+received notice of violation of this License (for any work) from that
527+copyright holder, and you cure the violation prior to 30 days after
528+your receipt of the notice.
529+
530+ Termination of your rights under this section does not terminate the
531+licenses of parties who have received copies or rights from you under
532+this License. If your rights have been terminated and not permanently
533+reinstated, you do not qualify to receive new licenses for the same
534+material under section 10.
535+
536+ 9. Acceptance Not Required for Having Copies.
537+
538+ You are not required to accept this License in order to receive or
539+run a copy of the Program. Ancillary propagation of a covered work
540+occurring solely as a consequence of using peer-to-peer transmission
541+to receive a copy likewise does not require acceptance. However,
542+nothing other than this License grants you permission to propagate or
543+modify any covered work. These actions infringe copyright if you do
544+not accept this License. Therefore, by modifying or propagating a
545+covered work, you indicate your acceptance of this License to do so.
546+
547+ 10. Automatic Licensing of Downstream Recipients.
548+
549+ Each time you convey a covered work, the recipient automatically
550+receives a license from the original licensors, to run, modify and
551+propagate that work, subject to this License. You are not responsible
552+for enforcing compliance by third parties with this License.
553+
554+ An "entity transaction" is a transaction transferring control of an
555+organization, or substantially all assets of one, or subdividing an
556+organization, or merging organizations. If propagation of a covered
557+work results from an entity transaction, each party to that
558+transaction who receives a copy of the work also receives whatever
559+licenses to the work the party's predecessor in interest had or could
560+give under the previous paragraph, plus a right to possession of the
561+Corresponding Source of the work from the predecessor in interest, if
562+the predecessor has it or can get it with reasonable efforts.
563+
564+ You may not impose any further restrictions on the exercise of the
565+rights granted or affirmed under this License. For example, you may
566+not impose a license fee, royalty, or other charge for exercise of
567+rights granted under this License, and you may not initiate litigation
568+(including a cross-claim or counterclaim in a lawsuit) alleging that
569+any patent claim is infringed by making, using, selling, offering for
570+sale, or importing the Program or any portion of it.
571+
572+ 11. Patents.
573+
574+ A "contributor" is a copyright holder who authorizes use under this
575+License of the Program or a work on which the Program is based. The
576+work thus licensed is called the contributor's "contributor version".
577+
578+ A contributor's "essential patent claims" are all patent claims
579+owned or controlled by the contributor, whether already acquired or
580+hereafter acquired, that would be infringed by some manner, permitted
581+by this License, of making, using, or selling its contributor version,
582+but do not include claims that would be infringed only as a
583+consequence of further modification of the contributor version. For
584+purposes of this definition, "control" includes the right to grant
585+patent sublicenses in a manner consistent with the requirements of
586+this License.
587+
588+ Each contributor grants you a non-exclusive, worldwide, royalty-free
589+patent license under the contributor's essential patent claims, to
590+make, use, sell, offer for sale, import and otherwise run, modify and
591+propagate the contents of its contributor version.
592+
593+ In the following three paragraphs, a "patent license" is any express
594+agreement or commitment, however denominated, not to enforce a patent
595+(such as an express permission to practice a patent or covenant not to
596+sue for patent infringement). To "grant" such a patent license to a
597+party means to make such an agreement or commitment not to enforce a
598+patent against the party.
599+
600+ If you convey a covered work, knowingly relying on a patent license,
601+and the Corresponding Source of the work is not available for anyone
602+to copy, free of charge and under the terms of this License, through a
603+publicly available network server or other readily accessible means,
604+then you must either (1) cause the Corresponding Source to be so
605+available, or (2) arrange to deprive yourself of the benefit of the
606+patent license for this particular work, or (3) arrange, in a manner
607+consistent with the requirements of this License, to extend the patent
608+license to downstream recipients. "Knowingly relying" means you have
609+actual knowledge that, but for the patent license, your conveying the
610+covered work in a country, or your recipient's use of the covered work
611+in a country, would infringe one or more identifiable patents in that
612+country that you have reason to believe are valid.
613+
614+ If, pursuant to or in connection with a single transaction or
615+arrangement, you convey, or propagate by procuring conveyance of, a
616+covered work, and grant a patent license to some of the parties
617+receiving the covered work authorizing them to use, propagate, modify
618+or convey a specific copy of the covered work, then the patent license
619+you grant is automatically extended to all recipients of the covered
620+work and works based on it.
621+
622+ A patent license is "discriminatory" if it does not include within
623+the scope of its coverage, prohibits the exercise of, or is
624+conditioned on the non-exercise of one or more of the rights that are
625+specifically granted under this License. You may not convey a covered
626+work if you are a party to an arrangement with a third party that is
627+in the business of distributing software, under which you make payment
628+to the third party based on the extent of your activity of conveying
629+the work, and under which the third party grants, to any of the
630+parties who would receive the covered work from you, a discriminatory
631+patent license (a) in connection with copies of the covered work
632+conveyed by you (or copies made from those copies), or (b) primarily
633+for and in connection with specific products or compilations that
634+contain the covered work, unless you entered into that arrangement,
635+or that patent license was granted, prior to 28 March 2007.
636+
637+ Nothing in this License shall be construed as excluding or limiting
638+any implied license or other defenses to infringement that may
639+otherwise be available to you under applicable patent law.
640+
641+ 12. No Surrender of Others' Freedom.
642+
643+ If conditions are imposed on you (whether by court order, agreement or
644+otherwise) that contradict the conditions of this License, they do not
645+excuse you from the conditions of this License. If you cannot convey a
646+covered work so as to satisfy simultaneously your obligations under this
647+License and any other pertinent obligations, then as a consequence you may
648+not convey it at all. For example, if you agree to terms that obligate you
649+to collect a royalty for further conveying from those to whom you convey
650+the Program, the only way you could satisfy both those terms and this
651+License would be to refrain entirely from conveying the Program.
652+
653+ 13. Use with the GNU Affero General Public License.
654+
655+ Notwithstanding any other provision of this License, you have
656+permission to link or combine any covered work with a work licensed
657+under version 3 of the GNU Affero General Public License into a single
658+combined work, and to convey the resulting work. The terms of this
659+License will continue to apply to the part which is the covered work,
660+but the special requirements of the GNU Affero General Public License,
661+section 13, concerning interaction through a network will apply to the
662+combination as such.
663+
664+ 14. Revised Versions of this License.
665+
666+ The Free Software Foundation may publish revised and/or new versions of
667+the GNU General Public License from time to time. Such new versions will
668+be similar in spirit to the present version, but may differ in detail to
669+address new problems or concerns.
670+
671+ Each version is given a distinguishing version number. If the
672+Program specifies that a certain numbered version of the GNU General
673+Public License "or any later version" applies to it, you have the
674+option of following the terms and conditions either of that numbered
675+version or of any later version published by the Free Software
676+Foundation. If the Program does not specify a version number of the
677+GNU General Public License, you may choose any version ever published
678+by the Free Software Foundation.
679+
680+ If the Program specifies that a proxy can decide which future
681+versions of the GNU General Public License can be used, that proxy's
682+public statement of acceptance of a version permanently authorizes you
683+to choose that version for the Program.
684+
685+ Later license versions may give you additional or different
686+permissions. However, no additional obligations are imposed on any
687+author or copyright holder as a result of your choosing to follow a
688+later version.
689+
690+ 15. Disclaimer of Warranty.
691+
692+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
693+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
694+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
695+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
696+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
697+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
698+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
699+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
700+
701+ 16. Limitation of Liability.
702+
703+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
704+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
705+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
706+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
707+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
708+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
709+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
710+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
711+SUCH DAMAGES.
712+
713+ 17. Interpretation of Sections 15 and 16.
714+
715+ If the disclaimer of warranty and limitation of liability provided
716+above cannot be given local legal effect according to their terms,
717+reviewing courts shall apply local law that most closely approximates
718+an absolute waiver of all civil liability in connection with the
719+Program, unless a warranty or assumption of liability accompanies a
720+copy of the Program in return for a fee.
721+
722+ END OF TERMS AND CONDITIONS
723+
724+ How to Apply These Terms to Your New Programs
725+
726+ If you develop a new program, and you want it to be of the greatest
727+possible use to the public, the best way to achieve this is to make it
728+free software which everyone can redistribute and change under these terms.
729+
730+ To do so, attach the following notices to the program. It is safest
731+to attach them to the start of each source file to most effectively
732+state the exclusion of warranty; and each file should have at least
733+the "copyright" line and a pointer to where the full notice is found.
734+
735+ <one line to give the program's name and a brief idea of what it does.>
736+ Copyright (C) <year> <name of author>
737+
738+ This program is free software: you can redistribute it and/or modify
739+ it under the terms of the GNU General Public License as published by
740+ the Free Software Foundation, either version 3 of the License, or
741+ (at your option) any later version.
742+
743+ This program is distributed in the hope that it will be useful,
744+ but WITHOUT ANY WARRANTY; without even the implied warranty of
745+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
746+ GNU General Public License for more details.
747+
748+ You should have received a copy of the GNU General Public License
749+ along with this program. If not, see <http://www.gnu.org/licenses/>.
750+
751+Also add information on how to contact you by electronic and paper mail.
752+
753+ If the program does terminal interaction, make it output a short
754+notice like this when it starts in an interactive mode:
755+
756+ <program> Copyright (C) <year> <name of author>
757+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
758+ This is free software, and you are welcome to redistribute it
759+ under certain conditions; type `show c' for details.
760+
761+The hypothetical commands `show w' and `show c' should show the appropriate
762+parts of the General Public License. Of course, your program's commands
763+might be different; for a GUI interface, you would use an "about box".
764+
765+ You should also get your employer (if you work as a programmer) or school,
766+if any, to sign a "copyright disclaimer" for the program, if necessary.
767+For more information on this, and how to apply and follow the GNU GPL, see
768+<http://www.gnu.org/licenses/>.
769+
770+ The GNU General Public License does not permit incorporating your program
771+into proprietary programs. If your program is a subroutine library, you
772+may consider it more useful to permit linking proprietary applications with
773+the library. If this is what you want to do, use the GNU Lesser General
774+Public License instead of this License. But first, please read
775+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
776
777=== renamed file 'COPYING' => 'COPYING.moved'
778=== added file 'README'
779--- README 1970-01-01 00:00:00 +0000
780+++ README 2014-08-12 22:08:22 +0000
781@@ -0,0 +1,9 @@
782+Ubuntu Clock App is the official clock app for Ubuntu Touch.
783+
784+Here are some useful links with regards to the Clock App development.
785+
786+Clock App Wiki - https://wiki.ubuntu.com/Touch/CoreApps/Clock
787+Designs - https://drive.google.com/#folders/0B55Gs35e-jxxNzRzOHVxbmNDbFU
788+Trello Board - https://trello.com/b/Ie2rAS3W/core-apps-management
789+Project page - https://launchpad.net/ubuntu-clock-app
790+
791
792=== added file 'README.autopilot'
793--- README.autopilot 1970-01-01 00:00:00 +0000
794+++ README.autopilot 2014-08-12 22:08:22 +0000
795@@ -0,0 +1,45 @@
796+# Running Autopilot tests
797+
798+Ubuntu Clock App follows a test driven development where autopilot tests are run before every merge into trunk. If you are submitting your bugfix/patch to the clock app, please follow the following steps below to ensure that all tests pass before proposing a merge request.
799+
800+If you are looking for more info about Autopilot or writing AP tests for the clock app, here are some useful links to help you,
801+
802+- http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot/
803+- http://developer.ubuntu.com/api/devel/ubuntu-14.10/python/autopilot-emulator/
804+
805+## Prerequisites
806+
807+Install the following autopilot packages required to run the tests,
808+$ sudo apt-get install python-autopilot libautopilot-qt ubuntu-ui-toolkit-autopilot python3-autopilot-vis
809+
810+
811+#### Running tests on the desktop
812+
813+Using terminal:
814+
815+1. Branch the clock app code,
816+ $ bzr branch lp:ubuntu-clock-app/reboot
817+
818+2. Navigate to the tests/autopilot directory.
819+ $ cd ubuntu-clock-app/reboot/tests/autopilot
820+
821+3. run all tests.
822+ $ autopilot3 run -vv ubuntu_clock_app
823+
824+ to list all tests:
825+ $ autopilot3 list ubuntu_clock_app
826+
827+ To run only one test (for instance: test_add_single_type_alarm_must_add_to_alarm_list in TestAlarm.py):
828+ $ autopilot3 run -vv ubuntu_clock_app.tests.test_alarm.TestAlarm.test_add_single_type_alarm_must_add_to_alarm_list
829+
830+ Debugging tests using autopilot vis
831+ $ autopilot3 launch -i Qt qmlscene ../../app/ubuntu-clock-app.qml -I ../../builddir/backend/
832+ $ autopilot3 vis
833+
834+
835+#### Running tests on device or emulator:
836+
837+Using autopkg:
838+
839+1. navigate to the directory where the ubuntu-clock-app branch is and run:
840+ $ adt-run ubuntu-clock-app --click=com.ubuntu.clock.devel --- ssh -s adb
841
842=== added file 'README.developers'
843--- README.developers 1970-01-01 00:00:00 +0000
844+++ README.developers 2014-08-12 22:08:22 +0000
845@@ -0,0 +1,28 @@
846+Building and running on Utopic Desktop (14.10)
847+==============================================
848+
849+1. Branch the code as usual and navigate to it.
850+ bzr branch lp:ubuntu-clock-app/reboot && cd reboot
851+2. Create a build dir and navigate to it.
852+ mkdir builddir && cd builddir
853+3. Build the clock app
854+ cmake .. && make
855+4. Run the clock app
856+ QML2_IMPORT_PATH=backend/ qmlscene ../app/ubuntu-clock-app.qml
857+
858+Code Style
859+==========
860+
861+We are trying to use a common code style throughout the code base to maintain
862+uniformity and improve code clarity. Listed below are the code styles guides
863+that will be followed based on the language used.
864+
865+QML - http://qt-project.org/doc/qt-5/qml-codingconventions.html
866+JS, C++ - https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
867+Python - Code should follow PEP8 and Flake regulations
868+
869+Note: In the QML code convention, ignore the Javascript code section guidelines.
870+So the sections that should be taken into account in the QML conventions are QML
871+Object Declarations, Grouped Properties and Lists.
872+
873+
874
875=== renamed file 'README' => 'README.moved'
876=== added directory 'app'
877=== added file 'app/CMakeLists.txt'
878--- app/CMakeLists.txt 1970-01-01 00:00:00 +0000
879+++ app/CMakeLists.txt 2014-08-12 22:08:22 +0000
880@@ -0,0 +1,24 @@
881+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
882+add_custom_target(ubuntu-clock-app_QMlFiles ALL SOURCES ${QML_JS_FILES})
883+endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
884+
885+
886+if(CLICK_MODE)
887+ set(ICON "${ICON}@30.png")
888+ install(FILES ${ICON} DESTINATION ${CMAKE_INSTALL_PREFIX})
889+endif(CLICK_MODE)
890+
891+# substitute variables in the desktop file
892+set(DESKTOP_FILE "ubuntu-clock-app.desktop")
893+configure_file(${DESKTOP_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE})
894+
895+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}
896+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
897+install(FILES ${MAIN_QML} DESTINATION ${UBUNTU-CLOCK_APP_DIR})
898+
899+add_subdirectory(clock)
900+add_subdirectory(alarm)
901+add_subdirectory(graphics)
902+add_subdirectory(components)
903+add_subdirectory(worldclock)
904+add_subdirectory(upstreamcomponents)
905
906=== added directory 'app/alarm'
907=== added file 'app/alarm/AlarmDelegate.qml'
908--- app/alarm/AlarmDelegate.qml 1970-01-01 00:00:00 +0000
909+++ app/alarm/AlarmDelegate.qml 2014-08-12 22:08:22 +0000
910@@ -0,0 +1,95 @@
911+/*
912+ * Copyright (C) 2014 Canonical Ltd
913+ *
914+ * This file is part of Ubuntu Clock App
915+ *
916+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
917+ * it under the terms of the GNU General Public License version 3 as
918+ * published by the Free Software Foundation.
919+ *
920+ * Ubuntu Clock App is distributed in the hope that it will be useful,
921+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
922+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
923+ * GNU General Public License for more details.
924+ *
925+ * You should have received a copy of the GNU General Public License
926+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
927+ */
928+
929+import QtQuick 2.0
930+import Ubuntu.Components 1.1
931+import "../upstreamcomponents"
932+
933+ListItemWithActions {
934+ id: root
935+
936+ width: parent ? parent.width : 0
937+ height: units.gu(6)
938+ color: "Transparent"
939+ selectedColor: "Transparent"
940+
941+ Label {
942+ id: alarmTime
943+ objectName: "listAlarmTime" + index
944+
945+ anchors {
946+ top: alarmDetailsColumn.top
947+ left: parent.left
948+ }
949+
950+ fontSize: "medium"
951+ text: Qt.formatTime(date)
952+ }
953+
954+ Column {
955+ id: alarmDetailsColumn
956+
957+ anchors {
958+ left: alarmTime.right
959+ right: alarmStatus.left
960+ verticalCenter: parent.verticalCenter
961+ margins: units.gu(1)
962+ }
963+
964+ Label {
965+ id: alarmLabel
966+ objectName: "listAlarmLabel" + index
967+
968+ text: message
969+ fontSize: "medium"
970+ width: parent.width
971+ elide: Text.ElideRight
972+ color: UbuntuColors.midAubergine
973+ }
974+
975+ Label {
976+ id: alarmSubtitle
977+ objectName: "listAlarmSubtitle" + index
978+
979+ fontSize: "xx-small"
980+ width: parent.width
981+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
982+ text: alarmUtils.format_day_string(daysOfWeek)
983+ }
984+ }
985+
986+ Switch {
987+ id: alarmStatus
988+ objectName: "listAlarmStatus" + index
989+
990+ anchors {
991+ right: parent.right
992+ verticalCenter: parent.verticalCenter
993+ }
994+
995+ checked: enabled
996+
997+ /*
998+ #TODO: Add the ability to enable/disable alarms using the
999+ switch. At the moment it only shows the alarm status.
1000+ This was postponed since a similar implementation in the
1001+ old clock app caused it to loop. So if user clicks on the
1002+ switch, it disables and then re-enables the alarm again.
1003+ */
1004+ }
1005+}
1006
1007=== added file 'app/alarm/AlarmLabel.qml'
1008--- app/alarm/AlarmLabel.qml 1970-01-01 00:00:00 +0000
1009+++ app/alarm/AlarmLabel.qml 2014-08-12 22:08:22 +0000
1010@@ -0,0 +1,65 @@
1011+/*
1012+ * Copyright (C) 2014 Canonical Ltd
1013+ *
1014+ * This file is part of Ubuntu Clock App
1015+ *
1016+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1017+ * it under the terms of the GNU General Public License version 3 as
1018+ * published by the Free Software Foundation.
1019+ *
1020+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1021+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1022+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1023+ * GNU General Public License for more details.
1024+ *
1025+ * You should have received a copy of the GNU General Public License
1026+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1027+ */
1028+
1029+import QtQuick 2.0
1030+import Ubuntu.Components 1.1
1031+
1032+Page {
1033+ id: _alarmLabelPage
1034+ objectName: "alarmLabelPage"
1035+
1036+ visible: false
1037+ title: i18n.tr("Label")
1038+
1039+ // Property to set the alarm label in the edit alarm page
1040+ property var alarm
1041+
1042+ Column {
1043+ id: _labelColumn
1044+
1045+ spacing: units.gu(0.5)
1046+
1047+ anchors {
1048+ fill: parent
1049+ margins: units.gu(2)
1050+ }
1051+
1052+ Label {
1053+ text: i18n.tr("Label")
1054+ }
1055+
1056+ TextField {
1057+ id: _labelEntry
1058+ objectName: "labelEntry"
1059+ text: alarm.message
1060+ width: parent.width
1061+ }
1062+ }
1063+
1064+ tools: ToolbarItems {
1065+ back: Button {
1066+ action: Action {
1067+ iconName: "back"
1068+ onTriggered: {
1069+ alarm.message = _labelEntry.text
1070+ mainStack.pop()
1071+ }
1072+ }
1073+ }
1074+ }
1075+}
1076
1077=== added file 'app/alarm/AlarmList.qml'
1078--- app/alarm/AlarmList.qml 1970-01-01 00:00:00 +0000
1079+++ app/alarm/AlarmList.qml 2014-08-12 22:08:22 +0000
1080@@ -0,0 +1,147 @@
1081+/*
1082+ * Copyright (C) 2014 Canonical Ltd
1083+ *
1084+ * This file is part of Ubuntu Clock App
1085+ *
1086+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1087+ * it under the terms of the GNU General Public License version 3 as
1088+ * published by the Free Software Foundation.
1089+ *
1090+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1091+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1092+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1093+ * GNU General Public License for more details.
1094+ *
1095+ * You should have received a copy of the GNU General Public License
1096+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1097+ */
1098+
1099+import QtQuick 2.0
1100+import Ubuntu.Components 1.1
1101+import Ubuntu.Components.ListItems 1.0 as ListItem
1102+import "../components"
1103+import "../upstreamcomponents"
1104+import "../components/Utils.js" as Utils
1105+
1106+MultipleSelectionListView {
1107+ id: alarmListView
1108+ objectName: "alarmListView"
1109+
1110+ property var _currentSwipedItem: null
1111+
1112+ function _updateSwipeState(item)
1113+ {
1114+ if (item.swipping) {
1115+ return
1116+ }
1117+
1118+ if (item.swipeState !== "Normal") {
1119+ if (alarmListView._currentSwipedItem !== item) {
1120+ if (alarmListView._currentSwipedItem) {
1121+ alarmListView._currentSwipedItem.resetSwipe()
1122+ }
1123+ alarmListView._currentSwipedItem = item
1124+ }
1125+ } else if (item.swipeState !== "Normal"
1126+ && alarmListView._currentSwipedItem === item) {
1127+ alarmListView._currentSwipedItem = null
1128+ }
1129+ }
1130+
1131+ clip: true
1132+ anchors.fill: parent
1133+
1134+ AlarmUtils {
1135+ id: alarmUtils
1136+ }
1137+
1138+ listDelegate: AlarmDelegate {
1139+ id: alarmDelegate
1140+ objectName: "alarm" + index
1141+
1142+ property var removalAnimation
1143+
1144+ function remove() {
1145+ removalAnimation.start()
1146+ }
1147+
1148+ selectionMode: alarmListView.isInSelectionMode
1149+ selected: alarmListView.isSelected(alarmDelegate)
1150+
1151+ onSwippingChanged: {
1152+ _updateSwipeState(alarmDelegate)
1153+ }
1154+
1155+ onSwipeStateChanged: {
1156+ _updateSwipeState(alarmDelegate)
1157+ }
1158+
1159+ leftSideAction: Action {
1160+ iconName: "delete"
1161+ text: i18n.tr("Delete")
1162+ onTriggered: {
1163+ alarmDelegate.remove()
1164+ }
1165+ }
1166+
1167+ ListView.onRemove: ScriptAction {
1168+ script: {
1169+ if (_currentSwipedItem
1170+ === alarmDelegate) {
1171+ _currentSwipedItem = null
1172+ }
1173+ }
1174+ }
1175+
1176+ removalAnimation: SequentialAnimation {
1177+ alwaysRunToEnd: true
1178+
1179+ PropertyAction {
1180+ target: alarmDelegate
1181+ property: "ListView.delayRemove"
1182+ value: true
1183+ }
1184+
1185+ UbuntuNumberAnimation {
1186+ target: alarmDelegate
1187+ property: "height"
1188+ to: 0
1189+ }
1190+
1191+ PropertyAction {
1192+ target: alarmDelegate
1193+ property: "ListView.delayRemove"
1194+ value: false
1195+ }
1196+
1197+ ScriptAction {
1198+ script: {
1199+ var alarm = alarmModel.get(index)
1200+ alarm.cancel()
1201+ }
1202+ }
1203+ }
1204+
1205+ onItemClicked: {
1206+ if(alarmListView.isInSelectionMode) {
1207+ if(!alarmListView.selectItem(alarmDelegate)) {
1208+ alarmListView.deselectItem(alarmDelegate)
1209+ }
1210+ return
1211+ }
1212+
1213+ else {
1214+ mainStack.push(Qt.resolvedUrl("EditAlarmPage.qml"),
1215+ {"isNewAlarm": false, "alarmIndex": index})
1216+ }
1217+ }
1218+
1219+ onItemPressAndHold: {
1220+ if (!alarmListView.isInSelectionMode) {
1221+ alarmListView.startSelection()
1222+ alarmListView.selectItem(alarmDelegate)
1223+ }
1224+ }
1225+ }
1226+}
1227+
1228
1229=== added file 'app/alarm/AlarmPage.qml'
1230--- app/alarm/AlarmPage.qml 1970-01-01 00:00:00 +0000
1231+++ app/alarm/AlarmPage.qml 2014-08-12 22:08:22 +0000
1232@@ -0,0 +1,104 @@
1233+/*
1234+ * Copyright (C) 2014 Canonical Ltd
1235+ *
1236+ * This file is part of Ubuntu Clock App
1237+ *
1238+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1239+ * it under the terms of the GNU General Public License version 3 as
1240+ * published by the Free Software Foundation.
1241+ *
1242+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1243+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1244+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1245+ * GNU General Public License for more details.
1246+ *
1247+ * You should have received a copy of the GNU General Public License
1248+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1249+ */
1250+
1251+import QtQuick 2.0
1252+import Ubuntu.Components 1.1
1253+import "../components/Utils.js" as Utils
1254+
1255+Page {
1256+ id: alarmPage
1257+
1258+ title: i18n.tr("Alarms")
1259+ objectName: 'AlarmPage'
1260+
1261+ Component.onCompleted: Utils.log(debugMode, "Alarm Page loaded")
1262+
1263+ flickable: null
1264+
1265+ states: [
1266+ PageHeadState {
1267+ name: "default"
1268+ head: alarmPage.head
1269+ when: !alarmListView.isInSelectionMode
1270+ actions: [
1271+ Action {
1272+ objectName: "addAlarmAction"
1273+ iconName: "add"
1274+ text: i18n.tr("Alarm")
1275+ onTriggered: {
1276+ mainStack.push(Qt.resolvedUrl("EditAlarmPage.qml"))
1277+ }
1278+ }
1279+ ]
1280+ },
1281+
1282+ PageHeadState {
1283+ name: "selection"
1284+ head: alarmPage.head
1285+ when: alarmListView.isInSelectionMode
1286+ backAction: Action {
1287+ text: i18n.tr("Cancel selection")
1288+ iconName: "close"
1289+ onTriggered: {
1290+ alarmListView.cancelSelection()
1291+ }
1292+ }
1293+
1294+ actions: [
1295+ Action {
1296+ text: i18n.tr("Select All")
1297+ iconName: "select"
1298+ onTriggered: {
1299+ if(alarmListView.selectedItems.count
1300+ === alarmListView.count) {
1301+ alarmListView.clearSelection()
1302+ }
1303+ else {
1304+ alarmListView.selectAll()
1305+ }
1306+ }
1307+ },
1308+
1309+ Action {
1310+ text: i18n.tr("Delete")
1311+ iconName: "delete"
1312+ onTriggered: {
1313+ var items = alarmListView.selectedItems
1314+
1315+ for(var i=0; i < items.count; i++) {
1316+ var alarm = alarmModel.get(items.get(i).itemsIndex)
1317+ alarm.cancel()
1318+ }
1319+
1320+ alarmListView.endSelection()
1321+ }
1322+ }
1323+ ]
1324+
1325+ contents: Label {
1326+ text: ""
1327+ }
1328+ }
1329+ ]
1330+
1331+ AlarmList{
1332+ id: alarmListView
1333+ listModel: alarmModel
1334+ anchors.fill: parent
1335+ }
1336+}
1337
1338=== added file 'app/alarm/AlarmRepeat.qml'
1339--- app/alarm/AlarmRepeat.qml 1970-01-01 00:00:00 +0000
1340+++ app/alarm/AlarmRepeat.qml 2014-08-12 22:08:22 +0000
1341@@ -0,0 +1,114 @@
1342+/*
1343+ * Copyright (C) 2014 Canonical Ltd
1344+ *
1345+ * This file is part of Ubuntu Clock App
1346+ *
1347+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1348+ * it under the terms of the GNU General Public License version 3 as
1349+ * published by the Free Software Foundation.
1350+ *
1351+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1352+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1353+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1354+ * GNU General Public License for more details.
1355+ *
1356+ * You should have received a copy of the GNU General Public License
1357+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1358+ */
1359+
1360+import QtQuick 2.0
1361+import Ubuntu.Components 1.1
1362+import Ubuntu.Components.ListItems 1.0 as ListItem
1363+
1364+Page {
1365+ id: _alarmRepeatPage
1366+ objectName: "alarmRepeatPage"
1367+
1368+ visible: false
1369+ title: i18n.tr("Repeat")
1370+
1371+ // Property to set the alarm days of the week in the edit alarm page
1372+ property var alarm
1373+
1374+ ListModel {
1375+ id: daysModel
1376+
1377+ ListElement {
1378+ day: "1"
1379+ flag: Alarm.Monday
1380+ }
1381+
1382+ ListElement {
1383+ day: "2"
1384+ flag: Alarm.Tuesday
1385+ }
1386+
1387+ ListElement {
1388+ day: "3"
1389+ flag: Alarm.Wednesday
1390+ }
1391+
1392+ ListElement {
1393+ day: "4"
1394+ flag: Alarm.Thursday
1395+ }
1396+
1397+ ListElement {
1398+ day: "5"
1399+ flag: Alarm.Friday
1400+ }
1401+
1402+ ListElement {
1403+ day: "6"
1404+ flag: Alarm.Saturday
1405+ }
1406+
1407+ ListElement {
1408+ day: "0"
1409+ flag: Alarm.Sunday
1410+ }
1411+ }
1412+
1413+ Column {
1414+ id: _alarmDayColumn
1415+
1416+ anchors.fill: parent
1417+
1418+ Repeater {
1419+ id: _alarmDays
1420+ objectName: 'alarmDays'
1421+
1422+ model: daysModel
1423+
1424+ ListItem.Standard {
1425+ Label {
1426+ id: _alarmDay
1427+ objectName: 'alarmDay' + index
1428+
1429+ anchors {
1430+ left: parent.left
1431+ leftMargin: units.gu(2)
1432+ verticalCenter: parent.verticalCenter
1433+ }
1434+
1435+ color: UbuntuColors.midAubergine
1436+ text: Qt.locale().standaloneDayName(day, Locale.LongFormat)
1437+ }
1438+
1439+ control: Switch {
1440+ objectName: 'daySwitch' + index
1441+ checked: (alarm.daysOfWeek & flag) == flag
1442+ onCheckedChanged: {
1443+ if (checked) {
1444+ alarm.daysOfWeek |= flag
1445+ }
1446+
1447+ else {
1448+ alarm.daysOfWeek &= ~flag
1449+ }
1450+ }
1451+ }
1452+ }
1453+ }
1454+ }
1455+}
1456
1457=== added file 'app/alarm/AlarmSettingsPage.qml'
1458--- app/alarm/AlarmSettingsPage.qml 1970-01-01 00:00:00 +0000
1459+++ app/alarm/AlarmSettingsPage.qml 2014-08-12 22:08:22 +0000
1460@@ -0,0 +1,231 @@
1461+/*
1462+ * Copyright (C) 2014 Canonical Ltd
1463+ *
1464+ * This file is part of Ubuntu Clock App
1465+ *
1466+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1467+ * it under the terms of the GNU General Public License version 3 as
1468+ * published by the Free Software Foundation.
1469+ *
1470+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1471+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1472+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1473+ * GNU General Public License for more details.
1474+ *
1475+ * You should have received a copy of the GNU General Public License
1476+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1477+ */
1478+
1479+import QtQuick 2.0
1480+import DateTime 1.0
1481+import Alarm.Settings 1.0
1482+import Ubuntu.Components 1.1
1483+import Ubuntu.Components.ListItems 1.0 as ListItem
1484+import "../components"
1485+
1486+Page {
1487+ id: _alarmSettings
1488+
1489+ title: i18n.tr("Settings")
1490+ visible: false
1491+
1492+ Connections {
1493+ target: clockApp
1494+ onApplicationStateChanged: {
1495+ localTimeSource.update()
1496+ }
1497+ }
1498+
1499+ DateTime {
1500+ id: localTimeSource
1501+ }
1502+
1503+ AlarmSettings {
1504+ id: alarmSettings
1505+ }
1506+
1507+ ListModel {
1508+ id: durationModel
1509+ ListElement {
1510+ duration: 10
1511+ }
1512+
1513+ ListElement {
1514+ duration: 20
1515+ }
1516+
1517+ ListElement {
1518+ duration: 30
1519+ }
1520+
1521+ ListElement {
1522+ duration: 60
1523+ }
1524+
1525+ function title(index) {
1526+ if (title["text"] === undefined) {
1527+ title.text =
1528+ [
1529+ i18n.tr("%1 minutes").arg(10),
1530+ i18n.tr("%1 minutes").arg(20),
1531+ i18n.tr("%1 minutes").arg(30),
1532+ i18n.tr("%1 minutes").arg(60)
1533+ ]
1534+ }
1535+ return title.text[index]
1536+ }
1537+ }
1538+
1539+ Column {
1540+ id: _settingsColumn
1541+
1542+ anchors.fill: parent
1543+
1544+ ListItem.Base {
1545+ Column {
1546+ width: parent.width
1547+ height: childrenRect.height
1548+ anchors.verticalCenter: parent.verticalCenter
1549+
1550+ Label {
1551+ color: UbuntuColors.midAubergine
1552+ text: i18n.tr("Alarm volume")
1553+ }
1554+
1555+ Slider {
1556+ id: _volumeSlider
1557+
1558+ height: units.gu(2)
1559+ width: parent.width
1560+
1561+ minimumValue: 1
1562+ maximumValue: 100
1563+ value: alarmSettings.volume
1564+
1565+ onValueChanged: {
1566+ alarmSettings.volume = formatValue(value)
1567+ }
1568+ }
1569+ }
1570+ }
1571+
1572+ ListItem.Expandable {
1573+ id: _alarmDuration
1574+
1575+ anchors {
1576+ left: parent.left
1577+ right: parent.right
1578+ margins: units.gu(-2)
1579+ }
1580+
1581+ collapseOnClick: true
1582+ expandedHeight: _contentColumn.height + units.gu(1)
1583+
1584+ Column {
1585+ id: _contentColumn
1586+ width: parent.width
1587+
1588+ Item {
1589+ width: parent.width
1590+ height: _alarmDuration.collapsedHeight
1591+
1592+ SubtitledListItem {
1593+ id: _header
1594+ text: i18n.tr("Silence after")
1595+ subText: i18n.tr("%1 minutes").arg(alarmSettings.duration)
1596+ onClicked: _alarmDuration.expanded = true
1597+
1598+ Icon {
1599+ id: _upArrow
1600+
1601+ width: units.gu(2)
1602+ height: width
1603+ anchors.right: parent.right
1604+ anchors.verticalCenter: parent.verticalCenter
1605+
1606+ name: "go-down"
1607+ color: "Grey"
1608+ rotation: _alarmDuration.expanded ? 180 : 0
1609+
1610+ Behavior on rotation {
1611+ UbuntuNumberAnimation {}
1612+ }
1613+ }
1614+ }
1615+ }
1616+
1617+ ListView {
1618+ id: _resultsList
1619+ clip: true
1620+ model: durationModel
1621+ width: parent.width
1622+ height: units.gu(24)
1623+ delegate: ListItem.Standard {
1624+ text: _resultsList.model.title(index)
1625+ onClicked: {
1626+ alarmSettings.duration = duration
1627+ _alarmDuration.expanded = false
1628+ }
1629+ }
1630+ }
1631+ }
1632+ }
1633+
1634+ ListItem.Base {
1635+ Label {
1636+ text: i18n.tr("Vibration")
1637+ color: UbuntuColors.midAubergine
1638+ anchors.verticalCenter: parent.verticalCenter
1639+ }
1640+
1641+ Switch {
1642+ id: vibrateSwitch
1643+
1644+ anchors {
1645+ right: parent.right
1646+ verticalCenter: parent.verticalCenter
1647+ }
1648+
1649+ checked: alarmSettings.vibration === "pulse"
1650+ onCheckedChanged: {
1651+ if(checked) {
1652+ alarmSettings.vibration = "pulse"
1653+ } else {
1654+ alarmSettings.vibration = "none"
1655+ }
1656+ }
1657+ }
1658+
1659+ onClicked: {
1660+ vibrateSwitch.checked = !vibrateSwitch.checked
1661+ }
1662+ }
1663+
1664+ SubtitledListItem {
1665+ text: i18n.tr("Change time and date")
1666+ subText: {
1667+ /*
1668+ FIXME: When the upstream QT bug at
1669+ https://bugreports.qt-project.org/browse/QTBUG-40275 is fixed
1670+ it will be possible to receive a datetime object directly
1671+ instead of using this hack.
1672+ */
1673+ var localTime = new Date
1674+ (
1675+ localTimeSource.localDateString.split(":")[0],
1676+ localTimeSource.localDateString.split(":")[1]-1,
1677+ localTimeSource.localDateString.split(":")[2],
1678+ localTimeSource.localTimeString.split(":")[0],
1679+ localTimeSource.localTimeString.split(":")[1],
1680+ localTimeSource.localTimeString.split(":")[2],
1681+ localTimeSource.localTimeString.split(":")[3]
1682+ )
1683+ return localTime.toLocaleString()
1684+ }
1685+
1686+ onClicked: {
1687+ Qt.openUrlExternally("settings:///system/time-date")
1688+ }
1689+ }
1690+ }
1691+}
1692
1693=== added file 'app/alarm/AlarmSound.qml'
1694--- app/alarm/AlarmSound.qml 1970-01-01 00:00:00 +0000
1695+++ app/alarm/AlarmSound.qml 2014-08-12 22:08:22 +0000
1696@@ -0,0 +1,120 @@
1697+/*
1698+ * Copyright (C) 2014 Canonical Ltd
1699+ *
1700+ * This file is part of Ubuntu Clock App
1701+ *
1702+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1703+ * it under the terms of the GNU General Public License version 3 as
1704+ * published by the Free Software Foundation.
1705+ *
1706+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1707+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1708+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1709+ * GNU General Public License for more details.
1710+ *
1711+ * You should have received a copy of the GNU General Public License
1712+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1713+ */
1714+
1715+import QtQuick 2.0
1716+import Ubuntu.Components 1.1
1717+import Qt.labs.folderlistmodel 2.1
1718+import Ubuntu.Components.ListItems 1.0 as ListItem
1719+
1720+Page {
1721+ id: _alarmSoundPage
1722+
1723+ title: i18n.tr("Sound")
1724+ flickable: _pageFlickable
1725+ visible: false
1726+
1727+ // Property to set the alarm sound in the edit alarm page
1728+ property var alarmSound
1729+
1730+ FolderListModel {
1731+ id: _soundModel
1732+ showDirs: false
1733+ nameFilters: [ "*.ogg", "*.mp3" ]
1734+ folder: "/usr/share/sounds/ubuntu/ringtones"
1735+ }
1736+
1737+ Flickable {
1738+ id: _pageFlickable
1739+
1740+ clip: true
1741+ anchors.fill: parent
1742+ contentHeight: _soundModel.count * units.gu(7)
1743+
1744+ Column {
1745+ id: _alarmSoundColumn
1746+
1747+ anchors.fill: parent
1748+
1749+ Repeater {
1750+ id: _alarmSounds
1751+ objectName: "alarmSounds"
1752+
1753+ model: _soundModel
1754+
1755+ ListItem.Base {
1756+ id: _alarmSoundDelegate
1757+
1758+ property alias isChecked: _soundStatus.checked
1759+
1760+ height: units.gu(7)
1761+
1762+ Label {
1763+ id: _soundName
1764+ objectName: "soundName" + index
1765+
1766+ anchors {
1767+ left: parent.left
1768+ verticalCenter: parent.verticalCenter
1769+ }
1770+
1771+ color: UbuntuColors.midAubergine
1772+ fontSize: "medium"
1773+ text: fileBaseName
1774+ }
1775+
1776+ CheckBox {
1777+ id: _soundStatus
1778+ objectName: "soundStatus" + index
1779+
1780+ anchors {
1781+ right: parent.right
1782+ verticalCenter: parent.verticalCenter
1783+ }
1784+
1785+ checked: alarmSound.subText === _soundName.text ? true :
1786+ false
1787+ onClicked: {
1788+ if (checked) {
1789+ alarmSound.subText = _soundName.text
1790+
1791+ // Ensures only one alarm sound is selected
1792+ for(var i=0; i<_soundModel.count; i++) {
1793+ if(_alarmSounds.itemAt(i).isChecked &&
1794+ i !== index) {
1795+ _alarmSounds.itemAt(i).isChecked = false
1796+ }
1797+ }
1798+ }
1799+ }
1800+ }
1801+ }
1802+ }
1803+ }
1804+ }
1805+
1806+ tools: ToolbarItems {
1807+ back: Button {
1808+ action: Action {
1809+ iconName: "back"
1810+ onTriggered: {
1811+ mainStack.pop()
1812+ }
1813+ }
1814+ }
1815+ }
1816+}
1817
1818=== added file 'app/alarm/AlarmUtils.qml'
1819--- app/alarm/AlarmUtils.qml 1970-01-01 00:00:00 +0000
1820+++ app/alarm/AlarmUtils.qml 2014-08-12 22:08:22 +0000
1821@@ -0,0 +1,138 @@
1822+/*
1823+ * Copyright (C) 2014 Canonical Ltd
1824+ *
1825+ * This file is part of Ubuntu Clock App
1826+ *
1827+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1828+ * it under the terms of the GNU General Public License version 3 as
1829+ * published by the Free Software Foundation.
1830+ *
1831+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1832+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1833+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1834+ * GNU General Public License for more details.
1835+ *
1836+ * You should have received a copy of the GNU General Public License
1837+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1838+ */
1839+
1840+import QtQuick 2.0
1841+import Ubuntu.Components 1.1
1842+
1843+/*
1844+ Qt Object containing a collection of useful alarm functions
1845+*/
1846+QtObject {
1847+ id: alarmUtils
1848+
1849+ // Function to format the alarm days accordingly to their occurance
1850+ function format_day_string(value) {
1851+ var occurs = _get_day(value)
1852+
1853+ if (value === _get_weekdays()) {
1854+ return i18n.tr("Weekdays")
1855+ }
1856+
1857+ else if (value === _get_weekends()) {
1858+ return i18n.tr("Weekends")
1859+ }
1860+
1861+ else if (value === Alarm.Daily) {
1862+ return i18n.tr("Daily")
1863+ }
1864+
1865+ else {
1866+ return occurs
1867+ }
1868+ }
1869+
1870+ /*
1871+ INTERNAL FUNCTIONS
1872+ */
1873+
1874+ // Function to determine the locale's weekdays value
1875+ function _get_weekdays() {
1876+ var weekDays = 0
1877+ for (var i = 0; i < Qt.locale().weekDays.length; ++i) {
1878+ switch (Qt.locale().weekDays[i]) {
1879+ case Qt.Monday: {
1880+ weekDays |= Alarm.Monday
1881+ break
1882+ }
1883+
1884+ case Qt.Tuesday: {
1885+ weekDays |= Alarm.Tuesday
1886+ break
1887+ }
1888+
1889+ case Qt.Wednesday: {
1890+ weekDays |= Alarm.Wednesday
1891+ break
1892+ }
1893+
1894+ case Qt.Thursday: {
1895+ weekDays |= Alarm.Thursday
1896+ break
1897+ }
1898+
1899+ case Qt.Friday: {
1900+ weekDays |= Alarm.Friday
1901+ break
1902+ }
1903+
1904+ case Qt.Saturday: {
1905+ weekDays |= Alarm.Saturday
1906+ break
1907+ }
1908+
1909+ case Qt.Sunday: {
1910+ weekDays |= Alarm.Sunday
1911+ break
1912+ }
1913+ }
1914+ }
1915+ return weekDays
1916+ }
1917+
1918+ // Function to determine the locale's weekends value
1919+ function _get_weekends() {
1920+ return (Alarm.Daily - _get_weekdays())
1921+ }
1922+
1923+ // Function to retrieve the days of the week in the locale system
1924+ function _get_day(value) {
1925+ var occurs = []
1926+
1927+ if (value & Alarm.Monday) {
1928+ occurs.push(Qt.locale().standaloneDayName(1, Locale.LongFormat))
1929+ }
1930+
1931+ if (value & Alarm.Tuesday) {
1932+ occurs.push(Qt.locale().standaloneDayName(2, Locale.LongFormat))
1933+ }
1934+
1935+ if (value & Alarm.Wednesday) {
1936+ occurs.push(Qt.locale().standaloneDayName(3, Locale.LongFormat))
1937+ }
1938+
1939+ if (value & Alarm.Thursday) {
1940+ occurs.push(Qt.locale().standaloneDayName(4, Locale.LongFormat))
1941+ }
1942+
1943+ if (value & Alarm.Friday) {
1944+ occurs.push(Qt.locale().standaloneDayName(5, Locale.LongFormat))
1945+ }
1946+
1947+ if (value & Alarm.Saturday) {
1948+ occurs.push(Qt.locale().standaloneDayName(6, Locale.LongFormat))
1949+ }
1950+
1951+ if (value & Alarm.Sunday) {
1952+ occurs.push(Qt.locale().standaloneDayName(0, Locale.LongFormat))
1953+ }
1954+
1955+ occurs = occurs.join(', ');
1956+
1957+ return occurs;
1958+ }
1959+}
1960
1961=== added file 'app/alarm/CMakeLists.txt'
1962--- app/alarm/CMakeLists.txt 1970-01-01 00:00:00 +0000
1963+++ app/alarm/CMakeLists.txt 2014-08-12 22:08:22 +0000
1964@@ -0,0 +1,6 @@
1965+file(GLOB ALARM_QML_JS_FILES *.qml *.js)
1966+
1967+# make the files visible in the qtcreator tree
1968+add_custom_target(ubuntu-clock-app_alarm_QMlFiles ALL SOURCES ${ALARM_QML_JS_FILES})
1969+
1970+install(FILES ${ALARM_QML_JS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/alarm)
1971
1972=== added file 'app/alarm/EditAlarmPage.qml'
1973--- app/alarm/EditAlarmPage.qml 1970-01-01 00:00:00 +0000
1974+++ app/alarm/EditAlarmPage.qml 2014-08-12 22:08:22 +0000
1975@@ -0,0 +1,261 @@
1976+/*
1977+ * Copyright (C) 2014 Canonical Ltd
1978+ *
1979+ * This file is part of Ubuntu Clock App
1980+ *
1981+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
1982+ * it under the terms of the GNU General Public License version 3 as
1983+ * published by the Free Software Foundation.
1984+ *
1985+ * Ubuntu Clock App is distributed in the hope that it will be useful,
1986+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1987+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1988+ * GNU General Public License for more details.
1989+ *
1990+ * You should have received a copy of the GNU General Public License
1991+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1992+ */
1993+
1994+import QtQuick 2.0
1995+import DateTime 1.0
1996+import Ubuntu.Components 1.1
1997+import Ubuntu.Components.Pickers 1.0
1998+import Ubuntu.Components.ListItems 1.0 as ListItem
1999+import "../components"
2000+import "../components/Utils.js" as Utils
2001+
2002+Page {
2003+ id: _addAlarmPage
2004+ objectName: "AddAlarmPage"
2005+
2006+ // Property to determine if this is a new/saved alarm
2007+ property bool isNewAlarm: true
2008+
2009+ // Property to store the index of the alarm to be edited
2010+ property int alarmIndex
2011+
2012+ property var tempAlarm
2013+
2014+ title: isNewAlarm ? i18n.tr("New alarm") : i18n.tr("Edit alarm")
2015+ visible: false
2016+
2017+ head {
2018+ backAction: Action {
2019+ iconName: "close"
2020+ onTriggered: {
2021+ mainStack.pop()
2022+ }
2023+ }
2024+
2025+ actions: Action {
2026+ iconName: "ok"
2027+ objectName: "saveAlarmAction"
2028+ text: i18n.tr("Alarm")
2029+ onTriggered: {
2030+ if(isNewAlarm) {
2031+ saveNewAlarm()
2032+ }
2033+ else {
2034+ updateAlarm()
2035+ }
2036+ }
2037+ }
2038+ }
2039+
2040+ Component.onCompleted: {
2041+ if(!isNewAlarm) {
2042+ readAlarm()
2043+ }
2044+ }
2045+
2046+ // Function to save a new alarm
2047+ function saveNewAlarm() {
2048+ var alarmTime = new Date()
2049+ alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0)
2050+
2051+ _alarm.message = _alarmLabel.subText
2052+ _alarm.date = alarmTime
2053+ _alarm.type = Alarm.Repeating
2054+ _alarm.enabled = true
2055+ _alarm.save()
2056+ }
2057+
2058+ // Function to read a saved alarm
2059+ function readAlarm() {
2060+ tempAlarm = alarmModel.get(alarmIndex)
2061+
2062+ _alarm.message = tempAlarm.message
2063+ _alarm.type = tempAlarm.type
2064+ _alarm.daysOfWeek = tempAlarm.daysOfWeek
2065+ _alarm.enabled = tempAlarm.enabled
2066+ _alarm.date = tempAlarm.date
2067+ }
2068+
2069+ // Function to delete a saved alarm
2070+ function deleteAlarm() {
2071+ tempAlarm = alarmModel.get(alarmIndex)
2072+ tempAlarm.cancel()
2073+
2074+ if(validateAlarm(tempAlarm)) {
2075+ mainStack.pop()
2076+ }
2077+ }
2078+
2079+ // Function to update a saved alarm
2080+ function updateAlarm() {
2081+ tempAlarm = alarmModel.get(alarmIndex)
2082+
2083+ var alarmTime = new Date()
2084+ alarmTime.setHours(_timePicker.hours, _timePicker.minutes, 0)
2085+
2086+ tempAlarm.message = _alarm.message
2087+ tempAlarm.date = alarmTime
2088+ tempAlarm.type = Alarm.Repeating
2089+ tempAlarm.enabled = _alarm.enabled
2090+
2091+ /*
2092+ #FIXME: Sometimes the clock app crashes due to this code. Cause not
2093+ known yet! This has been reported at http://pad.lv/1337405.
2094+ */
2095+ tempAlarm.daysOfWeek = _alarm.daysOfWeek
2096+
2097+ tempAlarm.save()
2098+
2099+ if(validateAlarm(tempAlarm)) {
2100+ mainStack.pop()
2101+ }
2102+ }
2103+
2104+ // Function to validate if the alarm was saved properly
2105+ function validateAlarm(alarmObject) {
2106+ if (alarmObject.error !== Alarm.NoError) {
2107+ Utils.log(debugMode, "Error saving alarm, code: " + alarmObject.error)
2108+ return false
2109+ }
2110+ else {
2111+ return true
2112+ }
2113+ }
2114+
2115+ Alarm {
2116+ id: _alarm
2117+ onStatusChanged: {
2118+ if (status !== Alarm.Ready)
2119+ return;
2120+ if ((operation > Alarm.NoOperation) &&
2121+ (operation < Alarm.Reseting)) {
2122+ mainStack.pop();
2123+ }
2124+ }
2125+ onDaysOfWeekChanged: {
2126+ _alarmRepeat.subText = alarmUtils.format_day_string(_alarm.daysOfWeek)
2127+ }
2128+ onDateChanged: {
2129+ _timePicker.date = _alarm.date
2130+ }
2131+ }
2132+
2133+ AlarmUtils {
2134+ id: alarmUtils
2135+ }
2136+
2137+ Column {
2138+ id: _alarmColumn
2139+
2140+ width: parent.width
2141+ anchors.top: parent.top
2142+
2143+ DatePicker {
2144+ id: _timePicker
2145+
2146+ /*
2147+ #FIXME: DatePicker does not respect the user's locale. The bug
2148+ has been reported at http://pad.lv/1338138
2149+ */
2150+
2151+ anchors {
2152+ left: parent.left
2153+ right: parent.right
2154+ margins: units.gu(-2)
2155+ }
2156+
2157+ clip: true
2158+ mode: "Hours|Minutes"
2159+ date: {
2160+ if(isNewAlarm) {
2161+ return new Date
2162+ (
2163+ currentTime.localDateString.split(":")[0],
2164+ currentTime.localDateString.split(":")[1]-1,
2165+ currentTime.localDateString.split(":")[2],
2166+ currentTime.localTimeString.split(":")[0],
2167+ Math.ceil(Math.abs(currentTime.localTimeString
2168+ .split(":")[1]/5))*5,
2169+ 0,
2170+ 0
2171+ )
2172+ }
2173+ }
2174+
2175+ DateTime {
2176+ id: currentTime
2177+ updateInterval: 0
2178+ }
2179+ }
2180+
2181+ SubtitledListItem {
2182+ id: _alarmRepeat
2183+ objectName: "alarmRepeat"
2184+
2185+ text: i18n.tr("Repeat")
2186+ subText: alarmUtils.format_day_string(_alarm.daysOfWeek)
2187+ onClicked: mainStack.push(Qt.resolvedUrl("AlarmRepeat.qml"),
2188+ {"alarm": _alarm})
2189+ }
2190+
2191+ SubtitledListItem {
2192+ id: _alarmLabel
2193+ objectName: "alarmLabel"
2194+
2195+ text: i18n.tr("Label")
2196+ subText: _alarm.message
2197+ onClicked: mainStack.push(Qt.resolvedUrl("AlarmLabel.qml"),
2198+ {"alarm": _alarm})
2199+ }
2200+
2201+ SubtitledListItem {
2202+ id: _alarmSound
2203+ objectName: "alarmSound"
2204+ /*
2205+ #TODO: Add support for choosing new alarm sound when indicator-
2206+ datetime supports custom alarm sounds
2207+ */
2208+ text: i18n.tr("Sound (disabled)")
2209+ subText: "Suru arpeggio"
2210+ onClicked: mainStack.push(Qt.resolvedUrl("AlarmSound.qml"),
2211+ {"alarmSound": _alarmSound})
2212+ }
2213+ }
2214+
2215+ Button {
2216+ id: _deleteAlarmButton
2217+
2218+ anchors {
2219+ top: _alarmColumn.bottom
2220+ topMargin: units.gu(3)
2221+ horizontalCenter: parent.horizontalCenter
2222+ }
2223+
2224+ width: units.gu(17)
2225+ height: units.gu(4)
2226+
2227+ visible: !isNewAlarm
2228+
2229+ color: "Red"
2230+ text: i18n.tr("Delete alarm")
2231+
2232+ onClicked: {
2233+ _addAlarmPage.deleteAlarm()
2234+ }
2235+ }
2236+}
2237
2238=== added directory 'app/clock'
2239=== added file 'app/clock-app@30.png'
2240Binary files app/clock-app@30.png 1970-01-01 00:00:00 +0000 and app/clock-app@30.png 2014-08-12 22:08:22 +0000 differ
2241=== added file 'app/clock/CMakeLists.txt'
2242--- app/clock/CMakeLists.txt 1970-01-01 00:00:00 +0000
2243+++ app/clock/CMakeLists.txt 2014-08-12 22:08:22 +0000
2244@@ -0,0 +1,6 @@
2245+file(GLOB CLOCK_QML_JS_FILES *.qml *.js)
2246+
2247+# make the files visible in the qtcreator tree
2248+add_custom_target(ubuntu-clock-app_clock_QMlFiles ALL SOURCES ${CLOCK_QML_JS_FILES})
2249+
2250+install(FILES ${CLOCK_QML_JS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/clock)
2251
2252=== added file 'app/clock/ClockPage.qml'
2253--- app/clock/ClockPage.qml 1970-01-01 00:00:00 +0000
2254+++ app/clock/ClockPage.qml 2014-08-12 22:08:22 +0000
2255@@ -0,0 +1,197 @@
2256+/*
2257+ * Copyright (C) 2014 Canonical Ltd
2258+ *
2259+ * This file is part of Ubuntu Clock App
2260+ *
2261+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2262+ * it under the terms of the GNU General Public License version 3 as
2263+ * published by the Free Software Foundation.
2264+ *
2265+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2266+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2267+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2268+ * GNU General Public License for more details.
2269+ *
2270+ * You should have received a copy of the GNU General Public License
2271+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2272+ */
2273+
2274+import QtQuick 2.0
2275+import U1db 1.0 as U1db
2276+import Ubuntu.Components 1.1
2277+import "../components"
2278+import "../upstreamcomponents"
2279+import "../worldclock"
2280+import "../components/Utils.js" as Utils
2281+
2282+PageWithBottomEdge {
2283+ id: _clockPage
2284+ objectName: "clockPage"
2285+
2286+ /*
2287+ Property to set the minimum drag distance before activating the add
2288+ city signal
2289+ */
2290+ property int _minThreshold: addCityButton.maxThreshold + units.gu(2)
2291+
2292+ // Property to keep track of the clock mode
2293+ property alias isDigital: clock.isDigital
2294+
2295+ flickable: null
2296+
2297+ Component.onCompleted: Utils.log(debugMode, "Clock Page loaded")
2298+
2299+ Flickable {
2300+ id: _flickable
2301+
2302+ Component.onCompleted: otherElementsStartUpAnimation.start()
2303+
2304+ anchors.fill: parent
2305+ contentWidth: parent.width
2306+ contentHeight: clock.height + date.height + locationRow.height
2307+ + worldCityColumn.height + units.gu(14)
2308+
2309+ PullToAdd {
2310+ id: addCityButton
2311+ objectName: "addCityButton"
2312+
2313+ anchors {
2314+ top: parent.top
2315+ topMargin: -labelHeight - units.gu(3)
2316+ horizontalCenter: parent.horizontalCenter
2317+ }
2318+
2319+ leftLabel: i18n.tr("Add")
2320+ rightLabel: i18n.tr("City")
2321+ }
2322+
2323+ AbstractButton {
2324+ id: settingsIcon
2325+ objectName: "settingsIcon"
2326+
2327+ onClicked: {
2328+ mainStack.push(Qt.resolvedUrl("../alarm/AlarmSettingsPage.qml"))
2329+ }
2330+
2331+ width: units.gu(3)
2332+ height: width
2333+ opacity: 0
2334+
2335+ anchors {
2336+ top: parent.top
2337+ topMargin: units.gu(6)
2338+ right: parent.right
2339+ rightMargin: units.gu(2)
2340+ }
2341+
2342+ Icon {
2343+ anchors.fill: parent
2344+ name: "settings"
2345+ color: "Grey"
2346+ }
2347+ }
2348+
2349+ MainClock {
2350+ id: clock
2351+ objectName: "clock"
2352+
2353+ anchors {
2354+ verticalCenter: parent.top
2355+ verticalCenterOffset: units.gu(20)
2356+ horizontalCenter: parent.horizontalCenter
2357+ }
2358+ }
2359+
2360+ Label {
2361+ id: date
2362+
2363+ anchors {
2364+ top: parent.top
2365+ topMargin: units.gu(36)
2366+ horizontalCenter: parent.horizontalCenter
2367+ }
2368+
2369+ text: clock.analogTime.toLocaleDateString()
2370+ opacity: settingsIcon.opacity
2371+ fontSize: "xx-small"
2372+ }
2373+
2374+ Row {
2375+ id: locationRow
2376+ objectName: "locationRow"
2377+
2378+ opacity: settingsIcon.opacity
2379+ spacing: units.gu(1)
2380+
2381+ anchors {
2382+ top: date.bottom
2383+ topMargin: units.gu(1)
2384+ horizontalCenter: parent.horizontalCenter
2385+ }
2386+
2387+ Image {
2388+ id: locationIcon
2389+ source: "../graphics/Location_Pin.png"
2390+ width: units.gu(1.2)
2391+ height: units.gu(2.2)
2392+ }
2393+
2394+ Label {
2395+ id: location
2396+ objectName: "location"
2397+ text: "Location"
2398+ fontSize: "medium"
2399+ anchors.verticalCenter: locationIcon.verticalCenter
2400+ color: UbuntuColors.midAubergine
2401+ }
2402+ }
2403+
2404+ UserWorldCityList {
2405+ id: worldCityColumn
2406+ objectName: "worldCityColumn"
2407+ opacity: settingsIcon.opacity
2408+ anchors.top: locationRow.bottom
2409+ anchors.topMargin: units.gu(4)
2410+ }
2411+
2412+ onDragEnded: {
2413+ if(contentY < _minThreshold) {
2414+ mainStack.push(Qt.resolvedUrl("../worldclock/WorldCityList.qml"))
2415+ }
2416+ }
2417+
2418+ onContentYChanged: {
2419+ if(contentY < 0 && atYBeginning) {
2420+ addCityButton.dragPosition = contentY.toFixed(0)
2421+ }
2422+ }
2423+
2424+ ParallelAnimation {
2425+ id: otherElementsStartUpAnimation
2426+
2427+ PropertyAnimation {
2428+ target: settingsIcon
2429+ property: "anchors.topMargin"
2430+ from: units.gu(6)
2431+ to: units.gu(2)
2432+ duration: 900
2433+ }
2434+
2435+ PropertyAnimation {
2436+ target: settingsIcon
2437+ property: "opacity"
2438+ from: 0
2439+ to: 1
2440+ duration: 900
2441+ }
2442+
2443+ PropertyAnimation {
2444+ target: date
2445+ property: "anchors.topMargin"
2446+ from: units.gu(36)
2447+ to: units.gu(40)
2448+ duration: 900
2449+ }
2450+ }
2451+ }
2452+}
2453
2454=== added file 'app/clock/MainClock.qml'
2455--- app/clock/MainClock.qml 1970-01-01 00:00:00 +0000
2456+++ app/clock/MainClock.qml 2014-08-12 22:08:22 +0000
2457@@ -0,0 +1,131 @@
2458+/*
2459+ * Copyright (C) 2014 Canonical Ltd
2460+ *
2461+ * This file is part of Ubuntu Clock App
2462+ *
2463+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2464+ * it under the terms of the GNU General Public License version 3 as
2465+ * published by the Free Software Foundation.
2466+ *
2467+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2468+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2469+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2470+ * GNU General Public License for more details.
2471+ *
2472+ * You should have received a copy of the GNU General Public License
2473+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2474+ */
2475+
2476+import QtQuick 2.0
2477+import DateTime 1.0
2478+import Ubuntu.Components 1.1
2479+import "../components"
2480+
2481+Clock {
2482+ id: mainClock
2483+
2484+ fontSize: units.dp(62)
2485+ periodFontSize: units.dp(12)
2486+ innerCircleWidth: units.gu(23)
2487+
2488+ isMainClock: true
2489+
2490+ Connections {
2491+ target: clockApp
2492+ onApplicationStateChanged: {
2493+ localTimeSource.update()
2494+ }
2495+ }
2496+
2497+ DateTime {
2498+ id: localTimeSource
2499+ updateInterval: isDigital ? 1000 : 10
2500+ }
2501+
2502+ /*
2503+ Create a new Date() object and pass the date, month, year, hour, minute
2504+ and second received from the DateTime plugin manually to ensure the
2505+ timezone info is set correctly.
2506+
2507+ Javascript Month is 0-11 while QDateTime month is 1-12. Hence the -1
2508+ is required.
2509+ */
2510+
2511+ /*
2512+ FIXME: When the upstream QT bug at
2513+ https://bugreports.qt-project.org/browse/QTBUG-40275 is fixed it will be
2514+ possible to receive a datetime object directly instead of using this hack.
2515+ */
2516+ analogTime: new Date
2517+ (
2518+ localTimeSource.localDateString.split(":")[0],
2519+ localTimeSource.localDateString.split(":")[1]-1,
2520+ localTimeSource.localDateString.split(":")[2],
2521+ localTimeSource.localTimeString.split(":")[0],
2522+ localTimeSource.localTimeString.split(":")[1],
2523+ localTimeSource.localTimeString.split(":")[2],
2524+ localTimeSource.localTimeString.split(":")[3]
2525+ )
2526+ time: Qt.formatTime(analogTime)
2527+
2528+ isDigital: clockModeDocument.contents.digitalMode ? true : false
2529+
2530+ Component.onCompleted: {
2531+ clockOpenAnimation.start()
2532+ }
2533+
2534+ /*
2535+ The clockOpenAnimation is only executed once when the clock app is
2536+ opened.
2537+ */
2538+ SequentialAnimation {
2539+ id: clockOpenAnimation
2540+
2541+ /*
2542+ On startup, first ensure that the correct mode is loaded into memory,
2543+ and then only proceed to start the startup animation.
2544+ */
2545+
2546+ ScriptAction {
2547+ script: {
2548+ if (isDigital) {
2549+ digitalModeLoader.setSource
2550+ ("../components/DigitalMode.qml",
2551+ {
2552+ "maxWidth": innerCircleWidth,
2553+ "maxTimeFontSize": fontSize,
2554+ "maxPeriodFontSize": periodFontSize,
2555+ })
2556+ }
2557+ else {
2558+ analogModeLoader.setSource
2559+ ("../components/AnalogMode.qml",
2560+ {
2561+ "maxWidth": innerCircleWidth,
2562+ "showSeconds": isMainClock
2563+ })
2564+ }
2565+ }
2566+ }
2567+
2568+ ParallelAnimation {
2569+ PropertyAnimation {
2570+ target: mainClock
2571+ property: "width"
2572+ to: units.gu(32)
2573+ duration: 900
2574+ }
2575+
2576+ ScriptAction {
2577+ script: {
2578+ if (isDigital) {
2579+ digitalModeLoader.item.startAnimation()
2580+ }
2581+ else {
2582+ analogModeLoader.item.startAnimation()
2583+ }
2584+ }
2585+ }
2586+ }
2587+ }
2588+}
2589
2590=== added directory 'app/components'
2591=== added file 'app/components/AnalogMode.qml'
2592--- app/components/AnalogMode.qml 1970-01-01 00:00:00 +0000
2593+++ app/components/AnalogMode.qml 2014-08-12 22:08:22 +0000
2594@@ -0,0 +1,102 @@
2595+/*
2596+ * Copyright (C) 2014 Canonical Ltd
2597+ *
2598+ * This file is part of Ubuntu Clock App
2599+ *
2600+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2601+ * it under the terms of the GNU General Public License version 3 as
2602+ * published by the Free Software Foundation.
2603+ *
2604+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2605+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2606+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2607+ * GNU General Public License for more details.
2608+ *
2609+ * You should have received a copy of the GNU General Public License
2610+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2611+ */
2612+
2613+import QtQuick 2.0
2614+import Ubuntu.Components 1.1
2615+
2616+ClockCircle {
2617+ id: _innerCircleAnalog
2618+
2619+ // Property to set the max width when running the animation
2620+ property int maxWidth
2621+
2622+ // Property to show/hide the seconds hand
2623+ property bool showSeconds
2624+
2625+ function startAnimation() {
2626+ _animationTimer.start()
2627+ }
2628+
2629+ width: units.gu(0)
2630+
2631+ Timer {
2632+ id: _animationTimer
2633+ interval: 200
2634+ repeat: false
2635+ onTriggered: _innerCircleAnimation.start()
2636+ }
2637+
2638+ Image {
2639+ id: hourHand
2640+
2641+ z: minuteHand.z + 1
2642+ width: parent.width
2643+ anchors.centerIn: parent
2644+
2645+ smooth: true
2646+ source: "../graphics/Hour_Hand.png"
2647+ fillMode: Image.PreserveAspectFit
2648+ rotation: (analogTime.getHours() * 30) + (analogTime.getMinutes() / 2)
2649+ }
2650+
2651+ Image {
2652+ id: minuteHand
2653+
2654+ width: parent.width
2655+ anchors.centerIn: parent
2656+
2657+ smooth: true
2658+ source: "../graphics/Minute_Hand.png"
2659+ fillMode: Image.PreserveAspectFit
2660+ rotation: (analogTime.getMinutes() * 6) + (analogTime.getSeconds() / 10)
2661+ }
2662+
2663+ Image {
2664+ id: secondHand
2665+
2666+ anchors.centerIn: parent
2667+ width: parent.width + units.gu(2)
2668+
2669+ smooth: true
2670+ visible: showSeconds
2671+ source: "../graphics/Second_Hand.png"
2672+ fillMode: Image.PreserveAspectFit
2673+ rotation: visible ? ((360 * ((analogTime.getSeconds() * 1000) +
2674+ analogTime.getMilliseconds())) / 60000) : 0
2675+ }
2676+
2677+ Image {
2678+ id: center
2679+
2680+ z: hourHand.z + 1
2681+ width: parent.width
2682+ anchors.centerIn: parent
2683+
2684+ fillMode: Image.PreserveAspectFit
2685+ source: "../graphics/Knob.png"
2686+ }
2687+
2688+ PropertyAnimation {
2689+ id: _innerCircleAnimation
2690+ target: _innerCircleAnalog
2691+ property: "width"
2692+ from: units.gu(0)
2693+ to: maxWidth
2694+ duration: 900
2695+ }
2696+}
2697
2698=== added file 'app/components/AnalogShadow.qml'
2699--- app/components/AnalogShadow.qml 1970-01-01 00:00:00 +0000
2700+++ app/components/AnalogShadow.qml 2014-08-12 22:08:22 +0000
2701@@ -0,0 +1,83 @@
2702+/*
2703+ * Copyright (C) 2014 Canonical Ltd
2704+ *
2705+ * This file is part of Ubuntu Clock App
2706+ *
2707+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2708+ * it under the terms of the GNU General Public License version 3 as
2709+ * published by the Free Software Foundation.
2710+ *
2711+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2712+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2713+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2714+ * GNU General Public License for more details.
2715+ *
2716+ * You should have received a copy of the GNU General Public License
2717+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2718+ */
2719+
2720+import QtQuick 2.0
2721+import Ubuntu.Components 1.1
2722+
2723+Flipable {
2724+ id: analogShadow
2725+
2726+ // Properties to set the size of the analog shadow
2727+ property int shadowWidth
2728+ property int shadowTimeFontSize
2729+ property int shadowPeriodFontSize
2730+
2731+ // Property to disable the seconds hand
2732+ property alias showSeconds: _analogMode.showSeconds
2733+
2734+ // Property to switch between digital and analog mode
2735+ property bool isDigital: false
2736+
2737+ width: shadowWidth
2738+ height: width/2
2739+ clip: true
2740+
2741+ front: AnalogMode {
2742+ id: _analogMode
2743+
2744+ width: shadowWidth
2745+ anchors.bottom: parent.bottom
2746+ anchors.horizontalCenter: parent.horizontalCenter
2747+ }
2748+
2749+ back: DigitalMode {
2750+ id: _digitalMode
2751+
2752+ width: shadowWidth
2753+ timeFontSize: shadowTimeFontSize
2754+ timePeriodFontSize: shadowPeriodFontSize
2755+
2756+ anchors.bottom: parent.bottom
2757+ anchors.horizontalCenter: parent.horizontalCenter
2758+ }
2759+
2760+ transform: Rotation {
2761+ id: rotation
2762+ origin.x: analogShadow.width/2
2763+ origin.y: 0
2764+ axis.x: 1; axis.y: 0; axis.z: 0
2765+ angle: 0
2766+ }
2767+
2768+ states: State {
2769+ name: "Digital"
2770+ when: analogShadow.isDigital
2771+ PropertyChanges {
2772+ target: rotation
2773+ angle: -180
2774+ }
2775+ }
2776+
2777+ transitions: Transition {
2778+ NumberAnimation {
2779+ target: rotation
2780+ property: "angle"
2781+ duration: 666
2782+ }
2783+ }
2784+}
2785
2786=== added file 'app/components/Background.qml'
2787--- app/components/Background.qml 1970-01-01 00:00:00 +0000
2788+++ app/components/Background.qml 2014-08-12 22:08:22 +0000
2789@@ -0,0 +1,31 @@
2790+/*
2791+ * Copyright (C) 2014 Canonical Ltd
2792+ *
2793+ * This file is part of Ubuntu Clock App
2794+ *
2795+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2796+ * it under the terms of the GNU General Public License version 3 as
2797+ * published by the Free Software Foundation.
2798+ *
2799+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2800+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2801+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2802+ * GNU General Public License for more details.
2803+ *
2804+ * You should have received a copy of the GNU General Public License
2805+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2806+ */
2807+
2808+import QtQuick 2.2
2809+import Ubuntu.Components 1.1
2810+
2811+/*
2812+ Component to set the background of the app
2813+ */
2814+
2815+Image {
2816+ id: _background
2817+
2818+ anchors.fill: parent
2819+ source: "../graphics/Background_Texture.jpg"
2820+}
2821
2822=== added file 'app/components/CMakeLists.txt'
2823--- app/components/CMakeLists.txt 1970-01-01 00:00:00 +0000
2824+++ app/components/CMakeLists.txt 2014-08-12 22:08:22 +0000
2825@@ -0,0 +1,6 @@
2826+file(GLOB COMPONENTS_QML_JS_FILES *.qml *.js)
2827+
2828+# make the files visible in the qtcreator tree
2829+add_custom_target(ubuntu-clock-app_components_QMlFiles ALL SOURCES ${COMPONENTS_QML_JS_FILES})
2830+
2831+install(FILES ${COMPONENTS_QML_JS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/components)
2832
2833=== added file 'app/components/Clock.qml'
2834--- app/components/Clock.qml 1970-01-01 00:00:00 +0000
2835+++ app/components/Clock.qml 2014-08-12 22:08:22 +0000
2836@@ -0,0 +1,254 @@
2837+/*
2838+ * Copyright (C) 2014 Canonical Ltd
2839+ *
2840+ * This file is part of Ubuntu Clock App
2841+ *
2842+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
2843+ * it under the terms of the GNU General Public License version 3 as
2844+ * published by the Free Software Foundation.
2845+ *
2846+ * Ubuntu Clock App is distributed in the hope that it will be useful,
2847+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2848+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2849+ * GNU General Public License for more details.
2850+ *
2851+ * You should have received a copy of the GNU General Public License
2852+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2853+ */
2854+
2855+import QtQuick 2.0
2856+import Ubuntu.Components 1.1
2857+import "Utils.js" as Utils
2858+
2859+/*
2860+ Generic clock component which has a digital and analog mode. A flip animation
2861+ is shown when switching clock modes. This components is used by the main
2862+ clock and the world clock list items.
2863+
2864+ The component follows a parent-child model where certain functions are
2865+ available only if used by a parent. You can set parent using the isMainClock
2866+ variable. Some functions which are provided only to the parent are listed
2867+ below,
2868+
2869+ - Ability to switch clock modes by tapping on the center. As per design, only
2870+ main clock app should allow switching mode by tapping at the center
2871+
2872+ - Modify the user preference settings document to reflect the currently chosen
2873+ clock mode. We don't want every child element modifying the file unnecessarily
2874+
2875+ - Disable the clock hand in the child elements (world clock) as per the design
2876+ spec.
2877+*/
2878+ClockCircle {
2879+ id: _outerCircle
2880+
2881+ // Property to set the analog time
2882+ property var analogTime
2883+
2884+ // Property to set the digital time label
2885+ property string time: Qt.formatTime(analogTime)
2886+
2887+ // Property to keep track of the clock mode
2888+ property alias isDigital: clockModeFlipable.isDigital
2889+
2890+ // Properties to set the dimension of the clock like the font size, width etc
2891+ property int fontSize
2892+ property int periodFontSize
2893+ property int innerCircleWidth
2894+
2895+ // Property to set if the component is the parent or the child
2896+ property bool isMainClock: false
2897+
2898+ // Properties to expose the analog and digital modes
2899+ property alias digitalModeLoader: _digitalModeLoader
2900+ property alias analogModeLoader: _analogModeLoader
2901+
2902+ // Signal which is triggered whenever the flip animation is started
2903+ signal triggerFlip();
2904+
2905+ function flipClock() {
2906+ clockFlipAnimation.start()
2907+ }
2908+
2909+ // Sets the style to outer circle
2910+ isOuter: true
2911+
2912+ Shadow {
2913+ id: upperShadow
2914+ rotation: 0
2915+ width: innerCircleWidth - units.gu(0.5)
2916+ z: clockModeFlipable.z + 2
2917+ anchors.centerIn: clockModeFlipable
2918+ anchors.verticalCenterOffset: -width/4
2919+ }
2920+
2921+ Shadow {
2922+ id: bottomShadow
2923+ rotation: 180
2924+ width: upperShadow.width
2925+ z: clockModeFlipable.z + 2
2926+ anchors.centerIn: clockModeFlipable
2927+ anchors.verticalCenterOffset: width/4
2928+ }
2929+
2930+ Loader {
2931+ id: analogShadow
2932+ z: clockModeFlipable.isDigital ? clockModeFlipable.z + 1
2933+ : clockModeFlipable.z + 3
2934+ anchors.horizontalCenter: parent.horizontalCenter
2935+ anchors.bottom: clockModeFlipable.bottom
2936+ }
2937+
2938+ Loader {
2939+ id: digitalShadow
2940+ z: clockModeFlipable.isDigital ? clockModeFlipable.z + 3
2941+ : clockModeFlipable.z + 1
2942+ anchors.horizontalCenter: parent.horizontalCenter
2943+ anchors.bottom: clockModeFlipable.bottom
2944+ }
2945+
2946+ Flipable {
2947+ id: clockModeFlipable
2948+
2949+ // Property to switch between digital and analog mode
2950+ property bool isDigital: false
2951+
2952+ width: innerCircleWidth
2953+ height: width
2954+ anchors.centerIn: parent
2955+
2956+ front: Loader {
2957+ id: _analogModeLoader
2958+ anchors.centerIn: parent
2959+ }
2960+
2961+ back: Loader {
2962+ id: _digitalModeLoader
2963+ anchors.centerIn: parent
2964+ }
2965+
2966+ transform: Rotation {
2967+ id: rotation
2968+ origin.x: clockModeFlipable.width/2
2969+ origin.y: clockModeFlipable.height/2
2970+ axis.x: 1; axis.y: 0; axis.z: 0
2971+ angle: 0
2972+ }
2973+
2974+ states: State {
2975+ name: "Digital"
2976+ when: clockModeFlipable.isDigital
2977+ PropertyChanges {
2978+ target: rotation
2979+ angle: 180
2980+ }
2981+ }
2982+
2983+ MouseArea {
2984+ enabled: isMainClock
2985+ anchors.fill: parent
2986+ onClicked: {
2987+ clockFlipAnimation.start()
2988+ }
2989+ }
2990+ }
2991+
2992+ /*
2993+ The clockFlipAnimation is executed during every switch between
2994+ analog and digital modes.
2995+ */
2996+ SequentialAnimation {
2997+ id: clockFlipAnimation
2998+
2999+ ScriptAction {
3000+ script: {
3001+ triggerFlip()
3002+ analogShadow.setSource
3003+ ("AnalogShadow.qml",
3004+ {
3005+ "shadowWidth": innerCircleWidth,
3006+ "shadowTimeFontSize": fontSize,
3007+ "shadowPeriodFontSize": periodFontSize,
3008+ "showSeconds": isMainClock
3009+ })
3010+
3011+ digitalShadow.setSource
3012+ ("DigitalShadow.qml",
3013+ {
3014+ "shadowWidth": innerCircleWidth,
3015+ "shadowTimeFontSize": fontSize,
3016+ "shadowPeriodFontSize": periodFontSize,
3017+ "showSeconds": isMainClock
3018+ })
3019+
3020+ if (clockModeFlipable.isDigital) {
3021+ digitalShadow.item.isAnalog = true
3022+ }
3023+ else {
3024+ analogShadow.item.isDigital = true
3025+ }
3026+ }
3027+ }
3028+
3029+ PropertyAnimation {
3030+ target: bottomShadow
3031+ property: "opacity"
3032+ duration: 333
3033+ from: 1
3034+ to: 0
3035+ }
3036+
3037+ PropertyAnimation {
3038+ target: upperShadow
3039+ property: "opacity"
3040+ duration: 333
3041+ from: 0
3042+ to: 1
3043+ }
3044+
3045+ /*
3046+ Script to clean up after the flip animation is complete which
3047+ involves (in the order listed below)
3048+ - Hiding the shadows
3049+ - Toggling clock mode and unloading the hidden mode
3050+ - Unloading the analog and digital shadow required to show the
3051+ paper effect
3052+ */
3053+
3054+ ScriptAction {
3055+ script: {
3056+ upperShadow.opacity = bottomShadow.opacity = 0
3057+ isDigital = !isDigital
3058+
3059+ if (isDigital) {
3060+ _digitalModeLoader.setSource
3061+ ("DigitalMode.qml",
3062+ {
3063+ "width": innerCircleWidth,
3064+ "timeFontSize": fontSize,
3065+ "timePeriodFontSize": periodFontSize
3066+ })
3067+ _analogModeLoader.source = ""
3068+ }
3069+ else {
3070+ _analogModeLoader.setSource
3071+ ("AnalogMode.qml",
3072+ {
3073+ "width": innerCircleWidth,
3074+ "showSeconds": isMainClock
3075+ })
3076+ _digitalModeLoader.source = ""
3077+ }
3078+
3079+ analogShadow.source = digitalShadow.source = ""
3080+
3081+ if(isMainClock) {
3082+ var isDigitalSetting = JSON.parse
3083+ (JSON.stringify(clockModeDocument.contents))
3084+ isDigitalSetting.digitalMode = isDigital
3085+ clockModeDocument.contents = isDigitalSetting
3086+ }
3087+ }
3088+ }
3089+ }
3090+}
3091
3092=== added file 'app/components/ClockCircle.qml'
3093--- app/components/ClockCircle.qml 1970-01-01 00:00:00 +0000
3094+++ app/components/ClockCircle.qml 2014-08-12 22:08:22 +0000
3095@@ -0,0 +1,118 @@
3096+/*
3097+ * Copyright (C) 2014 Canonical Ltd
3098+ *
3099+ * This file is part of Ubuntu Clock App
3100+ *
3101+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3102+ * it under the terms of the GNU General Public License version 3 as
3103+ * published by the Free Software Foundation.
3104+ *
3105+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3106+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3107+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3108+ * GNU General Public License for more details.
3109+ *
3110+ * You should have received a copy of the GNU General Public License
3111+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3112+ */
3113+
3114+import QtQuick 2.2
3115+import Ubuntu.Components 1.1
3116+import QtGraphicalEffects 1.0
3117+
3118+/*
3119+ Clock Circle with the shadows and background color set depending on the
3120+ position of the circle.
3121+
3122+ If used as the outer circle, the shadows are at the top and the background
3123+ has a 30% white shade. On the other hand, if used as the inner clock circle
3124+ then the shadows are at the bottom and the background has a 3% darker shade.
3125+
3126+ If used as the inner circle, a textured background image is set as part of
3127+ the new design specs.
3128+
3129+ The circle position is set by the public property "isOuter". If true, the
3130+ outer circle characteristics are set and vice-versa.
3131+ */
3132+Rectangle {
3133+ id: _innerCircle
3134+
3135+ /*
3136+ Property to set if the circle is the outer or the inner circle
3137+ */
3138+ property bool isOuter: false
3139+
3140+ height: width
3141+ radius: width / 2
3142+ antialiasing: true
3143+ color: isOuter ? Qt.rgba(1,1,1,0.3) : Qt.rgba(0,0,0,0.03)
3144+
3145+ /*
3146+ Rectangle with a gradient background which will be used as a source for
3147+ the opacity mask. It starts of transparent and then gradually turns
3148+ gray at the bottom.
3149+ */
3150+ Rectangle {
3151+ id: _source
3152+
3153+ radius: width / 2
3154+ anchors.fill: parent
3155+
3156+ antialiasing: true
3157+
3158+ gradient: Gradient {
3159+ GradientStop {
3160+ position: 0.0
3161+ color: isOuter ? "#6E6E6E" : "Transparent"
3162+ }
3163+
3164+ GradientStop {
3165+ position: isOuter ? 0.7 : 0.3
3166+ color: "Transparent"
3167+ }
3168+
3169+ GradientStop {
3170+ position: 1.0
3171+ color: isOuter ? "Transparent" : "#6E6E6E"
3172+ }
3173+ }
3174+ }
3175+
3176+ Image {
3177+ id: _innerBackground
3178+
3179+ visible: !isOuter
3180+ anchors.fill: parent
3181+ fillMode: Image.PreserveAspectFit
3182+ source: "../graphics/Inner_Clock_Texture.png"
3183+ }
3184+
3185+ /*
3186+ Rectangle which will be masked over by the source rectangle. This
3187+ rectangle is required for the border effect which results in the
3188+ shadow.
3189+ */
3190+ Rectangle {
3191+ id: _mask
3192+
3193+ radius: (width / 2)
3194+ anchors.fill: _source
3195+
3196+ antialiasing: true
3197+ color: "Transparent"
3198+ border { width: units.gu(0.2) }
3199+ }
3200+
3201+ OpacityMask {
3202+ opacity: 0.65
3203+ anchors.fill: _source
3204+ source: ShaderEffectSource {
3205+ sourceItem: _source
3206+ hideSource: true
3207+ }
3208+ maskSource: ShaderEffectSource {
3209+ sourceItem: _mask
3210+ hideSource: true
3211+ }
3212+ }
3213+}
3214
3215=== added file 'app/components/DigitalMode.qml'
3216--- app/components/DigitalMode.qml 1970-01-01 00:00:00 +0000
3217+++ app/components/DigitalMode.qml 2014-08-12 22:08:22 +0000
3218@@ -0,0 +1,124 @@
3219+/*
3220+ * Copyright (C) 2014 Canonical Ltd
3221+ *
3222+ * This file is part of Ubuntu Clock App
3223+ *
3224+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3225+ * it under the terms of the GNU General Public License version 3 as
3226+ * published by the Free Software Foundation.
3227+ *
3228+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3229+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3230+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3231+ * GNU General Public License for more details.
3232+ *
3233+ * You should have received a copy of the GNU General Public License
3234+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3235+ */
3236+
3237+import QtQuick 2.0
3238+import Ubuntu.Components 1.1
3239+
3240+ClockCircle {
3241+ id: _innerCircle
3242+
3243+ // Property to allow setting the time font size manually
3244+ property alias timeFontSize: _digitalTime.font.pixelSize
3245+
3246+ // Property to allow setting the time period font size manually
3247+ property alias timePeriodFontSize: _digitalTimePeriod.font.pixelSize
3248+
3249+ // Properties to set the maximum dimensions when running the animations
3250+ property int maxWidth
3251+ property int maxTimeFontSize
3252+ property int maxPeriodFontSize
3253+
3254+ function startAnimation() {
3255+ _animationTimer.start()
3256+ }
3257+
3258+ width: units.gu(0)
3259+
3260+ Timer {
3261+ id: _animationTimer
3262+ interval: 200
3263+ repeat: false
3264+ onTriggered: _innerCircleAnimation.start()
3265+ }
3266+
3267+ Label {
3268+ id: _digitalTime
3269+
3270+ anchors.centerIn: parent
3271+
3272+ color: UbuntuColors.midAubergine
3273+ font.pixelSize: units.dp(1)
3274+ text: {
3275+ if (time.search(Qt.locale().amText) !== -1) {
3276+ // 12 hour format detected with the localised AM text
3277+ return time.split(Qt.locale().amText)[0].trim()
3278+ }
3279+ else if (time.search(Qt.locale().pmText) !== -1) {
3280+ // 12 hour format detected with the localised PM text
3281+ return time.split(Qt.locale().pmText)[0].trim()
3282+ }
3283+ else {
3284+ // 24-hour format detected, return full time string
3285+ return time
3286+ }
3287+ }
3288+ }
3289+
3290+ Label {
3291+ id: _digitalTimePeriod
3292+
3293+ anchors.top: _digitalTime.bottom
3294+ anchors.horizontalCenter: parent.horizontalCenter
3295+
3296+ color: UbuntuColors.midAubergine
3297+ font.pixelSize: units.dp(1)
3298+ visible: text !== ""
3299+ text: {
3300+ if (time.search(Qt.locale().amText) !== -1) {
3301+ // 12 hour format detected with the localised AM text
3302+ return Qt.locale().amText
3303+ }
3304+ else if (time.search(Qt.locale().pmText) !== -1) {
3305+ // 12 hour format detected with the localised PM text
3306+ return Qt.locale().pmText
3307+ }
3308+ else {
3309+ // 24-hour format detected
3310+ return ""
3311+ }
3312+ }
3313+ }
3314+
3315+ ParallelAnimation {
3316+ id: _innerCircleAnimation
3317+
3318+ PropertyAnimation {
3319+ target: _innerCircle
3320+ property: "width"
3321+ from: units.gu(0)
3322+ to: maxWidth
3323+ duration: 900
3324+ }
3325+
3326+ PropertyAnimation {
3327+ target: _digitalTime
3328+ property: "font.pixelSize"
3329+ from: units.dp(1)
3330+ to: maxTimeFontSize
3331+ duration: 900
3332+ }
3333+
3334+ PropertyAnimation {
3335+ target: _digitalTimePeriod
3336+ property: "font.pixelSize"
3337+ from: units.dp(1)
3338+ to: maxPeriodFontSize
3339+ duration: 900
3340+ }
3341+ }
3342+}
3343
3344=== added file 'app/components/DigitalShadow.qml'
3345--- app/components/DigitalShadow.qml 1970-01-01 00:00:00 +0000
3346+++ app/components/DigitalShadow.qml 2014-08-12 22:08:22 +0000
3347@@ -0,0 +1,83 @@
3348+/*
3349+ * Copyright (C) 2014 Canonical Ltd
3350+ *
3351+ * This file is part of Ubuntu Clock App
3352+ *
3353+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3354+ * it under the terms of the GNU General Public License version 3 as
3355+ * published by the Free Software Foundation.
3356+ *
3357+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3358+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3359+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3360+ * GNU General Public License for more details.
3361+ *
3362+ * You should have received a copy of the GNU General Public License
3363+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3364+ */
3365+
3366+import QtQuick 2.0
3367+import Ubuntu.Components 1.1
3368+
3369+Flipable {
3370+ id: digitalShadow
3371+
3372+ // Properties to set the size of the digital shadow
3373+ property int shadowWidth
3374+ property int shadowTimeFontSize
3375+ property int shadowPeriodFontSize
3376+
3377+ // Property to disable the seconds hand
3378+ property alias showSeconds: _analogMode.showSeconds
3379+
3380+ // Property to switch between digital and analog mode
3381+ property bool isAnalog: false
3382+
3383+ width: shadowWidth
3384+ height: width/2
3385+ clip: true
3386+
3387+ front: DigitalMode {
3388+ id: _digitalMode
3389+
3390+ width: shadowWidth
3391+ timeFontSize: shadowTimeFontSize
3392+ timePeriodFontSize: shadowPeriodFontSize
3393+
3394+ anchors.bottom: parent.bottom
3395+ anchors.horizontalCenter: parent.horizontalCenter
3396+ }
3397+
3398+ back: AnalogMode {
3399+ id: _analogMode
3400+
3401+ width: shadowWidth
3402+ anchors.bottom: parent.bottom
3403+ anchors.horizontalCenter: parent.horizontalCenter
3404+ }
3405+
3406+ transform: Rotation {
3407+ id: rotation
3408+ origin.x: digitalShadow.width/2
3409+ origin.y: 0
3410+ axis.x: 1; axis.y: 0; axis.z: 0
3411+ angle: 0
3412+ }
3413+
3414+ states: State {
3415+ name: "Digital"
3416+ when: digitalShadow.isAnalog
3417+ PropertyChanges {
3418+ target: rotation
3419+ angle: -180
3420+ }
3421+ }
3422+
3423+ transitions: Transition {
3424+ NumberAnimation {
3425+ target: rotation
3426+ property: "angle"
3427+ duration: 666
3428+ }
3429+ }
3430+}
3431
3432=== added file 'app/components/PullToAdd.qml'
3433--- app/components/PullToAdd.qml 1970-01-01 00:00:00 +0000
3434+++ app/components/PullToAdd.qml 2014-08-12 22:08:22 +0000
3435@@ -0,0 +1,90 @@
3436+/*
3437+ * Copyright (C) 2014 Canonical Ltd
3438+ *
3439+ * This file is part of Ubuntu Clock App
3440+ *
3441+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3442+ * it under the terms of the GNU General Public License version 3 as
3443+ * published by the Free Software Foundation.
3444+ *
3445+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3446+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3447+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3448+ * GNU General Public License for more details.
3449+ *
3450+ * You should have received a copy of the GNU General Public License
3451+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3452+ */
3453+
3454+import QtQuick 2.0
3455+import Ubuntu.Components 1.1
3456+
3457+Row {
3458+ id: _pullToAdd
3459+
3460+ // Property to get the position of the button from the top
3461+ property int dragPosition: 0
3462+
3463+ // Property to store the height of the label
3464+ property alias labelHeight: _leftLabel.height
3465+
3466+ // Property to set the label on the left side of the add button
3467+ property alias leftLabel: _leftLabel.text
3468+
3469+ // Property to set the label on the right side of the add button
3470+ property alias rightLabel: _rightLabel.text
3471+
3472+ // Property to set the maximum threshold beyond which the button shouldn't
3473+ // resize
3474+ property int maxThreshold: -units.gu(8)
3475+
3476+ // Property to set the maximum size of the plus icon
3477+ property int maxPlusSize: _addButton.width * 0.3
3478+
3479+ spacing: units.gu(1)
3480+
3481+ Label {
3482+ id: _leftLabel
3483+
3484+ text: "pull"
3485+ fontSize: "medium"
3486+ color: UbuntuColors.midAubergine
3487+ anchors.verticalCenter: parent.verticalCenter
3488+ }
3489+
3490+ ClockCircle {
3491+ id: _addButton
3492+
3493+ isOuter: true
3494+ width: dragPosition >= maxThreshold
3495+ ? dragPosition * units.gu(6.5)/maxThreshold
3496+ : units.gu(6.5)
3497+
3498+ ClockCircle {
3499+ width: dragPosition >= maxThreshold
3500+ ? dragPosition * units.gu(4.5)/maxThreshold
3501+ : units.gu(4.5)
3502+ anchors.centerIn: parent
3503+
3504+ Icon {
3505+ id: plusIcon
3506+ anchors.centerIn: parent
3507+ color: UbuntuColors.coolGrey
3508+ name: "add"
3509+ height: dragPosition >= maxThreshold
3510+ ? (dragPosition * maxPlusSize)/maxThreshold
3511+ : maxPlusSize
3512+ width: height
3513+ }
3514+ }
3515+ }
3516+
3517+ Label {
3518+ id: _rightLabel
3519+
3520+ text: "down"
3521+ fontSize: "medium"
3522+ color: UbuntuColors.midAubergine
3523+ anchors.verticalCenter: parent.verticalCenter
3524+ }
3525+}
3526
3527=== added file 'app/components/Shadow.qml'
3528--- app/components/Shadow.qml 1970-01-01 00:00:00 +0000
3529+++ app/components/Shadow.qml 2014-08-12 22:08:22 +0000
3530@@ -0,0 +1,44 @@
3531+/*
3532+ * Copyright (C) 2014 Canonical Ltd
3533+ *
3534+ * This file is part of Ubuntu Clock App
3535+ *
3536+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3537+ * it under the terms of the GNU General Public License version 3 as
3538+ * published by the Free Software Foundation.
3539+ *
3540+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3541+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3542+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3543+ * GNU General Public License for more details.
3544+ *
3545+ * You should have received a copy of the GNU General Public License
3546+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3547+ */
3548+
3549+import QtQuick 2.0
3550+import Ubuntu.Components 1.1
3551+
3552+Item {
3553+ id: _shadowContainer
3554+
3555+ clip: true
3556+ height: width/2
3557+
3558+ opacity: 0
3559+
3560+ Rectangle {
3561+ id: _shadow
3562+
3563+ width: _shadowContainer.width
3564+ height: width
3565+ radius: width/2
3566+
3567+ anchors {
3568+ top: parent.top
3569+ horizontalCenter: parent.horizontalCenter
3570+ }
3571+
3572+ color: Qt.rgba(0,0,0,0.2)
3573+ }
3574+}
3575
3576=== added file 'app/components/SubtitledListItem.qml'
3577--- app/components/SubtitledListItem.qml 1970-01-01 00:00:00 +0000
3578+++ app/components/SubtitledListItem.qml 2014-08-12 22:08:22 +0000
3579@@ -0,0 +1,55 @@
3580+/*
3581+ * Copyright (C) 2014 Canonical Ltd
3582+ *
3583+ * This file is part of Ubuntu Clock App
3584+ *
3585+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3586+ * it under the terms of the GNU General Public License version 3 as
3587+ * published by the Free Software Foundation.
3588+ *
3589+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3590+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3591+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3592+ * GNU General Public License for more details.
3593+ *
3594+ * You should have received a copy of the GNU General Public License
3595+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3596+ */
3597+
3598+import QtQuick 2.0
3599+import Ubuntu.Components 1.1
3600+import Ubuntu.Components.ListItems 1.0 as ListItem
3601+
3602+/*
3603+ This component is almost an identical copy of the SDK's subtitled with the
3604+ exception of the font size and color required by the new clock app design.
3605+
3606+ #TODO: Revert to using the SDK Subtitled Component when they change the
3607+ design to match the new clock app design.
3608+ */
3609+ListItem.Base {
3610+ id: _subtitledContainer
3611+
3612+ // Property to set the main text label
3613+ property alias text: _mainText.text
3614+
3615+ // Property to set the subtitle label
3616+ property alias subText: _subText.text
3617+
3618+ Column {
3619+ id: _labelColumn
3620+
3621+ anchors.verticalCenter: parent.verticalCenter
3622+
3623+ Label {
3624+ id: _mainText
3625+ fontSize: "medium"
3626+ color: UbuntuColors.midAubergine
3627+ }
3628+
3629+ Label {
3630+ id: _subText
3631+ fontSize: "xx-small"
3632+ }
3633+ }
3634+}
3635
3636=== added file 'app/components/Utils.js'
3637--- app/components/Utils.js 1970-01-01 00:00:00 +0000
3638+++ app/components/Utils.js 2014-08-12 22:08:22 +0000
3639@@ -0,0 +1,25 @@
3640+/*
3641+ * Copyright (C) 2014 Canonical Ltd
3642+ *
3643+ * This file is part of Ubuntu Clock App
3644+ *
3645+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3646+ * it under the terms of the GNU General Public License version 3 as
3647+ * published by the Free Software Foundation.
3648+ *
3649+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3650+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3651+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3652+ * GNU General Public License for more details.
3653+ *
3654+ * You should have received a copy of the GNU General Public License
3655+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3656+ */
3657+
3658+.pragma library
3659+
3660+function log (debugMode, message) {
3661+ if (debugMode) {
3662+ console.log("[LOG]" + message)
3663+ }
3664+}
3665
3666=== added directory 'app/graphics'
3667=== added file 'app/graphics/Background_Texture.jpg'
3668Binary files app/graphics/Background_Texture.jpg 1970-01-01 00:00:00 +0000 and app/graphics/Background_Texture.jpg 2014-08-12 22:08:22 +0000 differ
3669=== added file 'app/graphics/CMakeLists.txt'
3670--- app/graphics/CMakeLists.txt 1970-01-01 00:00:00 +0000
3671+++ app/graphics/CMakeLists.txt 2014-08-12 22:08:22 +0000
3672@@ -0,0 +1,8 @@
3673+file(GLOB GRAPHICS_FILES *.png *.jpg)
3674+
3675+# make the files visible in the qtcreator tree
3676+if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
3677+ add_custom_target(ubuntu-clock-app_graphics_PNGFiles ALL SOURCES ${IMAGES_PNG_FILES})
3678+endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
3679+
3680+install(FILES ${GRAPHICS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/graphics)
3681
3682=== added file 'app/graphics/Hour_Hand@27.png'
3683Binary files app/graphics/Hour_Hand@27.png 1970-01-01 00:00:00 +0000 and app/graphics/Hour_Hand@27.png 2014-08-12 22:08:22 +0000 differ
3684=== added file 'app/graphics/Inner_Clock_Texture.png'
3685Binary files app/graphics/Inner_Clock_Texture.png 1970-01-01 00:00:00 +0000 and app/graphics/Inner_Clock_Texture.png 2014-08-12 22:08:22 +0000 differ
3686=== added file 'app/graphics/Knob@27.png'
3687Binary files app/graphics/Knob@27.png 1970-01-01 00:00:00 +0000 and app/graphics/Knob@27.png 2014-08-12 22:08:22 +0000 differ
3688=== added file 'app/graphics/Location_Pin.png'
3689Binary files app/graphics/Location_Pin.png 1970-01-01 00:00:00 +0000 and app/graphics/Location_Pin.png 2014-08-12 22:08:22 +0000 differ
3690=== added file 'app/graphics/Minute_Hand@27.png'
3691Binary files app/graphics/Minute_Hand@27.png 1970-01-01 00:00:00 +0000 and app/graphics/Minute_Hand@27.png 2014-08-12 22:08:22 +0000 differ
3692=== added file 'app/graphics/Second_Hand@27.png'
3693Binary files app/graphics/Second_Hand@27.png 1970-01-01 00:00:00 +0000 and app/graphics/Second_Hand@27.png 2014-08-12 22:08:22 +0000 differ
3694=== added file 'app/ubuntu-clock-app.desktop.in'
3695--- app/ubuntu-clock-app.desktop.in 1970-01-01 00:00:00 +0000
3696+++ app/ubuntu-clock-app.desktop.in 2014-08-12 22:08:22 +0000
3697@@ -0,0 +1,10 @@
3698+[Desktop Entry]
3699+Version=1.0
3700+Name=Clock Reboot
3701+Exec=@EXEC@
3702+Icon=@ICON@
3703+Terminal=false
3704+Type=Application
3705+X-Ubuntu-Touch=true
3706+
3707+
3708
3709=== added file 'app/ubuntu-clock-app.qml'
3710--- app/ubuntu-clock-app.qml 1970-01-01 00:00:00 +0000
3711+++ app/ubuntu-clock-app.qml 2014-08-12 22:08:22 +0000
3712@@ -0,0 +1,107 @@
3713+/*
3714+ * Copyright (C) 2014 Canonical Ltd
3715+ *
3716+ * This file is part of Ubuntu Clock App
3717+ *
3718+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
3719+ * it under the terms of the GNU General Public License version 3 as
3720+ * published by the Free Software Foundation.
3721+ *
3722+ * Ubuntu Clock App is distributed in the hope that it will be useful,
3723+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3724+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3725+ * GNU General Public License for more details.
3726+ *
3727+ * You should have received a copy of the GNU General Public License
3728+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3729+ */
3730+
3731+import QtQuick 2.0
3732+import U1db 1.0 as U1db
3733+import Ubuntu.Components 1.1
3734+import "clock"
3735+import "alarm"
3736+import "components"
3737+import "components/Utils.js" as Utils
3738+
3739+MainView {
3740+ id: clockApp
3741+
3742+ // Property to store the state of an application (active or suspended)
3743+ property bool applicationState: Qt.application.active
3744+
3745+ // Property to enable/disable the debug mode to show more console output
3746+ property bool debugMode: true
3747+
3748+ // objectName for functional testing purposes (autopilot-qt5)
3749+ objectName: "clock"
3750+
3751+ // applicationName for click packages (used as an unique app identifier)
3752+ applicationName: "com.ubuntu.clock.devel"
3753+
3754+ /*
3755+ This property enables the application to change orientation when the
3756+ device is rotated. This has been set to false since we are currently
3757+ only focussing on the phone interface.
3758+ */
3759+ automaticOrientation: false
3760+
3761+ /*
3762+ The width and height defined below are the same dimension used by the
3763+ designers in the clock visual spec.
3764+ */
3765+ width: units.gu(40)
3766+ height: units.gu(70)
3767+
3768+ backgroundColor: "#F5F5F5"
3769+
3770+ useDeprecatedToolbar: false
3771+
3772+ Background {}
3773+
3774+ // Database to store the user preferences locally
3775+ U1db.Database {
3776+ id: clockDB
3777+ path: "user-preferences"
3778+ }
3779+
3780+ // Document to store clock mode chosen by user
3781+ U1db.Document {
3782+ id: clockModeDocument
3783+ create: true
3784+ database: clockDB
3785+ docId: "clockModeDocument"
3786+ defaults: { "digitalMode": false }
3787+ }
3788+
3789+ AlarmModel {
3790+ id: alarmModel
3791+ Component.onCompleted: Utils.log(debugMode, "Alarm Database loaded")
3792+ }
3793+
3794+ PageStack {
3795+ id: mainStack
3796+
3797+ Component.onCompleted: push(clockPage)
3798+
3799+ ClockPage {
3800+ id: clockPage
3801+
3802+ /*
3803+ #FIXME: When the SDK support hiding the header, then enable the
3804+ clock page title. This will then set the correct window title on
3805+ the desktop.
3806+
3807+ title: "Clock"
3808+ */
3809+
3810+ /*
3811+ #TODO: The bottom edge title should reflect the time to the next
3812+ alarm. For instance it should read "Next alarm in 9h23m".
3813+ */
3814+ bottomEdgeTitle: i18n.tr("Next Alarm in ..")
3815+ bottomEdgePageComponent: AlarmPage {}
3816+ }
3817+ }
3818+}
3819+
3820
3821=== added directory 'app/upstreamcomponents'
3822=== added file 'app/upstreamcomponents/CMakeLists.txt'
3823--- app/upstreamcomponents/CMakeLists.txt 1970-01-01 00:00:00 +0000
3824+++ app/upstreamcomponents/CMakeLists.txt 2014-08-12 22:08:22 +0000
3825@@ -0,0 +1,6 @@
3826+file(GLOB UPSTREAM_COMPONENTS_QML_JS_FILES *.qml *.js)
3827+
3828+# make the files visible in the qtcreator tree
3829+add_custom_target(ubuntu-clock-app_upstream_components_QMlFiles ALL SOURCES ${UPSTREAM_COMPONENTS_QML_JS_FILES})
3830+
3831+install(FILES ${UPSTREAM_COMPONENTS_QML_JS_FILES} DESTINATION ${UBUNTU-CLOCK_APP_DIR}/upstreamcomponents)
3832
3833=== added file 'app/upstreamcomponents/FastScroll.js'
3834--- app/upstreamcomponents/FastScroll.js 1970-01-01 00:00:00 +0000
3835+++ app/upstreamcomponents/FastScroll.js 2014-08-12 22:08:22 +0000
3836@@ -0,0 +1,130 @@
3837+/****************************************************************************
3838+**
3839+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
3840+** Copyright (C) 2014 Canonical Ltda
3841+** All rights reserved.
3842+** Contact: Nokia Corporation (qt-info@nokia.com)
3843+**
3844+** This file is part of the Qt Components project.
3845+**
3846+** $QT_BEGIN_LICENSE:BSD$
3847+** You may use this file under the terms of the BSD license as follows:
3848+**
3849+** "Redistribution and use in source and binary forms, with or without
3850+** modification, are permitted provided that the following conditions are
3851+** met:
3852+** * Redistributions of source code must retain the above copyright
3853+** notice, this list of conditions and the following disclaimer.
3854+** * Redistributions in binary form must reproduce the above copyright
3855+** notice, this list of conditions and the following disclaimer in
3856+** the documentation and/or other materials provided with the
3857+** distribution.
3858+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
3859+** the names of its contributors may be used to endorse or promote
3860+** products derived from this software without specific prior written
3861+** permission.
3862+**
3863+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3864+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3865+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3866+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3867+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3868+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3869+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3870+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3871+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3872+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3873+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
3874+** $QT_END_LICENSE$
3875+**
3876+****************************************************************************/
3877+
3878+// FastScroll.js - this is just SectionScroller.js with a fix for
3879+// section.criteria == ViewSection.FirstCharacter
3880+var sectionData = [];
3881+var _sections = [];
3882+
3883+function initialize(list) {
3884+ initSectionData(list);
3885+}
3886+
3887+function contains(name) {
3888+ return (_sections.indexOf(name) > -1)
3889+}
3890+
3891+function initSectionData(list) {
3892+ if (!list || !list.model) return;
3893+ sectionData = [];
3894+ _sections = [];
3895+ var current = "",
3896+ prop = list.section.property,
3897+ sectionText;
3898+
3899+ if (list.section.criteria === ViewSection.FullString) {
3900+ for (var i = 0, count = list.model.count; i < count; i++) {
3901+ sectionText = list.getSectionText(i)
3902+ if (sectionText !== current) {
3903+ current = sectionText;
3904+ _sections.push(current);
3905+ sectionData.push({ index: i, header: current });
3906+ }
3907+ }
3908+ } else if (list.section.criteria === ViewSection.FirstCharacter) {
3909+ for (var i = 0, count = list.model.count; i < count; i++) {
3910+ sectionText = list.getSectionText(i).substring(0, 1)
3911+ if (sectionText !== current) {
3912+ current = sectionText
3913+ _sections.push(sectionText);
3914+ sectionData.push({ index: i, header: current });
3915+ }
3916+ }
3917+ }
3918+}
3919+
3920+function getSectionPositionString(name) {
3921+ var val = _sections.indexOf(name);
3922+ return val === 0 ? "first" :
3923+ val === _sections.length - 1 ? "last" : false;
3924+}
3925+
3926+function getAt(pos) {
3927+ return _sections[pos] ? _sections[pos] : "";
3928+}
3929+
3930+function getRelativeSections(current) {
3931+ var val = _sections.indexOf(current),
3932+ sect = [],
3933+ sl = _sections.length;
3934+
3935+ val = val < 1 ? 1 : val >= sl-1 ? sl-2 : val;
3936+ sect = [getAt(val - 1), getAt(val), getAt(val + 1)];
3937+
3938+ return sect;
3939+}
3940+
3941+function getClosestSection(pos, down) {
3942+ var tmp = (_sections.length) * pos;
3943+ var val = Math.ceil(tmp) // TODO: better algorithm
3944+ val = val < 2 ? 1 : val;
3945+ return _sections[val-1];
3946+}
3947+
3948+function getNextSection(current) {
3949+ var val = _sections.indexOf(current);
3950+ return (val > -1 ? _sections[(val < _sections.length - 1 ? val + 1 : val)] : _sections[0]) || "";
3951+}
3952+
3953+function getPreviousSection(current) {
3954+ var val = _sections.indexOf(current);
3955+ return (val > -1 ? _sections[(val > 0 ? val - 1 : val)] : _sections[0]) || "";
3956+}
3957+
3958+function getIndexFor(sectionName) {
3959+ var data = sectionData[_sections.indexOf(sectionName)]
3960+ if (data) {
3961+ var val = data.index;
3962+ return val === 0 || val > 0 ? val : -1;
3963+ } else {
3964+ return -1
3965+ }
3966+}
3967
3968=== added file 'app/upstreamcomponents/FastScroll.qml'
3969--- app/upstreamcomponents/FastScroll.qml 1970-01-01 00:00:00 +0000
3970+++ app/upstreamcomponents/FastScroll.qml 2014-08-12 22:08:22 +0000
3971@@ -0,0 +1,321 @@
3972+/****************************************************************************
3973+**
3974+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
3975+** Copyright (C) 2014 Canonical Ltda
3976+** All rights reserved.
3977+** Contact: Nokia Corporation (qt-info@nokia.com)
3978+**
3979+** This file is part of the Qt Components project.
3980+**
3981+** $QT_BEGIN_LICENSE:BSD$
3982+** You may use this file under the terms of the BSD license as follows:
3983+**
3984+** "Redistribution and use in source and binary forms, with or without
3985+** modification, are permitted provided that the following conditions are
3986+** met:
3987+** * Redistributions of source code must retain the above copyright
3988+** notice, this list of conditions and the following disclaimer.
3989+** * Redistributions in binary form must reproduce the above copyright
3990+** notice, this list of conditions and the following disclaimer in
3991+** the documentation and/or other materials provided with the
3992+** distribution.
3993+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
3994+** the names of its contributors may be used to endorse or promote
3995+** products derived from this software without specific prior written
3996+** permission.
3997+**
3998+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3999+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4000+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4001+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4002+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4003+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4004+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4005+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4006+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4007+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4008+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
4009+** $QT_END_LICENSE$
4010+**
4011+****************************************************************************/
4012+
4013+// FastScroll.qml
4014+import QtQuick 2.2
4015+import Ubuntu.Components 1.1
4016+import "FastScroll.js" as Sections
4017+
4018+Item {
4019+ id: root
4020+
4021+ property ListView listView
4022+ property int pinSize: units.gu(2)
4023+
4024+ 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"]
4025+ readonly property alias fastScrolling: internal.fastScrolling
4026+ readonly property bool showing: (rail.opacity !== 0.0)
4027+ readonly property double minimumHeight: rail.height
4028+
4029+ width: units.gu(7)
4030+ height: rail.height
4031+
4032+ onListViewChanged: {
4033+ if (listView && listView.model) {
4034+ internal.initDirtyObserver();
4035+ } else if (listView) {
4036+ listView.modelChanged.connect(function() {
4037+ if (listView.model) {
4038+ internal.initDirtyObserver();
4039+ }
4040+ });
4041+ }
4042+ }
4043+
4044+ Connections {
4045+ target: listView
4046+ onCurrentIndexChanged: {
4047+ if (currentIndex != -1) {
4048+ rail.opacity = 0.0
4049+ }
4050+ }
4051+ }
4052+
4053+ Rectangle {
4054+ id: magnified
4055+
4056+ color: Theme.palette.normal.overlay
4057+ radius: height * 0.3
4058+ height: pinSize * 2
4059+ width: height
4060+ opacity: internal.fastScrolling && root.enabled ? 1.0 : 0.0
4061+ x: -cursor.width - units.gu(3)
4062+ y: {
4063+ if (internal.currentItem) {
4064+ var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2)
4065+ return (itemCenterY - (magnified.height / 2))
4066+ } else {
4067+ return 0
4068+ }
4069+ }
4070+
4071+ Label {
4072+ anchors.fill: parent
4073+ horizontalAlignment: Text.AlignHCenter
4074+ verticalAlignment: Text.AlignVCenter
4075+ text: internal.desireSection
4076+ fontSize: "small"
4077+ }
4078+
4079+ Behavior on opacity {
4080+ UbuntuNumberAnimation {}
4081+ }
4082+ }
4083+
4084+ Rectangle {
4085+ id: cursor
4086+
4087+ property bool showLabel: false
4088+ property string currentSectionName: ""
4089+
4090+ radius: pinSize * 0.3
4091+ height: pinSize
4092+ width: height
4093+ color: Theme.palette.normal.foreground
4094+ opacity: rail.opacity
4095+ x: rail.x
4096+ y: {
4097+ if (internal.currentItem) {
4098+ var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2)
4099+ return (itemCenterY - (cursor.height / 2))
4100+ } else {
4101+ return 0
4102+ }
4103+ }
4104+ Behavior on y {
4105+ enabled: !internal.fastScrolling
4106+ UbuntuNumberAnimation { }
4107+ }
4108+ }
4109+
4110+ Column {
4111+ id: rail
4112+
4113+ property bool isVisible: root.enabled &&
4114+ (listView.moving || dragArea.pressed) &&
4115+ (listView.currentIndex == -1)
4116+ anchors {
4117+ right: parent.right
4118+ rightMargin: units.gu(2)
4119+ left: parent.left
4120+ leftMargin: units.gu(2)
4121+ top: parent.top
4122+ }
4123+ height: childrenRect.height
4124+ opacity: 0.0
4125+ onIsVisibleChanged: {
4126+ if (isVisible) {
4127+ rail.opacity = 1.0
4128+ hideTimer.stop()
4129+ } else if (!root.enabled) {
4130+ rail.opacity = 0.0
4131+ } else {
4132+ hideTimer.restart()
4133+ }
4134+ }
4135+
4136+ Behavior on opacity {
4137+ UbuntuNumberAnimation { }
4138+ }
4139+
4140+ Repeater {
4141+ id: sectionsRepeater
4142+
4143+ model: root.letters
4144+ Label {
4145+ id: lbl
4146+
4147+ anchors.left: parent.left
4148+ height: pinSize
4149+ width: pinSize
4150+ verticalAlignment: Text.AlignVCenter
4151+ horizontalAlignment: Text.AlignHCenter
4152+ text: internal.fastScrolling && internal.targetSection == modelData ? "" : modelData
4153+ fontSize: "x-small"
4154+ color: internal.currentItem && (internal.currentItem.text === text) ? Theme.palette.selected.foregroundText : Theme.palette.selected.backgroundText
4155+ opacity: !internal.modelDirty && Sections.contains(text) ? 1.0 : 0.5
4156+ }
4157+ }
4158+
4159+ Timer {
4160+ id: hideTimer
4161+
4162+ running: false
4163+ interval: 2000
4164+ onTriggered: rail.opacity = 0.0
4165+ }
4166+ }
4167+
4168+ MouseArea {
4169+ id: dragArea
4170+
4171+ anchors {
4172+ left: parent.left
4173+ right: parent.right
4174+ }
4175+ y: rail.y
4176+ height: rail.height
4177+ visible: rail.opacity == 1.0
4178+
4179+ preventStealing: true
4180+ onPressed: {
4181+ internal.adjustContentPosition(mouseY)
4182+ dragginTimer.start()
4183+ }
4184+
4185+ onReleased: {
4186+ dragginTimer.stop()
4187+ internal.desireSection = ""
4188+ internal.fastScrolling = false
4189+ }
4190+
4191+ onPositionChanged: internal.adjustContentPosition(mouseY)
4192+
4193+ Timer {
4194+ id: dragginTimer
4195+
4196+ running: false
4197+ interval: 150
4198+ onTriggered: {
4199+ internal.fastScrolling = true
4200+ }
4201+ }
4202+ }
4203+
4204+ Timer {
4205+ id: dirtyTimer
4206+ interval: 500
4207+ running: false
4208+ onTriggered: {
4209+ Sections.initSectionData(listView);
4210+ internal.modelDirty = false;
4211+ }
4212+ }
4213+
4214+ Timer {
4215+ id: timerScroll
4216+
4217+ running: false
4218+ interval: 10
4219+ onTriggered: {
4220+ if (internal.desireSection != internal.currentSection) {
4221+ var idx = Sections.getIndexFor(internal.desireSection)
4222+ if (idx !== -1) {
4223+ listView.cancelFlick()
4224+ listView.positionViewAtIndex(idx, ListView.Beginning)
4225+ }
4226+ }
4227+ }
4228+ }
4229+
4230+ QtObject {
4231+ id: internal
4232+
4233+ property string currentSection: listView.currentSection
4234+ property string desireSection: ""
4235+ property string targetSection: fastScrolling ? desireSection : currentSection
4236+ property int oldY: 0
4237+ property bool modelDirty: false
4238+ property bool down: true
4239+ property bool fastScrolling: false
4240+ property var currentItem: null
4241+
4242+ onTargetSectionChanged: moveIndicator(targetSection)
4243+
4244+ function initDirtyObserver() {
4245+ Sections.initialize(listView);
4246+ function dirtyObserver() {
4247+ if (!internal.modelDirty) {
4248+ internal.modelDirty = true;
4249+ dirtyTimer.running = true;
4250+ }
4251+ }
4252+
4253+ if (listView.model.countChanged)
4254+ listView.model.countChanged.connect(dirtyObserver);
4255+
4256+ if (listView.model.itemsChanged)
4257+ listView.model.itemsChanged.connect(dirtyObserver);
4258+
4259+ if (listView.model.itemsInserted)
4260+ listView.model.itemsInserted.connect(dirtyObserver);
4261+
4262+ if (listView.model.itemsMoved)
4263+ listView.model.itemsMoved.connect(dirtyObserver);
4264+
4265+ if (listView.model.itemsRemoved)
4266+ listView.model.itemsRemoved.connect(dirtyObserver);
4267+ }
4268+
4269+ function adjustContentPosition(mouseY) {
4270+ var child = rail.childAt(rail.width / 2, mouseY)
4271+ if (!child || child.text === "") {
4272+ return
4273+ }
4274+ var section = child.text
4275+ if (internal.desireSection !== section) {
4276+ internal.desireSection = section
4277+ moveIndicator(section)
4278+ if (dragArea.pressed) {
4279+ timerScroll.restart()
4280+ }
4281+ }
4282+ }
4283+
4284+ function moveIndicator(section)
4285+ {
4286+ var index = root.letters.indexOf(section)
4287+ if (index != -1) {
4288+ currentItem = sectionsRepeater.itemAt(index)
4289+ }
4290+ }
4291+ }
4292+}
4293
4294=== added file 'app/upstreamcomponents/ListItemWithActions.qml'
4295--- app/upstreamcomponents/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
4296+++ app/upstreamcomponents/ListItemWithActions.qml 2014-08-12 22:08:22 +0000
4297@@ -0,0 +1,372 @@
4298+/*
4299+ * Copyright (C) 2012-2014 Canonical, Ltd.
4300+ *
4301+ * This program is free software; you can redistribute it and/or modify
4302+ * it under the terms of the GNU General Public License as published by
4303+ * the Free Software Foundation; version 3.
4304+ *
4305+ * This program is distributed in the hope that it will be useful,
4306+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4307+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4308+ * GNU General Public License for more details.
4309+ *
4310+ * You should have received a copy of the GNU General Public License
4311+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4312+ */
4313+
4314+import QtQuick 2.2
4315+import Ubuntu.Components 1.1
4316+
4317+Item {
4318+ id: root
4319+
4320+ property Action leftSideAction: null
4321+ property list<Action> rightSideActions
4322+ property double defaultHeight: units.gu(8)
4323+ property bool locked: false
4324+ property Action activeAction: null
4325+ property var activeItem: null
4326+ property bool triggerActionOnMouseRelease: false
4327+ property color color: Theme.palette.normal.background
4328+ property color selectedColor: "#E6E6E6"
4329+ property bool selected: false
4330+ property bool selectionMode: false
4331+ property alias internalAnchors: mainContents.anchors
4332+ default property alias contents: mainContents.children
4333+
4334+ readonly property double actionWidth: units.gu(5)
4335+ readonly property double leftActionWidth: units.gu(10)
4336+ readonly property double actionThreshold: actionWidth * 0.4
4337+ readonly property double threshold: 0.4
4338+ readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
4339+ readonly property alias swipping: mainItemMoving.running
4340+
4341+ signal itemClicked(var mouse)
4342+ signal itemPressAndHold(var mouse)
4343+
4344+ function returnToBoundsRTL()
4345+ {
4346+ var actionFullWidth = actionWidth + units.gu(2)
4347+ var xOffset = Math.abs(main.x)
4348+ var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
4349+
4350+ if (index < 1) {
4351+ main.x = 0
4352+ } else if (index === rightSideActions.length) {
4353+ main.x = -rightActionsView.width
4354+ } else {
4355+ main.x = -(actionFullWidth * index)
4356+ }
4357+ }
4358+
4359+ function returnToBoundsLTR()
4360+ {
4361+ var finalX = leftActionWidth
4362+ if (main.x > (finalX * root.threshold))
4363+ main.x = finalX
4364+ else
4365+ main.x = 0
4366+ }
4367+
4368+ function returnToBounds()
4369+ {
4370+ if (main.x < 0) {
4371+ returnToBoundsRTL()
4372+ } else if (main.x > 0) {
4373+ returnToBoundsLTR()
4374+ }
4375+ }
4376+
4377+ function contains(item, point)
4378+ {
4379+ return (point.x >= item.x) && (point.x <= (item.x + item.width)) && (point.y >= item.y) && (point.y <= (item.y + item.height));
4380+ }
4381+
4382+ function getActionAt(point)
4383+ {
4384+ if (contains(leftActionView, point)) {
4385+ return leftSideAction
4386+ } else if (contains(rightActionsView, point)) {
4387+ var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
4388+ for (var i = 0; i < rightActionsRepeater.count; i++) {
4389+ var child = rightActionsRepeater.itemAt(i)
4390+ if (contains(child, newPoint)) {
4391+ return i
4392+ }
4393+ }
4394+ }
4395+ return -1
4396+ }
4397+
4398+ function updateActiveAction()
4399+ {
4400+ if ((main.x <= -root.actionWidth) &&
4401+ (main.x > -rightActionsView.width)) {
4402+ var actionFullWidth = actionWidth + units.gu(2)
4403+ var xOffset = Math.abs(main.x)
4404+ var index = Math.min(Math.floor(xOffset / actionFullWidth), rightSideActions.length)
4405+ index = index - 1
4406+ if (index > -1) {
4407+ root.activeItem = rightActionsRepeater.itemAt(index)
4408+ root.activeAction = root.rightSideActions[index]
4409+ }
4410+ } else {
4411+ root.activeAction = null
4412+ }
4413+ }
4414+
4415+ function resetSwipe()
4416+ {
4417+ main.x = 0
4418+ }
4419+
4420+ states: [
4421+ State {
4422+ name: "select"
4423+ when: selectionMode || selected
4424+ PropertyChanges {
4425+ target: selectionIcon
4426+ source: Qt.resolvedUrl("ListItemWithActionsCheckBox.qml")
4427+ anchors.leftMargin: units.gu(2)
4428+ }
4429+ PropertyChanges {
4430+ target: root
4431+ locked: true
4432+ }
4433+ PropertyChanges {
4434+ target: main
4435+ x: 0
4436+ }
4437+ }
4438+ ]
4439+
4440+ height: defaultHeight
4441+ clip: height !== defaultHeight
4442+
4443+ Rectangle {
4444+ id: leftActionView
4445+
4446+ anchors {
4447+ top: parent.top
4448+ bottom: parent.bottom
4449+ right: main.left
4450+ }
4451+ width: root.leftActionWidth + actionThreshold
4452+ visible: leftSideAction
4453+ color: "red"
4454+
4455+ Icon {
4456+ anchors {
4457+ centerIn: parent
4458+ horizontalCenterOffset: actionThreshold / 2
4459+ }
4460+ name: leftSideAction ? leftSideAction.iconName : ""
4461+ color: Theme.palette.selected.field
4462+ height: units.gu(3)
4463+ width: units.gu(3)
4464+ }
4465+ }
4466+
4467+ Item {
4468+ id: rightActionsView
4469+
4470+ anchors {
4471+ top: main.top
4472+ left: main.right
4473+ leftMargin: units.gu(1)
4474+ bottom: main.bottom
4475+ }
4476+ visible: rightSideActions.length > 0
4477+ width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + actionThreshold : 0
4478+ Row {
4479+ anchors.fill: parent
4480+ spacing: units.gu(2)
4481+ Repeater {
4482+ id: rightActionsRepeater
4483+
4484+ model: rightSideActions
4485+ Item {
4486+ property alias image: img
4487+
4488+ anchors {
4489+ top: parent.top
4490+ bottom: parent.bottom
4491+ }
4492+ width: root.actionWidth
4493+
4494+ Icon {
4495+ id: img
4496+
4497+ anchors.centerIn: parent
4498+ width: units.gu(3)
4499+ height: units.gu(3)
4500+ name: iconName
4501+ color: root.activeAction === modelData || !root.triggerActionOnMouseRelease ? UbuntuColors.lightAubergine : Theme.palette.selected.background
4502+ }
4503+ }
4504+ }
4505+ }
4506+ }
4507+
4508+
4509+ Rectangle {
4510+ id: main
4511+ objectName: "mainItem"
4512+
4513+ anchors {
4514+ top: parent.top
4515+ bottom: parent.bottom
4516+ }
4517+
4518+ width: parent.width
4519+ color: root.selected ? root.selectedColor : root.color
4520+
4521+ Loader {
4522+ id: selectionIcon
4523+
4524+ anchors {
4525+ left: main.left
4526+ verticalCenter: main.verticalCenter
4527+ }
4528+ width: (status === Loader.Ready) ? item.implicitWidth : 0
4529+ visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
4530+ Behavior on width {
4531+ NumberAnimation {
4532+ duration: UbuntuAnimation.SnapDuration
4533+ }
4534+ }
4535+ }
4536+
4537+
4538+ Item {
4539+ id: mainContents
4540+
4541+ anchors {
4542+ left: selectionIcon.right
4543+ leftMargin: units.gu(2)
4544+ top: parent.top
4545+ topMargin: units.gu(1)
4546+ right: parent.right
4547+ rightMargin: units.gu(2)
4548+ bottom: parent.bottom
4549+ bottomMargin: units.gu(1)
4550+ }
4551+ }
4552+
4553+ Behavior on x {
4554+ UbuntuNumberAnimation {
4555+ id: mainItemMoving
4556+
4557+ easing.type: Easing.OutElastic
4558+ duration: UbuntuAnimation.SlowDuration
4559+ }
4560+ }
4561+ Behavior on color {
4562+ enabled: (root.color != root.selectedColor)
4563+ ColorAnimation {}
4564+ }
4565+ }
4566+
4567+ SequentialAnimation {
4568+ id: triggerAction
4569+
4570+ property var currentItem: root.activeItem ? root.activeItem.image : null
4571+
4572+ running: false
4573+ ParallelAnimation {
4574+ UbuntuNumberAnimation {
4575+ target: triggerAction.currentItem
4576+ property: "opacity"
4577+ from: 1.0
4578+ to: 0.0
4579+ duration: UbuntuAnimation.SlowDuration
4580+ easing {type: Easing.InOutBack; }
4581+ }
4582+ UbuntuNumberAnimation {
4583+ target: triggerAction.currentItem
4584+ properties: "width, height"
4585+ from: units.gu(3)
4586+ to: root.actionWidth
4587+ duration: UbuntuAnimation.SlowDuration
4588+ easing {type: Easing.InOutBack; }
4589+ }
4590+ }
4591+ PropertyAction {
4592+ target: triggerAction.currentItem
4593+ properties: "width, height"
4594+ value: units.gu(3)
4595+ }
4596+ PropertyAction {
4597+ target: triggerAction.currentItem
4598+ properties: "opacity"
4599+ value: 1.0
4600+ }
4601+ ScriptAction {
4602+ script: root.activeAction.triggered(root)
4603+ }
4604+ PauseAnimation {
4605+ duration: 500
4606+ }
4607+ UbuntuNumberAnimation {
4608+ target: main
4609+ property: "x"
4610+ to: 0
4611+
4612+ }
4613+ }
4614+
4615+ MouseArea {
4616+ id: mouseArea
4617+
4618+ property bool locked: root.locked || ((root.leftSideAction === null) && (root.rightSideActions.count === 0))
4619+ property bool manual: false
4620+
4621+ anchors.fill: parent
4622+ drag {
4623+ target: locked ? null : main
4624+ axis: Drag.XAxis
4625+ minimumX: rightActionsView.visible ? -(rightActionsView.width + root.actionThreshold) : 0
4626+ maximumX: leftActionView.visible ? leftActionView.width : 0
4627+ }
4628+
4629+ onReleased: {
4630+ if (root.triggerActionOnMouseRelease && root.activeAction) {
4631+ triggerAction.start()
4632+ } else {
4633+ root.returnToBounds()
4634+ root.activeAction = null
4635+ }
4636+ }
4637+ onClicked: {
4638+ if (main.x === 0) {
4639+ root.itemClicked(mouse)
4640+ } else if (main.x > 0) {
4641+ var action = getActionAt(Qt.point(mouse.x, mouse.y))
4642+ if (action && action !== -1) {
4643+ action.triggered(root)
4644+ }
4645+ } else {
4646+ var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
4647+ if (actionIndex !== -1) {
4648+ root.activeItem = rightActionsRepeater.itemAt(actionIndex)
4649+ root.activeAction = root.rightSideActions[actionIndex]
4650+ triggerAction.start()
4651+ return
4652+ }
4653+ }
4654+ root.resetSwipe()
4655+ }
4656+
4657+ onPositionChanged: {
4658+ if (mouseArea.pressed) {
4659+ updateActiveAction()
4660+ }
4661+ }
4662+ onPressAndHold: {
4663+ if (main.x === 0) {
4664+ root.itemPressAndHold(mouse)
4665+ }
4666+ }
4667+ z: -1
4668+ }
4669+}
4670
4671=== added file 'app/upstreamcomponents/ListItemWithActionsCheckBox.qml'
4672--- app/upstreamcomponents/ListItemWithActionsCheckBox.qml 1970-01-01 00:00:00 +0000
4673+++ app/upstreamcomponents/ListItemWithActionsCheckBox.qml 2014-08-12 22:08:22 +0000
4674@@ -0,0 +1,25 @@
4675+/*
4676+ * Copyright (C) 2012-2014 Canonical, Ltd.
4677+ *
4678+ * This program is free software; you can redistribute it and/or modify
4679+ * it under the terms of the GNU General Public License as published by
4680+ * the Free Software Foundation; version 3.
4681+ *
4682+ * This program is distributed in the hope that it will be useful,
4683+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4684+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4685+ * GNU General Public License for more details.
4686+ *
4687+ * You should have received a copy of the GNU General Public License
4688+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4689+ */
4690+
4691+import QtQuick 2.2
4692+import Ubuntu.Components 1.1
4693+
4694+CheckBox {
4695+ checked: root.selected
4696+ width: implicitWidth
4697+ // disable item mouse area to avoid conflicts with parent mouse area
4698+ __mouseArea.enabled: false
4699+}
4700
4701=== added file 'app/upstreamcomponents/MultipleSelectionListView.qml'
4702--- app/upstreamcomponents/MultipleSelectionListView.qml 1970-01-01 00:00:00 +0000
4703+++ app/upstreamcomponents/MultipleSelectionListView.qml 2014-08-12 22:08:22 +0000
4704@@ -0,0 +1,199 @@
4705+/*
4706+ * Copyright (C) 2013 Canonical, Ltd.
4707+ *
4708+ * This program is free software; you can redistribute it and/or modify
4709+ * it under the terms of the GNU General Public License as published by
4710+ * the Free Software Foundation; version 3.
4711+ *
4712+ * This program is distributed in the hope that it will be useful,
4713+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4714+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4715+ * GNU General Public License for more details.
4716+ *
4717+ * You should have received a copy of the GNU General Public License
4718+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4719+ */
4720+
4721+import QtQuick 2.2
4722+import Ubuntu.Components 1.1
4723+import Ubuntu.Components.Popups 1.0 as Popups
4724+
4725+/*!
4726+ \qmltype ContactSimpleListView
4727+ \inqmlmodule Ubuntu.Contacts 0.1
4728+ \ingroup ubuntu
4729+ \brief The MultipleSelectionListView provides a ListView with support to multiple selection
4730+
4731+ The MultipleSelectionListViewprovides a ListView with support to multiple selection which can be used by any
4732+ application.
4733+
4734+ Example:
4735+ \qml
4736+ import Ubuntu.Contacts 0.1
4737+
4738+ MultipleSelectionListView {
4739+ id: view
4740+ anchors.fill: paret
4741+ model: 100
4742+ delegate: Rectangle {
4743+ width: parent.width
4744+ height: 100
4745+ color: view.selectedItems.indexOf(index) == -1 ? "white" : "blue"
4746+
4747+ MouseArea {
4748+ anchors.fill: parent
4749+ onClicked: {
4750+ if (view.isInSelectionModel) {
4751+ view.selectItem(index)
4752+ }
4753+ }
4754+ onPressAndHold: view.startSelection()
4755+ }
4756+ }
4757+ onSelectionDone: console.debug("Selected items:" + view.selectedItems)
4758+ }
4759+ \endqml
4760+*/
4761+
4762+ListView {
4763+ id: listView
4764+
4765+ /*!
4766+ \qmlproperty model selectedItems
4767+
4768+ This property holds the list of selected items
4769+ */
4770+ readonly property alias selectedItems: visualModel.selectedItems
4771+ /*!
4772+ \qmlproperty bool multipleSelection
4773+
4774+ This property holds if the selection will accept multiple items or single items
4775+ */
4776+ property bool multipleSelection: true
4777+
4778+ /*!
4779+ \qmlproperty model listModel
4780+
4781+ This property holds the model providing data for the list.
4782+ */
4783+ property alias listModel: visualModel.model
4784+ /*!
4785+ \qmlproperty Component listDelegate
4786+
4787+ The delegate provides a template defining each item instantiated by the view.
4788+ */
4789+ property alias listDelegate: visualModel.delegate
4790+
4791+ /*!
4792+ \qmlproperty bool isInSelectionMode
4793+
4794+ This property holds a list with the index of selected items
4795+ */
4796+ readonly property bool isInSelectionMode: state === "selection"
4797+ /*!
4798+ This handler is called when the selection mode is finished without be canceled
4799+ */
4800+ signal selectionDone(var items)
4801+ /*!
4802+ This handler is called when the selection mode is canceled
4803+ */
4804+ signal selectionCanceled()
4805+
4806+ /*!
4807+ Start the selection mode on the list view.
4808+ */
4809+ function startSelection()
4810+ {
4811+ state = "selection"
4812+ }
4813+ /*!
4814+ Check if the item is selected
4815+ Returns true if the item was marked as selected or false if the item is unselected
4816+ */
4817+ function isSelected(item)
4818+ {
4819+ if (item && item.VisualDataModel) {
4820+ return (item.VisualDataModel.inSelected === true)
4821+ } else {
4822+ return false
4823+ }
4824+ }
4825+ /*!
4826+ Mark the item as selected
4827+ Returns true if the item was marked as selected or false if the item is already selected
4828+ */
4829+ function selectItem(item)
4830+ {
4831+ if (item.VisualDataModel.inSelected) {
4832+ return false
4833+ } else {
4834+ if (!multipleSelection) {
4835+ clearSelection()
4836+ }
4837+ item.VisualDataModel.inSelected = true
4838+ return true
4839+ }
4840+ }
4841+ /*!
4842+ Remove the index from the selected list
4843+ */
4844+ function deselectItem(item)
4845+ {
4846+ var result = false
4847+ if (item.VisualDataModel.inSelected) {
4848+ item.VisualDataModel.inSelected = false
4849+ result = true
4850+ }
4851+ return result
4852+ }
4853+ /*!
4854+ Finish the selection mode with sucess
4855+ */
4856+ function endSelection()
4857+ {
4858+ selectionDone(listView.selectedItems)
4859+ clearSelection()
4860+ state = ""
4861+ }
4862+ /*!
4863+ Cancel the selection
4864+ */
4865+ function cancelSelection()
4866+ {
4867+ selectionCanceled()
4868+ clearSelection()
4869+ state = ""
4870+ }
4871+ /*!
4872+ Remove any selected item from the selection list
4873+ */
4874+ function clearSelection()
4875+ {
4876+ if (selectedItems.count > 0) {
4877+ selectedItems.remove(0, selectedItems.count)
4878+ }
4879+ }
4880+ /*!
4881+ Select all items in the list
4882+ */
4883+ function selectAll()
4884+ {
4885+ if (multipleSelection) {
4886+ visualModel.items.addGroups(0, visualModel.items.count, ["selected"] )
4887+ }
4888+ }
4889+
4890+ model: visualModel
4891+
4892+ MultipleSelectionVisualModel {
4893+ id: visualModel
4894+ }
4895+
4896+ Component.onCompleted: {
4897+ // FIXME: workaround for qtubuntu not returning values depending on the grid unit definition
4898+ // for Flickable.maximumFlickVelocity and Flickable.flickDeceleration
4899+ var scaleFactor = units.gridUnit / 8;
4900+ maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
4901+ flickDeceleration = flickDeceleration * scaleFactor;
4902+ }
4903+}
4904
4905=== added file 'app/upstreamcomponents/MultipleSelectionVisualModel.qml'
4906--- app/upstreamcomponents/MultipleSelectionVisualModel.qml 1970-01-01 00:00:00 +0000
4907+++ app/upstreamcomponents/MultipleSelectionVisualModel.qml 2014-08-12 22:08:22 +0000
4908@@ -0,0 +1,31 @@
4909+/*
4910+ * Copyright (C) 2012-2013 Canonical, Ltd.
4911+ *
4912+ * This program is free software; you can redistribute it and/or modify
4913+ * it under the terms of the GNU General Public License as published by
4914+ * the Free Software Foundation; version 3.
4915+ *
4916+ * This program is distributed in the hope that it will be useful,
4917+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4918+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4919+ * GNU General Public License for more details.
4920+ *
4921+ * You should have received a copy of the GNU General Public License
4922+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4923+ */
4924+
4925+import QtQuick 2.2
4926+
4927+VisualDataModel {
4928+ id: contactVisualModel
4929+
4930+ property alias selectedItems: selectedGroup
4931+
4932+ groups: [
4933+ VisualDataGroup {
4934+ id: selectedGroup
4935+
4936+ name: "selected"
4937+ }
4938+ ]
4939+}
4940
4941=== added file 'app/upstreamcomponents/PageWithBottomEdge.qml'
4942--- app/upstreamcomponents/PageWithBottomEdge.qml 1970-01-01 00:00:00 +0000
4943+++ app/upstreamcomponents/PageWithBottomEdge.qml 2014-08-12 22:08:22 +0000
4944@@ -0,0 +1,396 @@
4945+/*
4946+ * Copyright (C) 2014 Canonical, Ltd.
4947+ *
4948+ * This program is free software; you can redistribute it and/or modify
4949+ * it under the terms of the GNU General Public License as published by
4950+ * the Free Software Foundation; version 3.
4951+ *
4952+ * This program is distributed in the hope that it will be useful,
4953+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4954+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4955+ * GNU General Public License for more details.
4956+ *
4957+ * You should have received a copy of the GNU General Public License
4958+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4959+ */
4960+
4961+/*
4962+ Example:
4963+
4964+ MainView {
4965+ objectName: "mainView"
4966+
4967+ applicationName: "com.ubuntu.developer.boiko.bottomedge"
4968+
4969+ width: units.gu(100)
4970+ height: units.gu(75)
4971+
4972+ Component {
4973+ id: pageComponent
4974+
4975+ PageWithBottomEdge {
4976+ id: mainPage
4977+ title: i18n.tr("Main Page")
4978+
4979+ Rectangle {
4980+ anchors.fill: parent
4981+ color: "white"
4982+ }
4983+
4984+ bottomEdgePageComponent: Page {
4985+ title: "Contents"
4986+ anchors.fill: parent
4987+ //anchors.topMargin: contentsPage.flickable.contentY
4988+
4989+ ListView {
4990+ anchors.fill: parent
4991+ model: 50
4992+ delegate: ListItems.Standard {
4993+ text: "One Content Item: " + index
4994+ }
4995+ }
4996+ }
4997+ bottomEdgeTitle: i18n.tr("Bottom edge action")
4998+ }
4999+ }
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches