Merge lp:~seb128/phone-app/ringtone-in-gsettings into lp:phone-app

Proposed by Sebastien Bacher
Status: Work in progress
Proposed branch: lp:~seb128/phone-app/ringtone-in-gsettings
Merge into: lp:phone-app
Diff against target: 179 lines (+68/-5)
9 files modified
CMakeLists.txt (+2/-0)
cmake/modules/UseGSettings.cmake (+23/-0)
debian/control (+2/-0)
debian/phone-app.install (+1/-0)
libphoneapp/CMakeLists.txt (+2/-1)
libphoneapp/ringtone.cpp (+3/-4)
libphoneapp/ringtone.h (+2/-0)
schemas/CMakeLists.txt (+18/-0)
schemas/com.ubuntu.touch.phone-app.gschema.xml.in (+15/-0)
To merge this branch: bzr merge lp:~seb128/phone-app/ringtone-in-gsettings
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Lars Karlitski (community) Approve
Review via email: mp+176968@code.launchpad.net

Commit message

store the ringtone and new message sounds in gsettings

Description of the change

store the ringtone and new message sounds in gsettings

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Those changes are making the sounds to use for call/messages to be read from gsettings/customizable, see https://bugs.launchpad.net/phone-app/+bug/1202253 for some details

Note that I've not been able to actual test the runtime behaviour, because I don't have a working phone with a SIM ... is there any way to simulate phone calls on a desktop? The code build and is working fine in a standalone test application.

717. By Sebastien Bacher

store the ringtone and new message sounds in gsettings

Revision history for this message
Lars Karlitski (larsu) wrote :

> +find_library(QGSETTINGS_LIB gsettings-qt)

The cmake-foo is not strong with me, but I think you should use something like find_package here to pick up the pkg-config file.

> +#include <QGSettings/QGSettings>

This should only be "#include <QGSettings>". The pkgconfig file already points to the QGSettings directory, so that should work as soon as you pull in its cflags.

schemas/com.ubuntu.touch.phone-app.gschema.xml.in:
  * the summary and description for incoming-call-sound and incoming-message-sound are the same
  * the absolute paths are a bit weird - don't we have sound themes based on xdg dirs like we do for icons?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
718. By Sebastien Bacher

use correct include

Revision history for this message
Sebastien Bacher (seb128) wrote :

> The cmake-foo is not strong with me, but I think you should use something like find_package here to pick up > the pkg-config file.

Thanks ... the new gsettings-qt (which features a .pc) was not available in saucy yet when I started and I though there was no .pc to use ... fixed that in r719

> This should only be "#include <QGSettings>". The pkgconfig file already points to the QGSettings directory, so that should work as soon as you pull in its cflags.

Thanks, that was a side-effect of not having the pkgconfig, fixed in r718

> schemas/com.ubuntu.touch.phone-app.gschema.xml.in:
> * the summary and description for incoming-call-sound and incoming-message-sound are the same

Fixed that one as well

> * the absolute paths are a bit weird - don't we have sound themes based on xdg dirs like we do for icons?

I've no strong opinion, I went with the current approch since it allows to set a file anywhere on disk (e.g a music from your xdg music dir), I'm not sure if you can do that with the theme spec.

I think the spec makes sense for system effects for example, maybe not in that "custom sound" case

719. By Sebastien Bacher

use pkgconfig since gsettings-qt just got one

Revision history for this message
Lars Karlitski (larsu) wrote :

> I've no strong opinion, I went with the current approch since it allows to set
> a file anywhere on disk (e.g a music from your xdg music dir), I'm not sure if
> you can do that with the theme spec.
>
> I think the spec makes sense for system effects for example, maybe not in that
> "custom sound" case

Okay, that makes sense.

Thanks for the quick fixes. Looks good to me now.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

719. By Sebastien Bacher

use pkgconfig since gsettings-qt just got one

718. By Sebastien Bacher

use correct include

717. By Sebastien Bacher

