Merge lp:~nik90/ubuntu-clock-app/add-utility-backend into lp:ubuntu-clock-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Bartosz Kosiorek
Approved revision: 349
Merged at revision: 341
Proposed branch: lp:~nik90/ubuntu-clock-app/add-utility-backend
Merge into: lp:ubuntu-clock-app
Diff against target: 275 lines (+182/-2)
7 files modified
backend/CMakeLists.txt (+24/-2)
backend/modules/Clock/Utility/backend.cpp (+34/-0)
backend/modules/Clock/Utility/backend.h (+35/-0)
backend/modules/Clock/Utility/customalarmsound.cpp (+39/-0)
backend/modules/Clock/Utility/customalarmsound.h (+46/-0)
backend/modules/Clock/Utility/qmldir (+2/-0)
debian/changelog (+2/-0)
To merge this branch: bzr merge lp:~nik90/ubuntu-clock-app/add-utility-backend
Reviewer Review Type Date Requested Status
Bartosz Kosiorek Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+268490@code.launchpad.net

Commit message

Added a clock utility c++ plugin housing customalarmsound type which is needed for the upcoming custom alarm sound feature.

Description of the change

Added a c++ backend plugin for
a) deleting files
b) returning the QStandardPath /home/phablet/.local/share/com.ubuntu.clock

This is necessary for the upcoming custom-alarm-sound feature implementation which requires the above mentioned functionalities.

To post a comment you must log in.
343. By Nekhelesh Ramananthan

removed clock utility import

344. By Nekhelesh Ramananthan

Fixed copyright year in backend.h

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
345. By Nekhelesh Ramananthan

Remove qCritical statement

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

some inline comments.

review: Needs Information
346. By Nekhelesh Ramananthan

Merged standardpath and filemanagement into customalarmsound

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
347. By Nekhelesh Ramananthan

Updated debian changelog

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
348. By Nekhelesh Ramananthan

Removed Quick and GUI module loading for clock utility

349. By Nekhelesh Ramananthan

Merged lp:ubuntu-clock-app

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

* Does the MP add/remove user visible strings? If Yes, has the pot file been
    updated?

No strings changed.

* Does the MP change the UI? If Yes, has it been approved by design?

No UX change

* Did you perform an exploratory manual test run of your code change and any
    related functionality?

Extensive testing done on desktop and phone

* If the MP fixes a bug or implements a feature, are there accompanying unit
    and autopilot tests?

Not required

* Is the clock app trunk buildable and runnable using Qtcreator?

Yes
* Was the debian changelog updated?

Yes