store the ringtone and new message sounds in gsettings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-05-24 13:08:32 +0000
+++ CMakeLists.txt 2013-07-25 16:20:35 +0000
@@ -62,6 +62,7 @@
62pkg_check_modules(GLIB REQUIRED glib-2.0)62pkg_check_modules(GLIB REQUIRED glib-2.0)
63pkg_check_modules(NOTIFY REQUIRED libnotify)63pkg_check_modules(NOTIFY REQUIRED libnotify)
64pkg_check_modules(MESSAGING_MENU REQUIRED messaging-menu)64pkg_check_modules(MESSAGING_MENU REQUIRED messaging-menu)
65pkg_check_modules(GSETTINGS REQUIRED gsettings-qt)
6566
66# Check if the messaging menu has the message header67# Check if the messaging menu has the message header
67set(CMAKE_REQUIRED_INCLUDES ${MESSAGING_MENU_INCLUDE_DIRS})68set(CMAKE_REQUIRED_INCLUDES ${MESSAGING_MENU_INCLUDE_DIRS})
@@ -89,3 +90,4 @@
89add_subdirectory(icons)90add_subdirectory(icons)
90add_subdirectory(tests)91add_subdirectory(tests)
91add_subdirectory(po)92add_subdirectory(po)
93add_subdirectory(schemas)
9294
=== added file 'cmake/modules/UseGSettings.cmake'
--- cmake/modules/UseGSettings.cmake 1970-01-01 00:00:00 +0000
+++ cmake/modules/UseGSettings.cmake 2013-07-25 16:20:35 +0000
@@ -0,0 +1,23 @@
1# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
2
3macro(add_schema SCHEMA_NAME)
4
5 set(PKG_CONFIG_EXECUTABLE pkg-config)
6 set(GSETTINGS_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/glib-2.0/schemas")
7
8 # Run the validator and error if it fails
9 execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_compile_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
10 execute_process (COMMAND ${_glib_compile_schemas} --dry-run --schema-file=${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
11
12 if (_schemas_invalid)
13 message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
14 endif (_schemas_invalid)
15
16 # Actually install and recomple schemas
17 message (STATUS "${GSETTINGS_DIR} is the GSettings install dir")
18 install (FILES ${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
19
20 install (CODE "message (STATUS \"Compiling GSettings schemas\")")
21 install (CODE "execute_process (COMMAND ${_glib_compile_schemas} ${GSETTINGS_DIR})")
22endmacro()
23
024
=== modified file 'debian/control'
--- debian/control 2013-06-27 13:27:53 +0000
+++ debian/control 2013-07-25 16:20:35 +0000
@@ -7,6 +7,8 @@
7 dh-translations,7 dh-translations,
8 libgl1-mesa-dev | libgl-dev,8 libgl1-mesa-dev | libgl-dev,
9 libgles2-mesa-dev,9 libgles2-mesa-dev,
10 libglib2.0-dev,
11 libgsettings-qt-dev,
10 libicu-dev,12 libicu-dev,
11 libmessaging-menu-dev,13 libmessaging-menu-dev,
12 libnotify-dev,14 libnotify-dev,
1315
=== modified file 'debian/phone-app.install'
--- debian/phone-app.install 2013-05-24 13:08:32 +0000
+++ debian/phone-app.install 2013-07-25 16:20:35 +0000
@@ -2,6 +2,7 @@
2etc/xdg/autostart/phone-app-approver.desktop2etc/xdg/autostart/phone-app-approver.desktop
3usr/share/icons/hicolor/*/apps/phone-app*.png3usr/share/icons/hicolor/*/apps/phone-app*.png
4usr/share/icons/ubuntu-mono-dark/status/*/indicator-call.svg4usr/share/icons/ubuntu-mono-dark/status/*/indicator-call.svg
5usr/share/glib-2.0
5usr/share/applications/phone-app*.desktop6usr/share/applications/phone-app*.desktop
6usr/share/dbus-1/services/*PhoneApp*.service7usr/share/dbus-1/services/*PhoneApp*.service
7usr/share/notify-osd/icons/gnome/scalable/status/notification-unknown-call.svg8usr/share/notify-osd/icons/gnome/scalable/status/notification-unknown-call.svg
89
=== modified file 'libphoneapp/CMakeLists.txt'
--- libphoneapp/CMakeLists.txt 2013-04-03 19:25:46 +0000
+++ libphoneapp/CMakeLists.txt 2013-07-25 16:20:35 +0000
@@ -21,11 +21,12 @@
21 ${TPL_QT5_INCLUDE_DIRS}21 ${TPL_QT5_INCLUDE_DIRS}
22 ${QTGLIB_INCLUDE_DIRS}22 ${QTGLIB_INCLUDE_DIRS}
23 ${GLIB_INCLUDE_DIRS}23 ${GLIB_INCLUDE_DIRS}
24 ${GSETTINGS_INCLUDE_DIRS}
24 )25 )
2526
2627
27add_library(phoneapp STATIC ${library_SRCS} ${library_HDRS})28add_library(phoneapp STATIC ${library_SRCS} ${library_HDRS})
28target_link_libraries(phoneapp ${TP_QT5_LIBRARIES})29target_link_libraries(phoneapp ${TP_QT5_LIBRARIES} ${GSETTINGS_LIBRARIES})
2930
30qt5_use_modules(phoneapp Contacts Core DBus Multimedia Qml Quick)31qt5_use_modules(phoneapp Contacts Core DBus Multimedia Qml Quick)
3132
3233
=== modified file 'libphoneapp/ringtone.cpp'
--- libphoneapp/ringtone.cpp 2013-03-11 22:22:35 +0000
+++ libphoneapp/ringtone.cpp 2013-07-25 16:20:35 +0000
@@ -22,12 +22,11 @@
22#include "ringtone.h"22#include "ringtone.h"
23#include <QDebug>23#include <QDebug>
2424
25#define SOUND_PATH "/usr/share/sounds/ubuntu/stereo/"
26Ringtone::Ringtone(QObject *parent) :25Ringtone::Ringtone(QObject *parent) :
27 QObject(parent),26 QObject(parent),
28 mCallAudioPlayer(this), mCallAudioPlaylist(this), mMessageAudioPlayer(this)27 mCallAudioPlayer(this), mCallAudioPlaylist(this), mMessageAudioPlayer(this), mSoundSettings("com.ubuntu.touch.phone-app")
29{28{
30 mCallAudioPlaylist.addMedia(QUrl::fromLocalFile(SOUND_PATH "phone-incoming-call.ogg"));29 mCallAudioPlaylist.addMedia(QUrl::fromLocalFile(mSoundSettings.get("incomingCallSound").toString()));
31 mCallAudioPlaylist.setPlaybackMode(QMediaPlaylist::Loop);30 mCallAudioPlaylist.setPlaybackMode(QMediaPlaylist::Loop);
32 mCallAudioPlaylist.setCurrentIndex(0);31 mCallAudioPlaylist.setCurrentIndex(0);
33}32}
@@ -60,7 +59,7 @@
60 return;59 return;
61 }60 }
6261
63 mMessageAudioPlayer.setMedia(QUrl::fromLocalFile(SOUND_PATH "message-new-instant.ogg"));62 mMessageAudioPlayer.setMedia(QUrl::fromLocalFile(mSoundSettings.get("incomingMessageSound").toString()));
64 mMessageAudioPlayer.play();63 mMessageAudioPlayer.play();
65}64}
6665
6766
=== modified file 'libphoneapp/ringtone.h'
--- libphoneapp/ringtone.h 2013-03-11 22:22:35 +0000
+++ libphoneapp/ringtone.h 2013-07-25 16:20:35 +0000
@@ -22,6 +22,7 @@
22#ifndef RINGTONE_H22#ifndef RINGTONE_H
23#define RINGTONE_H23#define RINGTONE_H
2424
25#include <QGSettings>
25#include <QObject>26#include <QObject>
26#include <QMediaPlayer>27#include <QMediaPlayer>
27#include <QMediaPlaylist>28#include <QMediaPlaylist>
@@ -47,6 +48,7 @@
47 QMediaPlaylist mCallAudioPlaylist;48 QMediaPlaylist mCallAudioPlaylist;
4849
49 QMediaPlayer mMessageAudioPlayer;50 QMediaPlayer mMessageAudioPlayer;
51 QGSettings mSoundSettings;
50};52};
5153
52#endif // RINGTONE_H54#endif // RINGTONE_H
5355
=== added directory 'schemas'
=== added file 'schemas/CMakeLists.txt'
--- schemas/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ schemas/CMakeLists.txt 2013-07-25 16:20:35 +0000
@@ -0,0 +1,18 @@
1include (UseGSettings)
2
3##
4## GSettings schema
5##
6
7set (SCHEMA_NAME "com.ubuntu.touch.phone-app.gschema.xml")
8set (SCHEMA_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_NAME}")
9set (SCHEMA_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME}.in")
10
11# generate the .xml file using intltool
12set (ENV{LC_ALL} "C")
13execute_process (COMMAND intltool-merge -quiet --xml-style --utf8 --no-translations "${SCHEMA_FILE_IN}" "${SCHEMA_FILE}")
14
15# let UseGSettings do the rest
16add_schema (${SCHEMA_FILE})
17
18
019
=== added file 'schemas/com.ubuntu.touch.phone-app.gschema.xml.in'
--- schemas/com.ubuntu.touch.phone-app.gschema.xml.in 1970-01-01 00:00:00 +0000
+++ schemas/com.ubuntu.touch.phone-app.gschema.xml.in 2013-07-25 16:20:35 +0000
@@ -0,0 +1,15 @@
1<schemalist>
2 <schema id="com.ubuntu.touch.phone-app" path="/com/ubuntu/touch/phone-app/">
3 <key name="incoming-call-sound" type="s">
4 <default>"/usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg"</default>
5 <_summary>Ringtone sound for the phone application.</_summary>
6 <_description>This sound file is played, on incoming calls, by the phone application.</_description>
7 </key>
8 <key name="incoming-message-sound" type="s">
9 <default>"/usr/share/sounds/ubuntu/stereo/message-new-instant.ogg"</default>
10 <_summary>Incoming message sound for the phone application.</_summary>
11 <_description>This sound file is played, on incoming messages, by the phone application.</_description>
12 </key>
13 </schema>
14</schemalist>
15

Subscribers

People subscribed via source and target branches