* Was the copyright years updated if necessary?

Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'backend/CMakeLists.txt'
2--- backend/CMakeLists.txt 2015-08-18 05:03:59 +0000
3+++ backend/CMakeLists.txt 2015-08-20 21:15:16 +0000
4@@ -35,6 +35,12 @@
5 )
6
7 set(
8+ clockutility_SRCS
9+ modules/Clock/Utility/backend.cpp
10+ modules/Clock/Utility/customalarmsound.cpp
11+)
12+
13+set(
14 stopwatchlaphistory_SRCS
15 modules/Stopwatch/LapHistory/backend.cpp
16 modules/Stopwatch/LapHistory/history.cpp
17@@ -56,11 +62,14 @@
18 ${geolocation_SRCS}
19 )
20
21+add_library(clockutility MODULE
22+ ${clockutility_SRCS}
23+)
24+
25 add_library(stopwatchlaphistory MODULE
26 ${stopwatchlaphistory_SRCS}
27 )
28
29-
30 set_target_properties(timezone PROPERTIES
31 LIBRARY_OUTPUT_DIRECTORY Timezone
32 )
33@@ -77,6 +86,10 @@
34 LIBRARY_OUTPUT_DIRECTORY GeoLocation
35 )
36
37+set_target_properties(clockutility PROPERTIES
38+ LIBRARY_OUTPUT_DIRECTORY Clock/Utility
39+)
40+
41 set_target_properties(stopwatchlaphistory PROPERTIES
42 LIBRARY_OUTPUT_DIRECTORY Stopwatch/LapHistory
43 )
44@@ -85,6 +98,7 @@
45 qt5_use_modules(timezone Gui Qml Quick)
46 qt5_use_modules(alarmsettings Gui Qml Quick DBus)
47 qt5_use_modules(geolocation Gui Qml Quick)
48+qt5_use_modules(clockutility Qml)
49 qt5_use_modules(stopwatchlaphistory Qml)
50
51 # Copy qmldir file to build dir for running in QtCreator
52@@ -108,12 +122,16 @@
53 DEPENDS ${QMLFILES}
54 )
55
56+add_custom_target(clockutility-qmldir ALL
57+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/modules/Clock/Utility/qmldir ${CMAKE_CURRENT_BINARY_DIR}/Clock/Utility
58+ DEPENDS ${QMLFILES}
59+)
60+
61 add_custom_target(stopwatchlaphistory-qmldir ALL
62 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/modules/Stopwatch/LapHistory/qmldir ${CMAKE_CURRENT_BINARY_DIR}/Stopwatch/LapHistory
63 DEPENDS ${QMLFILES}
64 )
65
66-
67 # Install plugin file
68 install(TARGETS timezone DESTINATION ${MODULE_PATH}/Timezone/)
69 install(FILES modules/Timezone/qmldir DESTINATION ${MODULE_PATH}/Timezone/)
70@@ -127,5 +145,9 @@
71 install(TARGETS geolocation DESTINATION ${MODULE_PATH}/GeoLocation/)
72 install(FILES modules/GeoLocation/qmldir DESTINATION ${MODULE_PATH}/GeoLocation/)
73
74+install(TARGETS clockutility DESTINATION ${MODULE_PATH}/Clock/Utility/)
75+install(FILES modules/Clock/Utility/qmldir DESTINATION ${MODULE_PATH}/Clock/Utility/)
76+
77 install(TARGETS stopwatchlaphistory DESTINATION ${MODULE_PATH}/Stopwatch/LapHistory/)
78 install(FILES modules/Stopwatch/LapHistory/qmldir DESTINATION ${MODULE_PATH}/Stopwatch/LapHistory/)
79+
80
81=== added directory 'backend/modules/Clock'
82=== added directory 'backend/modules/Clock/Utility'
83=== added file 'backend/modules/Clock/Utility/backend.cpp'
84--- backend/modules/Clock/Utility/backend.cpp 1970-01-01 00:00:00 +0000
85+++ backend/modules/Clock/Utility/backend.cpp 2015-08-20 21:15:16 +0000
86@@ -0,0 +1,34 @@
87+/*
88+ * Copyright (C) 2015 Canonical Ltd
89+ *
90+ * This file is part of Ubuntu Clock App
91+ *
92+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
93+ * it under the terms of the GNU General Public License version 3 as
94+ * published by the Free Software Foundation.
95+ *
96+ * Ubuntu Clock App is distributed in the hope that it will be useful,
97+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
98+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99+ * GNU General Public License for more details.
100+ *
101+ * You should have received a copy of the GNU General Public License
102+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
103+ */
104+
105+#include <QtQml>
106+#include <QtQml/QQmlContext>
107+#include "backend.h"
108+#include "customalarmsound.h"
109+
110+void BackendPlugin::registerTypes(const char *uri)
111+{
112+ Q_ASSERT(uri == QLatin1String("Clock.Utility"));
113+
114+ qmlRegisterType<CustomAlarmSound>(uri, 1, 0, "CustomAlarmSound");
115+}
116+
117+void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
118+{
119+ QQmlExtensionPlugin::initializeEngine(engine, uri);
120+}
121
122=== added file 'backend/modules/Clock/Utility/backend.h'
123--- backend/modules/Clock/Utility/backend.h 1970-01-01 00:00:00 +0000
124+++ backend/modules/Clock/Utility/backend.h 2015-08-20 21:15:16 +0000
125@@ -0,0 +1,35 @@
126+/*
127+ * Copyright (C) 2015 Canonical Ltd
128+ *
129+ * This file is part of Ubuntu Clock App
130+ *
131+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
132+ * it under the terms of the GNU General Public License version 3 as
133+ * published by the Free Software Foundation.
134+ *
135+ * Ubuntu Clock App is distributed in the hope that it will be useful,
136+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
137+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
138+ * GNU General Public License for more details.
139+ *
140+ * You should have received a copy of the GNU General Public License
141+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
142+ */
143+
144+#ifndef BACKEND_PLUGIN_H
145+#define BACKEND_PLUGIN_H
146+
147+#include <QtQml/QQmlEngine>
148+#include <QtQml/QQmlExtensionPlugin>
149+
150+class BackendPlugin : public QQmlExtensionPlugin
151+{
152+ Q_OBJECT
153+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
154+
155+public:
156+ void registerTypes(const char *uri);
157+ void initializeEngine(QQmlEngine *engine, const char *uri);
158+};
159+#endif // BACKEND_PLUGIN_H
160+
161
162=== added file 'backend/modules/Clock/Utility/customalarmsound.cpp'
163--- backend/modules/Clock/Utility/customalarmsound.cpp 1970-01-01 00:00:00 +0000
164+++ backend/modules/Clock/Utility/customalarmsound.cpp 2015-08-20 21:15:16 +0000
165@@ -0,0 +1,39 @@
166+/*
167+ * Copyright (C) 2015 Canonical Ltd
168+ *
169+ * This file is part of Ubuntu Clock App
170+ *
171+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
172+ * it under the terms of the GNU General Public License version 3 as
173+ * published by the Free Software Foundation.
174+ *
175+ * Ubuntu Clock App is distributed in the hope that it will be useful,
176+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
177+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
178+ * GNU General Public License for more details.
179+ *
180+ * You should have received a copy of the GNU General Public License
181+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
182+ */
183+
184+#include <QDir>
185+#include <QStandardPaths>
186+
187+#include "customalarmsound.h"
188+
189+CustomAlarmSound::CustomAlarmSound(QObject *parent):
190+ QObject(parent),
191+ m_customAlarmDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).first())
192+{
193+}
194+
195+QString CustomAlarmSound::alarmSoundDirectory() const
196+{
197+ return m_customAlarmDir;
198+}
199+
200+void CustomAlarmSound::deleteAlarmSound(const QString &soundName)
201+{
202+ QDir dir(m_customAlarmDir);
203+ dir.remove(soundName);
204+}
205
206=== added file 'backend/modules/Clock/Utility/customalarmsound.h'
207--- backend/modules/Clock/Utility/customalarmsound.h 1970-01-01 00:00:00 +0000
208+++ backend/modules/Clock/Utility/customalarmsound.h 2015-08-20 21:15:16 +0000
209@@ -0,0 +1,46 @@
210+/*
211+ * Copyright (C) 2015 Canonical Ltd
212+ *
213+ * This file is part of Ubuntu Clock App
214+ *
215+ * Ubuntu Clock App is free software: you can redistribute it and/or modify
216+ * it under the terms of the GNU General Public License version 3 as
217+ * published by the Free Software Foundation.
218+ *
219+ * Ubuntu Clock App is distributed in the hope that it will be useful,
220+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
221+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
222+ * GNU General Public License for more details.
223+ *
224+ * You should have received a copy of the GNU General Public License
225+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
226+ */
227+
228+#ifndef CUSTOMALARMSOUND_H
229+#define CUSTOMALARMSOUND_H
230+
231+#include <QObject>
232+
233+class CustomAlarmSound: public QObject
234+{
235+ Q_OBJECT
236+
237+ // READONLY Property to return the custom alarm sound directory path
238+ Q_PROPERTY( QString alarmSoundDirectory
239+ READ alarmSoundDirectory)
240+
241+public:
242+ CustomAlarmSound(QObject *parent = 0);
243+
244+ // Function to return the custom alarm sound directory path
245+ QString alarmSoundDirectory() const;
246+
247+public slots:
248+ // Function to delete a custom alarm sound
249+ void deleteAlarmSound(const QString &soundName);
250+
251+private:
252+ QString m_customAlarmDir;
253+};
254+
255+#endif
256
257=== added file 'backend/modules/Clock/Utility/qmldir'
258--- backend/modules/Clock/Utility/qmldir 1970-01-01 00:00:00 +0000
259+++ backend/modules/Clock/Utility/qmldir 2015-08-20 21:15:16 +0000
260@@ -0,0 +1,2 @@
261+module Clock.Utility
262+plugin clockutility
263
264=== modified file 'debian/changelog'
265--- debian/changelog 2015-08-20 20:37:03 +0000
266+++ debian/changelog 2015-08-20 21:15:16 +0000
267@@ -16,6 +16,8 @@
268 * Added README.mergeproposal checklist to help with the review process.
269 * Fix alarm interval information being inconsistent (LP: #1466000)
270 * Changed default alarm sound (LP: #1354370)
271+ * Added Clock Utility C++ plugin housing CustomAlarmSound type required
272+ for custom alarm sound feature
273
274 [Victor Thompson]
275 * Show all README files in QtCreator

Subscribers

People subscribed via source and target branches