4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #include <mm_sound_private.h>
24 #include <app_manager.h>
25 #include <setting-profile-sound-main.h>
26 #include <setting-profile.h>
28 #define STR_RINGTONES_AND_NOTIFICATIONS "IDS_ST_HEADER_RINGTONES_AND_NOTIFICATIONS"
29 #define STR_FEEDBACK "IDS_ST_HEADER_FEEDBACK"
31 char *repeat_type[SETTING_SOUND_REPEAT_TYPE_LEN] = {
32 SETTING_SOUND_TEXT_REPEAT_ONCE,
33 SETTING_SOUND_TEXT_REPEAT_2MIN,
34 SETTING_SOUND_TEXT_REPEAT_5MIN,
35 SETTING_SOUND_TEXT_REPEAT_10MIN
39 static int setting_profile_sound_main_create(void *cb);
40 static int setting_profile_sound_main_destroy(void *cb);
41 static int setting_profile_sound_main_update(void *cb);
42 static int setting_profile_sound_main_cleanup(void *cb);
44 static void setting_profile_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
45 static Eina_Bool setting_profile_sound_main_click_softkey_cancel_cb(void *data, Elm_Object_Item *it);
46 static void setting_profile_sound_main_Gendial_chk_cb(void *data, Evas_Object *obj, void *event_info);
47 static void setting_profile_sound_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info);
48 static void setting_profile_sound_main_create_popup_with_sliders(void *data);
49 static void setting_profile_sound_main_call_ringtone_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
50 static void setting_profile_sound_main_noti_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
51 static void setting_profile_sound_main_media_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
52 static void setting_profile_sound_main_call_vib_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
53 static void setting_profile_sound_main_vib_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
54 static void setting_profile_sound_main_touchVib_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
55 static void settings_profile_sound_main_sys_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
56 static void setting_profile_sound_main_tts_sound_slider_value_change_cb(void *data, Evas_Object *obj, void *event_info);
59 #define ADD_GENLIST(genlist, parent) \
61 genlist = elm_genlist_add(parent);\
62 retvm_if(genlist == NULL, NULL, "Cannot set genlist object as contento of layout");\
63 elm_genlist_realization_mode_set(genlist, EINA_TRUE);\
64 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);\
65 elm_object_style_set(genlist, "dialogue");\
66 elm_genlist_clear(genlist);\
67 evas_object_smart_callback_add(genlist, "realized", __gl_realized_cb, NULL);\
68 elm_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);\
71 #define ADD_TOGGLE_MENU(item, genlist, item_style, keystr, value, g_style, data) \
73 item = setting_create_Gendial_field_def(genlist, &(item_style), \
74 setting_profile_sound_main_mouse_up_Gendial_list_cb, \
75 data, SWALLOW_Type_1ICON_1RADIO, NULL, \
78 setting_profile_sound_main_Gendial_chk_cb); \
80 item->userdata = data;\
81 setting_genlist_item_groupstyle_set(item, g_style); \
83 SETTING_TRACE_ERROR("%s item is NULL", keystr);\
87 #define ADD_SLIDER_MENU(item, genlist, item_style, l_img, r_img, value, keystr, data, sld_cb, sld_max, start_cb, stop_cb, sound_group, g_style) \
89 item = setting_create_Gendial_field_def(genlist, &(item_style), NULL,\
91 SWALLOW_Type_LAYOUT_SLIDER,\
98 item->win_main = data->win_main_layout;\
99 item->evas = data->evas;\
100 item->isIndicatorVisible = TRUE;\
101 item->slider_min = 0;\
102 item->slider_max = sld_max;\
103 item->userdata = data;\
104 item->start_change_cb = start_cb;\
105 item->stop_change_cb = stop_cb;\
106 item->belongs_to = sound_group;\
107 setting_genlist_item_groupstyle_set(item, g_style); \
109 SETTING_TRACE_ERROR("%s item is NULL", keystr);\
113 setting_view setting_view_profile_sound_main = {
114 .create = setting_profile_sound_main_create,
115 .destroy = setting_profile_sound_main_destroy,
116 .update = setting_profile_sound_main_update,
117 .cleanup = setting_profile_sound_main_cleanup,
120 extern char *setting_vib_type[];
122 /* ***************************************************
126 ***************************************************/
127 void __change_state_of_sliderbars(void *data)
129 ret_if(data == NULL);
130 SettingProfileUG *ad = (SettingProfileUG *) data;
133 int vibration_on = TRUE;
135 if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_on) == 0) {
136 if (sound_on == FALSE) {
137 /* disable slider bar of call ringtone, notification, media, and system volume */
138 if (ad->data_call_volume) {
139 setting_disable_genlist_item(ad->data_call_volume->item);
141 if (ad->data_noti_volume) {
142 setting_disable_genlist_item(ad->data_noti_volume->item);
144 if (ad->data_media_volume) {
145 setting_disable_genlist_item(ad->data_media_volume->item);
147 if (ad->data_touch_volume) {
148 setting_disable_genlist_item(ad->data_touch_volume->item);
154 (VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibration_on) == 0) {
155 if (vibration_on == FALSE) {
156 /* disable slider bar of notification and system vibration */
157 if (ad->data_vib_volume) {
158 setting_disable_genlist_item(ad->data_vib_volume->item);
160 if (ad->data_touch_vib) {
161 setting_disable_genlist_item(ad->data_touch_vib->item);
167 void __sound_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
170 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
171 retm_if(data == NULL, "Invalid argument: data is NULL");
173 //SettingProfileUG *ad = (SettingProfileUG *) data;
174 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
175 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
176 elm_genlist_item_selected_set(subitem, 0);
177 Setting_GenGroupItem_Data *data_subItem =
178 elm_object_item_data_get(subitem);
179 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem);
180 if (NULL == data_subItem || NULL == data_parentItem)
183 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
185 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
186 data_subItem->chk_status, &err);
188 if (data_parentItem && data_parentItem->item) {
189 data_parentItem->sub_desc =
190 (char *)g_strdup(_(data_subItem->keyStr));
191 elm_object_item_data_set(data_parentItem->item, data_parentItem);
192 elm_genlist_item_update(data_parentItem->item);
195 elm_genlist_item_expanded_set(parentItem, EINA_FALSE);
198 static void __sound_exp_cb(void *data, Evas_Object *obj, void *event_info)
200 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
201 retm_if(data == NULL, "Invalid argument: data is NULL");
203 SettingProfileUG *ad = (SettingProfileUG *) data;
204 Elm_Object_Item *parentItem = event_info; /* parent item */
205 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
206 Evas_Object *scroller = elm_object_item_widget_get(parentItem);
209 if (data_parentItem == ad->data_msg_alert_repeat
210 || data_parentItem == ad->data_email_alert_repeat) {
211 rgd = elm_radio_add(scroller);
212 elm_object_style_set(rgd, "list");
213 evas_object_propagate_events_set(rgd, EINA_TRUE);
214 elm_radio_value_set(rgd, -1);
216 elm_object_item_signal_emit(parentItem, "elm,state,center", "");
218 data_parentItem->group_style = SETTING_GROUP_STYLE_CENTER;
220 ad->data_sound_text_repeat_once = setting_create_Gendial_exp_sub_field(scroller,
221 &(ad->itc_1icon_1text_sub),
222 __sound_sub_list_sel_cb,
224 SWALLOW_Type_1RADIO, rgd,
226 _(SETTING_SOUND_TEXT_REPEAT_ONCE),
228 if(ad->data_sound_text_repeat_once)
230 ad->data_sound_text_repeat_once->userdata = ad;
231 setting_genlist_item_groupstyle_set(ad->data_sound_text_repeat_once, SETTING_GROUP_STYLE_CENTER);
233 ad->data_sound_text_repeat_2min = setting_create_Gendial_exp_sub_field(scroller,
234 &(ad->itc_1icon_1text_sub),
235 __sound_sub_list_sel_cb,
237 SWALLOW_Type_1RADIO, rgd,
239 _(SETTING_SOUND_TEXT_REPEAT_2MIN),
241 if(ad->data_sound_text_repeat_2min)
243 ad->data_sound_text_repeat_2min->userdata = ad;
244 setting_genlist_item_groupstyle_set(ad->data_sound_text_repeat_2min, SETTING_GROUP_STYLE_CENTER);
246 ad->data_sound_text_repeat_5min = setting_create_Gendial_exp_sub_field(scroller,
247 &(ad->itc_1icon_1text_sub),
248 __sound_sub_list_sel_cb,
250 SWALLOW_Type_1RADIO, rgd,
252 _(SETTING_SOUND_TEXT_REPEAT_5MIN),
254 if(ad->data_sound_text_repeat_5min)
256 ad->data_sound_text_repeat_5min->userdata = ad;
257 setting_genlist_item_groupstyle_set(ad->data_sound_text_repeat_5min, SETTING_GROUP_STYLE_CENTER);
259 ad->data_sound_text_repeat_10min = setting_create_Gendial_exp_sub_field(scroller,
260 &(ad->itc_1icon_1text_sub),
261 __sound_sub_list_sel_cb,
263 SWALLOW_Type_1RADIO, rgd,
265 _(SETTING_SOUND_TEXT_REPEAT_10MIN),
267 if(ad->data_sound_text_repeat_10min)
269 ad->data_sound_text_repeat_10min->userdata = ad;
270 setting_genlist_item_groupstyle_set(ad->data_sound_text_repeat_10min, SETTING_GROUP_STYLE_BOTTOM);
272 if(data_parentItem) {
273 setting_update_chk_status(rgd, data_parentItem->int_slp_setting_binded);
277 static void __sound_con_cb(void *data, Evas_Object *obj,
280 ret_if(data == NULL || event_info == NULL);
281 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
282 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(item);
283 char *cb_type = data;
285 if (0 == safeStrCmp(cb_type, "drag")
286 || 0 == safeStrCmp(cb_type, "longpressed")) {
287 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
288 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
289 } else if (0 == safeStrCmp(cb_type, "contracted")) {
292 elm_genlist_item_subitems_clear(item);
293 elm_object_item_signal_emit(item, "elm,state,bottom", "");
296 data_parentItem->group_style = SETTING_GROUP_STYLE_BOTTOM;
300 static Eina_Bool __play_ringtone_sound_idle_cb(void *data)
303 retv_if(!data, EINA_FALSE);
305 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
306 SettingProfileUG *ad = list_item->userdata;
308 if(list_item->eo_check)
311 current = elm_slider_value_get(list_item->eo_check);
312 list_item->chk_status = (int)(current+0.5);
315 if(ad->mp_ringtone == NULL)
317 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_RINGTONE);
318 char *pa_tone_path = NULL;
319 pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR);
320 if(pa_tone_path == NULL)
323 pa_tone_path = (char *)strdup(SETTING_DEFAULT_CALL_TONE_SDK);
325 pa_tone_path = (char *)strdup(SETTING_DEFAULT_CALL_TONE);
327 if(vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, pa_tone_path) < 0) {
332 if(list_item->chk_status > 0)
334 setting_profile_play_sound_origin(&(ad->mp_ringtone), ad, NULL,
336 (float)list_item->chk_status,
337 SOUND_TYPE_RINGTONE);
342 player_state_e state;
343 player_get_state(*(ad->mp_ringtone), &state);
344 SETTING_TRACE("ringtone player status : %d", state);
345 if(state == PLAYER_STATE_PAUSED)
347 player_start(*(ad->mp_ringtone));
349 else if(state == PLAYER_STATE_PLAYING)
352 //player_is_muted(*(ad->mp_ringtone), &is_muted);
353 //SETTING_TRACE("ringtone player is muted : %d", is_muted);
354 if(/*is_muted &&*/ ad->sound_on)
355 player_set_mute(*(ad->mp_ringtone), 0);
359 ad->play_ringtone_idler = NULL;
363 void __ringtone_start_change_cb(void *data, Evas_Object *obj, void *event_info)
366 ret_if(data == NULL);
368 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
369 SettingProfileUG *ad = list_item->userdata;
371 //if(haptic_stop_all_effects(ad->hnd_hpt) != 0){
372 // SETTING_TRACE("Error,haptic_stop_all_effects")
375 ad->cur_vol_type = SETTING_VOL_TYPE_RINGTONE;
377 setting_profile_create_warning_popup_during_call(ad);
378 if(ad->no_play_popup)
381 if(ad->mp_ringtone == NULL)
383 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_RINGTONE);
384 if(list_item->chk_status > 0)
386 char *pa_tone_path = NULL;
387 pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR);
388 if(pa_tone_path == NULL)
391 pa_tone_path = (char *)strdup(SETTING_DEFAULT_CALL_TONE_SDK);
393 pa_tone_path = (char *)strdup(SETTING_DEFAULT_CALL_TONE);
395 if(vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, pa_tone_path) < 0) {
400 setting_profile_play_sound_origin(&(ad->mp_ringtone), ad, NULL,
402 (float)list_item->chk_status,
403 SOUND_TYPE_RINGTONE);
407 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_RINGTONE);
410 void __noti_start_change_cb(void *data, Evas_Object *obj, void *event_info)
413 ret_if(data == NULL);
415 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
416 SettingProfileUG *ad = list_item->userdata;
419 //if(haptic_stop_all_effects(ad->hnd_hpt) != 0){
420 // SETTING_TRACE("Error,haptic_stop_all_effects")
423 ad->cur_vol_type = SETTING_VOL_TYPE_NOTIFICATION;
425 setting_profile_create_warning_popup_during_call(ad);
426 if(ad->no_play_popup)
429 if(ad->mp_noti == NULL)
431 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_NOTIFICATION);
432 if(list_item->chk_status > 0)
434 char *pa_tone_path = NULL;
435 pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR);
436 if(pa_tone_path == NULL)
438 pa_tone_path = (char *)strdup(SETTING_DEFAULT_MSG_TONE);
440 if(vconf_set_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_PATH_STR, pa_tone_path) < 0) {
445 setting_profile_play_sound_origin(&(ad->mp_noti), ad, NULL,
447 (float)list_item->chk_status,
448 SOUND_TYPE_NOTIFICATION);
452 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_NOTIFICATION);
455 void __media_start_change_cb(void *data, Evas_Object *obj, void *event_info)
457 ret_if(data == NULL);
459 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
460 SettingProfileUG *ad = list_item->userdata;
462 if(haptic_stop_all_effects(ad->hnd_hpt) != 0){
463 SETTING_TRACE("Error,haptic_stop_all_effects")
466 ad->cur_vol_type = SETTING_VOL_TYPE_MEDIA;
468 setting_profile_create_warning_popup_during_call(ad);
469 if(ad->no_play_popup)
472 if(ad->mp_media == NULL)
475 sound_manager_get_current_sound_type(&type);
476 if(type != SOUND_TYPE_MEDIA)
478 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_MEDIA);
479 if(list_item->chk_status > 0)
481 setting_profile_play_sound_origin(&(ad->mp_media), ad, NULL,
482 SETTING_DEFAULT_MEDIA_TONE,
483 (float)list_item->chk_status,
489 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_MEDIA);
492 void __system_start_change_cb(void *data, Evas_Object *obj, void *event_info)
494 ret_if(data == NULL);
496 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
497 SettingProfileUG *ad = list_item->userdata;
499 if(haptic_stop_all_effects(ad->hnd_hpt) != 0){
500 SETTING_TRACE("Error,haptic_stop_all_effects")
503 ad->cur_vol_type = SETTING_VOL_TYPE_SYSTEM;
505 setting_profile_create_warning_popup_during_call(ad);
506 if(ad->no_play_popup)
509 setting_profile_close_all_mm_players(ad);
512 void __noti_vib_start_change_cb(void *data, Evas_Object *obj, void *event_info)
514 ret_if(data == NULL);
516 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
517 SettingProfileUG *ad = list_item->userdata;
519 ad->cur_vol_type = SETTING_VOL_TYPE_NOTI_VIB;
520 setting_profile_close_all_mm_players(ad);
522 if(list_item->chk_status > 0)
524 SETTING_TRACE_DEBUG("play_value %d", list_item->chk_status);
525 int err = haptic_vibrate_file_with_detail(ad->hnd_hpt, SETTING_DEFAULT_NOTI_PREVIEW_VIB,
526 1, list_item->chk_status * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
528 SETTING_TRACE_DEBUG("haptic_vibrate_file_with_detail() failed");
532 void __haptic_vib_start_change_cb(void *data, Evas_Object *obj, void *event_info)
535 ret_if(data == NULL);
537 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
538 SettingProfileUG *ad = list_item->userdata;
540 ad->cur_vol_type = SETTING_VOL_TYPE_HAPTIC_VIB;
541 setting_profile_close_all_mm_players(ad);
543 if(list_item->chk_status > 0)
545 SETTING_TRACE_DEBUG("play_value %d", list_item->chk_status);
546 int err = haptic_vibrate_file_with_detail(ad->hnd_hpt, SETTING_DEFAULT_HAPTIC_PREVIEW_VIB,
547 1, list_item->chk_status * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
549 SETTING_TRACE_DEBUG("haptic_vibrate_file_with_detail() failed");
553 void __volume_stop_change_cb(void *data, Evas_Object *obj, void *event_info)
557 ret_if(data == NULL);
559 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
560 SettingProfileUG *ad = list_item->userdata;
562 SETTING_TRACE("cur_vol_type : %d", ad->cur_vol_type);
564 double value = elm_slider_value_get(obj);
565 SETTING_TRACE("value : %f", value);
566 list_item->chk_status = (int)(value+0.5);
567 SETTING_TRACE("list_item->chk_status : %d", list_item->chk_status);
568 elm_slider_value_set(obj, list_item->chk_status);
570 /* Change left icon of sliders */
571 char *left_icon = NULL;
572 switch(ad->cur_vol_type)
574 case SETTING_VOL_TYPE_RINGTONE :
575 left_icon = setting_profile_get_slider_icon(SND_SLIDER_CALL, list_item->chk_status);
577 case SETTING_VOL_TYPE_NOTIFICATION :
578 left_icon = setting_profile_get_slider_icon(SND_SLIDER_NOTI, list_item->chk_status);
580 case SETTING_VOL_TYPE_MEDIA :
581 /* MEDIA has just one icon type. No need to change */
583 case SETTING_VOL_TYPE_SYSTEM :
584 left_icon = setting_profile_get_slider_icon(SND_SLIDER_SYSTEM, list_item->chk_status);
593 Evas_Object *cur_icon = elm_object_content_unset(obj);
596 evas_object_del(cur_icon);
599 Evas_Object *icon = elm_icon_add(obj);
600 elm_image_file_set(icon, left_icon, NULL);
601 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
602 elm_object_content_set(obj, icon);
603 evas_object_show(icon);
605 ret_if(data == NULL);
606 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
607 SETTING_TRACE("chk_status : %d, slider : %f", list_item->chk_status, elm_slider_value_get(obj));
608 if(list_item->chk_status == 0)
610 elm_slider_value_set(obj, 0.0);
612 else if(list_item->chk_status == 15)
614 elm_slider_value_set(obj, 15.0);
620 void __vibration_stop_change_cb(void *data, Evas_Object *obj, void *event_info)
622 ret_if(data == NULL);
624 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
625 //SettingProfileUG *ad = list_item->userdata;
627 double value = elm_slider_value_get(obj);
628 list_item->chk_status = (int)(value+0.5);
629 elm_slider_value_set(obj, list_item->chk_status);
634 void ___sound_destroy_ug_cb(ui_gadget_h ug, void *priv)
636 ret_if(priv == NULL);
637 SettingProfileUG *ad = priv;
639 setting_ug_destroy(ug);
640 ad->ug_loading = NULL;
644 char* __get_sound_mode_str(void)
649 vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound);
650 vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibration);
652 if(sound && !vibration)
653 return (char*)g_strdup("IDS_ST_HEADER_SOUND");
654 else if(vibration && !sound)
655 return (char*)g_strdup("IDS_ST_BODY_CALLALERTTYPE_VIBRATION");
656 else if(!vibration && !sound)
657 return (char*)g_strdup("IDS_ST_BODY_MUTE");
662 static void __get_lite_main_list(void *data)
666 SettingProfileUG *ad = (SettingProfileUG *)data;
669 char *sub_desc = NULL;
671 Evas_Object *genlist = NULL;
672 ADD_GENLIST(genlist, ad->navi_bar);
673 ad->gl_lite_main = genlist;
674 elm_genlist_block_count_set(genlist, 3);
675 setting_enable_expandable_genlist(genlist, ad, __sound_exp_cb, NULL);
678 sub_desc = __get_sound_mode_str();
679 ad->data_sound_mode =
680 setting_create_Gendial_field_def(genlist, &(ad->itc_2text_2),
681 setting_profile_sound_main_mouse_up_Gendial_list_cb,
682 ad, SWALLOW_Type_INVALID, NULL,
683 NULL, 0, "IDS_ST_OPT_SOUND_MODE_ABB",
685 if (ad->data_sound_mode) {
686 ad->data_sound_mode->userdata = ad;
687 setting_genlist_item_groupstyle_set(ad->data_sound_mode, SETTING_GROUP_STYLE_TOP);
689 SETTING_TRACE_ERROR("ad->data_call_alert_tone is NULL");
695 setting_create_Gendial_field_def(genlist, &itc_1text,
696 setting_profile_sound_main_mouse_up_Gendial_list_cb,
697 data, SWALLOW_Type_INVALID, NULL,
699 VOLUME_STR, NULL, NULL);
701 ADD_GL_SEPARATOR(genlist)
703 /* Group title : Ringtones and notifications */
704 (void)setting_create_Gendial_field_titleItem(genlist,
706 _(STR_RINGTONES_AND_NOTIFICATIONS), NULL);
709 char *pa_ringtone = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR);
710 if(setting_profile_check_file_exist(ad, pa_ringtone) == SETTING_RETURN_FAIL)
713 pa_ringtone = (char *)strdup(SETTING_DEFAULT_CALL_TONE_SDK);
715 pa_ringtone = (char *)strdup(SETTING_DEFAULT_CALL_TONE);
716 vconf_ret = vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, pa_ringtone);
718 SETTING_TRACE_DEBUG("failed to set vconf");
720 sub_desc = setting_media_basename(pa_ringtone);
722 ad->data_call_alert_tone =
723 setting_create_Gendial_field_def(genlist, &(ad->itc_2text_2),
724 setting_profile_sound_main_mouse_up_Gendial_list_cb,
725 ad, SWALLOW_Type_INVALID, NULL,
726 NULL, 0, SETTING_SOUND_TEXT_RINGTONES,
728 if (ad->data_call_alert_tone) {
729 ad->data_call_alert_tone->userdata = ad;
730 setting_genlist_item_groupstyle_set(ad->data_call_alert_tone, SETTING_GROUP_STYLE_TOP);
732 SETTING_TRACE_ERROR("ad->data_call_alert_tone is NULL");
738 /* 4. Notification alert */
739 pa_ringtone = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR);
740 if(setting_profile_check_file_exist(ad, pa_ringtone) == SETTING_RETURN_FAIL)
742 pa_ringtone = (char *)strdup(SETTING_DEFAULT_MSG_TONE);
743 vconf_ret = vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SETTING_DEFAULT_MSG_TONE);
745 SETTING_TRACE_DEBUG("failed to set vconf");
747 sub_desc = setting_media_basename(pa_ringtone);
749 ad->data_msg_alert_tone =
750 setting_create_Gendial_field_def(genlist, &(ad->itc_2text_2),
751 setting_profile_sound_main_mouse_up_Gendial_list_cb,
752 ad, SWALLOW_Type_INVALID, NULL,
754 SETTING_SOUND_TEXT_NOTIFICATION_ALERT/*SETTING_SOUND_TEXT_MSG_ALERT*/,
756 if (ad->data_msg_alert_tone) {
757 ad->data_msg_alert_tone->userdata = ad;
758 ad->data_msg_alert_tone->group_style = SETTING_GROUP_STYLE_TOP;
759 setting_genlist_item_groupstyle_set(ad->data_msg_alert_tone, SETTING_GROUP_STYLE_TOP);
761 SETTING_TRACE_ERROR("ad->data_msg_alert_tone is NULL");
766 /* 5. Notification alert repetition */
767 if (vconf_get_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value) != 0)
768 vconf_value = SETTING_DEFAULT_ALERT_REPEAT_TYPE_INT; /* default 0 : repeat once */
769 ad->data_msg_alert_repeat =
770 setting_create_Gendial_exp_parent_field(genlist,
772 NULL, NULL, SWALLOW_Type_INVALID,
773 SETTING_SOUND_TEXT_NOTIFICATION_ALERT_REPETITION/*SETTING_SOUND_TEXT_MSG_RINGTONE_REPEAT*/,
774 _(repeat_type[vconf_value]),
775 SETTING_GROUP_STYLE_CENTER, SETTING_GROUP_STYLE_CENTER);
776 if (ad->data_msg_alert_repeat) {
777 ad->data_msg_alert_repeat->int_slp_setting_binded =
778 INT_SLP_SETTING_MSG_ALERT_REPEAT;
780 SETTING_TRACE_ERROR("ad->data_msg_alert_repeat is NULL");
783 /* 1. Vibrate when ringing */
784 if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL, &vconf_value) < 0)
786 vconf_value = TRUE; /* default value of vibrate sound : on */
788 ADD_TOGGLE_MENU(ad->data_sound_when_ring, genlist, itc_1text_1icon, SETTING_SOUND_TEXT_VIBRATE_WHEN_RING, vconf_value, SETTING_GROUP_STYLE_NONE, ad);
790 /* Group title : Feedback */
791 setting_create_Gendial_field_titleItem(genlist,
793 _(STR_FEEDBACK), NULL);
796 if (vconf_get_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, &vconf_value) < 0)
797 vconf_value = TRUE; /* default value of touch sounds : on */
798 ADD_TOGGLE_MENU(ad->data_button_sounds, genlist, itc_1text_1icon, "IDS_ST_MBODY_DIALLING_KEYPAD_TONE", vconf_value, SETTING_GROUP_STYLE_NONE, ad)
799 ADD_GL_HELP(genlist,"IDS_ST_BODY_PLAY_TONE_WHEN_THE_DIALLING_KEYPAD_IS_TAPPED");
801 /* 7. Touch sounds */
802 if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value) < 0)
803 vconf_value = TRUE; /* default value of touch sounds : on */
804 ADD_TOGGLE_MENU(ad->data_touch_sounds, genlist, itc_1text_1icon, "IDS_ST_BODY_TOUCH_SOUNDS", vconf_value, SETTING_GROUP_STYLE_NONE, ad)
805 ADD_GL_HELP(genlist,"IDS_ST_BODY_PLAY_SOUND_WHEN_MAKING_SCREEN_SELECTION");
807 /* 8. Screen lock sound */
808 if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value) < 0)
809 vconf_value = 0; /* default value of lock/unlock sound : off */
810 ADD_TOGGLE_MENU(ad->data_lock_sound, genlist, itc_1text_1icon, SETTING_SOUND_TEXT_LOCK_SOUND, vconf_value, SETTING_GROUP_STYLE_NONE, ad)
811 ADD_GL_HELP(genlist,"IDS_ST_BODY_PLAY_SOUNDS_WHEN_LOCKING_AND_UNLOCKING_SCREEN");
816 static int setting_profile_sound_main_create(void *cb)
819 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
821 SettingProfileUG *ad = (SettingProfileUG *) cb;
823 ad->ly_main = setting_create_win_layout(ad->win_main_layout, ad->win_get);
824 ad->navi_bar = setting_create_navi_bar(ad->ly_main);
827 __get_lite_main_list(ad);
828 Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->navi_bar, KeyStr_Sounds, NULL, NULL, ad->gl_lite_main, NULL);
829 elm_object_item_domain_text_translatable_set(navi_it, SETTING_PACKAGE, EINA_TRUE);
831 SETTING_TRACE("viewtype: %s", ad->viewtype);
832 if(!safeStrCmp(ad->viewtype, "org.tizen.setting.volume"))
834 SETTING_TRACE("ENTER setting_profile_sound_main_create_popup_with_sliders");
835 setting_profile_sound_main_create_popup_with_sliders(ad);
839 elm_naviframe_item_pop_cb_set(navi_it, (Elm_Naviframe_Item_Pop_Cb)setting_profile_sound_main_click_softkey_cancel_cb, ad);
841 setting_view_profile_sound_main.is_create = TRUE;
844 return SETTING_RETURN_SUCCESS;
847 static int setting_profile_sound_main_destroy(void *cb)
850 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
853 SettingProfileUG *ad = (SettingProfileUG *) cb;
854 if (ad->set_sound_idler) {
855 ecore_idler_del(ad->set_sound_idler);
856 ad->set_sound_idler = NULL;
858 if (ad->set_vib_idler) {
859 ecore_idler_del(ad->set_vib_idler);
860 ad->set_vib_idler = NULL;
863 if(ad->play_ringtone_idler)
865 ecore_idler_del(ad->play_ringtone_idler);
866 ad->play_ringtone_idler = NULL;
869 //__setting_profile_ug_key_ungrab(ad);
870 //__setting_profile_ug_menu_key_ungrab(ad);
874 evas_object_del(ad->volume_popup);
875 ad->volume_popup = NULL;
877 if(ad->sound_mode_popup)
879 evas_object_del(ad->sound_mode_popup);
880 ad->sound_mode_popup = NULL;
883 if (ad->ly_main != NULL) {
884 evas_object_del(ad->ly_main);
885 setting_view_profile_sound_main.is_create = FALSE;
887 return SETTING_RETURN_SUCCESS;
890 static int setting_profile_sound_main_update(void *cb)
893 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
895 SettingProfileUG *ad = (SettingProfileUG *) cb;
897 if (ad->ly_main != NULL) {
898 evas_object_show(ad->ly_main);
900 return SETTING_RETURN_SUCCESS;
903 static int setting_profile_sound_main_cleanup(void *cb)
906 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
908 SettingProfileUG *ad = (SettingProfileUG *) cb;
910 if (ad->ly_main != NULL) {
911 evas_object_hide(ad->ly_main);
914 return SETTING_RETURN_SUCCESS;
917 /* ***************************************************
921 ***************************************************/
923 /* ***************************************************
927 ***************************************************/
929 static Eina_Bool setting_profile_sound_main_click_softkey_cancel_cb(void *data, Elm_Object_Item *it)
932 retv_if(data == NULL, EINA_FALSE);
934 SettingProfileUG *ad = (SettingProfileUG *) data;
938 setting_profile_close_all_mm_players(ad);
939 /* close vibration */
940 if (haptic_stop_all_effects(ad->hnd_hpt) != 0) {
941 SETTING_TRACE("ERROR haptic_stop_all_effects");
944 /* Send destroy request */
945 ug_destroy_me(ad->ug);
950 static void setting_profile_sound_main_destroy_myfile_ug_cb(ui_gadget_h ug, void *priv)
953 ret_if(priv == NULL);
954 SettingProfileUG *ad = (SettingProfileUG *) priv;
956 //__setting_profile_ug_key_grab(ad);
959 setting_ug_destroy(ug);
960 ad->ug_loading = NULL;
965 setting_profile_sound_main_result_myfile_ug_cb(ui_gadget_h ug,
966 app_control_h result, void *priv)
969 ret_if(priv == NULL);
971 SettingProfileUG *ad = (SettingProfileUG *) priv;
972 char *ringtone_file = NULL;
973 char *ringtone_path = NULL;
975 app_control_get_extra_data(result, "result", &ringtone_path);
979 char *recommend_time = NULL;
980 app_control_get_extra_data(result, "position", &recommend_time);
982 SETTING_TRACE("ringtone_path:%s", ringtone_path);
984 if (ringtone_path != NULL) {
985 ringtone_file = setting_media_basename(ringtone_path);
986 SETTING_TRACE("ringtone_file:%s", ringtone_file);
988 if (0 == safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_RINGTONES)) {
990 (VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, ringtone_path) == 0) {
991 if (ad->data_call_alert_tone) {
992 ad->data_call_alert_tone->sub_desc = (char *)g_strdup(ringtone_file);
994 elm_object_item_data_set(ad->data_call_alert_tone->item, ad->data_call_alert_tone);
995 elm_genlist_item_update(ad->data_call_alert_tone->item);
1000 char recommend_info[512] = {0,};
1001 snprintf(recommend_info, 512, "%s; %smsec", ringtone_path, recommend_time);
1002 SETTING_TRACE_DEBUG("%s", recommend_info);
1003 vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_WITH_RECOMMENDATION_TIME_STR, recommend_info);
1006 safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_NOTIFICATION_ALERT)) {
1008 (VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, ringtone_path) == 0) {
1009 if (ad->data_msg_alert_tone) {
1010 ad->data_msg_alert_tone->sub_desc = (char *)g_strdup(ringtone_file);
1012 elm_object_item_data_set(ad->data_msg_alert_tone->item, ad->data_msg_alert_tone);
1013 elm_genlist_item_update(ad->data_msg_alert_tone->item);
1017 safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_EMAIL_ALERT)) {
1019 (VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, ringtone_path) == 0) {
1020 if (ad->data_email_alert_tone) {
1021 ad->data_email_alert_tone->sub_desc = (char *)g_strdup(ringtone_file);
1023 elm_object_item_data_set(ad->data_email_alert_tone->item, ad->data_email_alert_tone);
1024 elm_genlist_item_update(ad->data_email_alert_tone->item);
1030 FREE(ringtone_path);
1031 FREE(recommend_time);
1032 G_FREE(ringtone_file);
1037 setting_profile_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
1040 ret_if(priv == NULL);
1042 //SettingProfileUG *ad = (SettingProfileUG *) priv;
1045 base = (Evas_Object *) ug_get_layout(ug);
1050 case UG_MODE_FULLVIEW:
1051 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1052 //elm_win_resize_object_add(ad->win_get, base);
1053 evas_object_show(base);
1061 static void setting_profile_sound_main_create_myfile_ug(SettingProfileUG *ad, char *titleID)
1067 SETTING_TRACE("Myfiles ug is already loaded.");
1071 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1075 cbs->layout_cb = setting_profile_layout_ug_cb;
1076 cbs->result_cb = setting_profile_sound_main_result_myfile_ug_cb;
1077 cbs->destroy_cb = setting_profile_sound_main_destroy_myfile_ug_cb;
1078 cbs->priv = (void *)ad;
1081 if (app_control_create(&svc)) {
1086 const char *pa_cur_ringtone = NULL;
1087 const char *dir_path = NULL;
1088 if (0 == safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_RINGTONES)) {
1089 pa_cur_ringtone = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR);
1090 if (pa_cur_ringtone == NULL)
1093 pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_CALL_TONE_SDK);
1095 pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_CALL_TONE);
1097 dir_path = SETTING_PROFILE_SOUND_RINGTONES_PATH;
1098 } else if (0 == safeStrCmp(ad->ringtone_type, SETTING_SOUND_TEXT_NOTIFICATION_ALERT)) {
1099 pa_cur_ringtone = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR);
1100 if (pa_cur_ringtone == NULL)
1101 pa_cur_ringtone = (char *)strdup(SETTING_DEFAULT_MSG_TONE);
1102 dir_path = SETTING_PROFILE_SOUND_ALERTS_PATH;
1104 SETTING_TRACE("pa_cur_ringtone:\t%s", pa_cur_ringtone);
1105 SETTING_TRACE("dir_path:\t%s", dir_path);
1107 app_control_add_extra_data(svc, "title", titleID);
1108 app_control_add_extra_data(svc, "domain", SETTING_PACKAGE);
1109 app_control_add_extra_data(svc, "path", dir_path);
1110 app_control_add_extra_data(svc, "select_type", "SINGLE_FILE");
1111 app_control_add_extra_data(svc, "file_type", "SOUND");
1112 app_control_add_extra_data(svc, "drm_type", "DRM_ALL");
1113 app_control_add_extra_data(svc, "silent", "silent show"); /* Show Silent item in the list */
1114 if(safeStrCmp(pa_cur_ringtone, "silent") == 0)
1115 app_control_add_extra_data(svc, "marked_mode", "silent"); /* Set radio on Silent item */
1117 app_control_add_extra_data(svc, "marked_mode", pa_cur_ringtone);
1119 elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
1120 SETTING_TRACE("ad->ug->layout:%p", (void *)ug_get_layout(ad->ug));
1121 ad->ug_loading = setting_ug_create(ad->ug, "setting-ringtone-efl", UG_MODE_FULLVIEW, svc, cbs);
1122 if (NULL == ad->ug_loading) { /* error handling */
1123 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
1126 app_control_destroy(svc);
1129 /** @todo verify it's valid */
1130 if(pa_cur_ringtone) {
1131 free((void *)pa_cur_ringtone);
1132 pa_cur_ringtone = NULL;
1135 //__setting_profile_ug_key_ungrab(ad);
1136 //__setting_profile_ug_menu_key_grab(ad);
1141 setting_profile_sound_main_Gendial_chk_cb(void *data, Evas_Object *obj,
1145 ret_if(data == NULL);
1147 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1148 SettingProfileUG *ad = list_item->userdata;
1149 SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1151 if(SETTING_RETURN_SUCCESS != setting_profile_close_all_mm_players(ad)){
1152 SETTING_TRACE_ERROR("close player fail.");
1155 int state = list_item->chk_status = elm_check_state_get(obj); /* for genlist update status */
1157 /* restore the selected check status */
1158 setting_update_gl_item_chk_status(list_item, state);
1160 if (!safeStrCmp(SETTING_SOUND_TEXT_SOUND, list_item->keyStr)) {
1161 if (vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, list_item->chk_status) < 0) {
1162 setting_update_gl_item_chk_status(list_item, !state);
1165 if (!list_item->chk_status) {
1166 setting_profile_close_all_mm_players(ad);
1168 } else if (!safeStrCmp(SETTING_SOUND_TEXT_VIBRATION, list_item->keyStr)) {
1169 if (vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, list_item->chk_status) < 0) {
1170 setting_update_gl_item_chk_status(list_item, !state);
1172 if (list_item->chk_status) {
1173 /* Play vib if vib turns on */
1176 if (haptic_stop_all_effects(ad->hnd_hpt) != 0) {
1177 SETTING_TRACE("ERROR haptic_stop_all_effects");
1179 if(ad->data_vib_volume && ad->data_vib_volume->eo_check)
1180 noti_vib = (int)(elm_slider_value_get(ad->data_vib_volume->eo_check) + 0.5);
1181 err = haptic_vibrate_file_with_detail(ad->hnd_hpt, SETTING_DEFAULT_NOTI_PREVIEW_VIB, 1, noti_vib * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
1184 SETTING_TRACE("Failed to play haptic monotone");
1186 if (haptic_stop_all_effects(ad->hnd_hpt) != 0) {
1187 SETTING_TRACE("ERROR haptic_stop_all_effects");
1191 /* additional items */
1192 else if(!safeStrCmp(SETTING_SOUND_TEXT_VIBRATE_WHEN_RING, list_item->keyStr))
1194 /* vibrate when ring*/
1195 if(vconf_set_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL, list_item->chk_status) < 0)
1197 setting_update_gl_item_chk_status(list_item, !state);
1200 else if (!safeStrCmp(SETTING_SOUND_TEXT_LOCK_SOUND, list_item->keyStr)) {
1201 if (vconf_set_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, list_item->chk_status) < 0) {
1202 setting_update_gl_item_chk_status(list_item, !state);
1205 else if (!safeStrCmp("IDS_ST_MBODY_DIALLING_KEYPAD_TONE", list_item->keyStr)) {
1206 if (vconf_set_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, list_item->chk_status) < 0) {
1207 setting_update_gl_item_chk_status(list_item, !state);
1210 else if (!safeStrCmp("IDS_ST_BODY_TOUCH_SOUNDS", list_item->keyStr)) {
1211 if (vconf_set_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, list_item->chk_status) < 0) {
1212 setting_update_gl_item_chk_status(list_item, !state);
1215 else if (!safeStrCmp("IDS_SMEMO_MBODY_HAPTIC_FEEDBACK", list_item->keyStr)) {
1216 if (vconf_set_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, list_item->chk_status) < 0) {
1217 setting_update_gl_item_chk_status(list_item, !state);
1222 SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1225 static void __slider_popup_del_cb(void *data, Evas_Object *obj, void *event_info)
1227 SETTING_TRACE_BEGIN;
1228 SETTING_TRACE(" REMOVE THE POPUP OBJECT BY THIS FUNCTION ");
1230 SettingProfileUG *ad = data;
1233 if(ad->volume_popup)
1235 evas_object_del(ad->volume_popup);
1236 ad->volume_popup = NULL;
1238 ad->data_call_volume = NULL;
1239 ad->data_noti_volume = NULL;
1240 ad->data_media_volume = NULL;
1241 ad->data_touch_volume = NULL;
1242 //__setting_profile_ug_key_ungrab(ad);
1243 setting_profile_close_all_mm_players(ad);
1246 if(!safeStrCmp(ad->viewtype, "org.tizen.setting.volume"))
1248 ug_destroy_me(ad->ug);
1253 static void setting_profile_sound_main_create_popup_with_sliders(void *data)
1256 SettingProfileUG *ad = data;
1259 int sound_value = 0;
1260 char *left_icon = NULL;
1262 Evas_Object *genlist;
1264 Evas_Object *done_btn;
1266 ad->volume_popup = elm_popup_add(ad->win_get);
1267 ea_object_event_callback_add(ad->volume_popup, EA_CALLBACK_BACK, __slider_popup_del_cb, ad);
1268 evas_object_size_hint_weight_set(ad->volume_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1269 elm_object_part_text_set(ad->volume_popup, "title,text", _(VOLUME_STR));
1270 //evas_object_smart_callback_add(popup, "block,clicked", __slider_popup_del_cb, ad);
1273 done_btn = elm_button_add(ad->volume_popup);
1274 elm_object_text_set(done_btn, _("IDS_ST_SK3_DONE"));
1275 elm_object_part_content_set(ad->volume_popup, "button1", done_btn);
1276 elm_object_style_set(done_btn, "popup");
1277 evas_object_smart_callback_add(done_btn, "clicked", __slider_popup_del_cb, ad);
1279 box = elm_box_add(ad->volume_popup);
1280 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1282 genlist = elm_genlist_add(box);
1283 elm_genlist_realization_mode_set(genlist, EINA_TRUE);
1284 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1285 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1286 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1288 if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_value) < 0)
1289 sound_value = TRUE; /* default value of sound : on */
1291 /* d.call volumn. */
1292 if(sound_manager_get_volume(SOUND_TYPE_RINGTONE, &mm_value) < 0)
1293 mm_value = SETTING_DEFAULT_RINGTONE_VOL_INT;
1294 if(sound_value == FALSE)
1297 left_icon = setting_profile_get_slider_icon(SND_SLIDER_CALL, mm_value);
1299 ADD_SLIDER_MENU(ad->data_call_volume, genlist, ad->itc_layout,
1300 left_icon, NULL/*IMG_SLIDER_BTN_RING_VOLUME*/,
1301 mm_value, SETTING_SOUND_TEXT_INCOMING_CALL, ad,
1302 setting_profile_sound_main_call_ringtone_sound_slider_value_change_cb,
1303 SETTING_SOUND_VOL_MAX,
1304 __ringtone_start_change_cb, __volume_stop_change_cb,
1305 SETTING_VOL_VIBRATION_GROUP, SETTING_GROUP_STYLE_TOP)
1307 elm_genlist_item_select_mode_set(ad->data_call_volume->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1310 if(sound_manager_get_volume(SOUND_TYPE_NOTIFICATION, &mm_value) < 0)
1311 mm_value = SETTING_DEFAULT_NOTI_VOL_INT;
1312 if(sound_value == FALSE)
1315 left_icon = setting_profile_get_slider_icon(SND_SLIDER_NOTI, mm_value);
1317 ADD_SLIDER_MENU(ad->data_noti_volume, genlist, ad->itc_layout,
1318 left_icon, NULL/*IMG_SLIDER_BTN_NOTI_VOLUME*/,
1319 mm_value, SETTING_SOUND_TEXT_NOTIFICATION, ad,
1320 setting_profile_sound_main_noti_sound_slider_value_change_cb,
1321 SETTING_SOUND_VOL_MAX,
1322 __noti_start_change_cb, __volume_stop_change_cb,
1323 SETTING_VOL_SOUND_GROUP, SETTING_GROUP_STYLE_CENTER)
1325 elm_genlist_item_select_mode_set(ad->data_noti_volume->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1327 /* g.media volume */
1328 if(sound_manager_get_volume(SOUND_TYPE_MEDIA, &mm_value) < 0)
1329 mm_value = SETTING_DEFAULT_MEDIA_VOL_INT;
1331 left_icon = setting_profile_get_slider_icon(SND_SLIDER_MEDIA, mm_value);
1333 ADD_SLIDER_MENU(ad->data_media_volume, genlist, ad->itc_layout,
1334 left_icon, NULL/*IMG_SLIDER_BTN_VOLUME02*/,
1335 mm_value, SETTING_SOUND_TEXT_MEDIA, ad,
1336 setting_profile_sound_main_media_sound_slider_value_change_cb,
1337 SETTING_SOUND_VOL_MAX,
1338 __media_start_change_cb, __volume_stop_change_cb,
1339 SETTING_VOL_VIBRATION_GROUP, SETTING_GROUP_STYLE_CENTER)
1341 elm_genlist_item_select_mode_set(ad->data_media_volume->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1343 /* h.system volume */
1344 if(sound_manager_get_volume(SOUND_TYPE_SYSTEM, &mm_value) < 0)
1346 SETTING_TRACE_DEBUG("Fail to get volume");
1347 mm_value = SETTING_DEFAULT_SYSTEM_VOL_INT;
1349 if(sound_value == FALSE)
1352 left_icon = setting_profile_get_slider_icon(SND_SLIDER_SYSTEM, mm_value);
1354 ADD_SLIDER_MENU(ad->data_touch_volume, genlist, ad->itc_layout,
1355 left_icon, NULL/*IMG_SLIDER_BTN_SYSTEM_VOLUME*/,
1356 mm_value, SETTING_SOUND_TEXT_SYSTEM, ad,
1357 settings_profile_sound_main_sys_sound_slider_value_change_cb,
1358 SETTING_SOUND_VOL_MAX,
1359 __system_start_change_cb, __volume_stop_change_cb,
1360 SETTING_VOL_SOUND_GROUP, SETTING_GROUP_STYLE_BOTTOM)
1361 evas_object_show(genlist);
1362 elm_box_pack_end(box, genlist);
1365 elm_win_screen_size_get(ad->win_get, NULL, NULL, &w, &h);
1366 //ecore_x_window_size_get(ecore_x_window_root_first_get(), &w,&h);
1367 double popup_height = (double)h * ((double)470/(double)800);
1368 SETTING_TRACE("popup_height : %d", (int)popup_height);
1369 evas_object_size_hint_min_set(box, -1, (int)popup_height);
1371 elm_object_content_set(ad->volume_popup, box);
1372 evas_object_show(ad->volume_popup);
1374 //__setting_profile_ug_key_grab(ad);
1377 static void __sound_mode_item_cb(void *data, Evas_Object *obj, void *event_info)
1380 ret_if(data == NULL);
1381 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1383 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1384 elm_genlist_item_selected_set(item, 0);
1386 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1388 SettingProfileUG *ad = data;
1390 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
1391 if (!safeStrCmp("IDS_ST_HEADER_SOUND", list_item->keyStr))
1393 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE);
1394 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE);
1395 elm_radio_value_set(ad->sound_mode_rdg, 0);
1397 else if (!safeStrCmp("IDS_ST_BODY_CALLALERTTYPE_VIBRATION", list_item->keyStr))
1399 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
1400 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, TRUE);
1401 elm_radio_value_set(ad->sound_mode_rdg, 1);
1403 else if (!safeStrCmp("IDS_ST_BODY_MUTE", list_item->keyStr))
1405 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
1406 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE);
1407 elm_radio_value_set(ad->sound_mode_rdg, 2);
1410 if(ad->data_sound_mode && ad->data_sound_mode->item)
1412 G_FREE(ad->data_sound_mode->sub_desc);
1413 ad->data_sound_mode->sub_desc = __get_sound_mode_str();
1414 elm_genlist_item_update(ad->data_sound_mode->item);
1417 if(ad->sound_mode_popup)
1419 evas_object_del(ad->sound_mode_popup);
1420 ad->sound_mode_popup = NULL;
1424 static void __sound_mode_chk_changed_cb(void *data, Evas_Object *obj, void *event_info)
1427 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1429 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1430 elm_genlist_item_selected_set(item, 0);
1432 int selected_value = elm_radio_value_get(obj);
1433 SETTING_TRACE("selected radio : %d", selected_value);
1435 if (selected_value == 0)
1437 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE);
1438 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE);
1440 else if (selected_value == 1)
1442 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
1443 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, TRUE);
1445 else if (selected_value == 2)
1447 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
1448 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE);
1451 ret_if(data == NULL);
1452 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
1453 SettingProfileUG *ad = (SettingProfileUG *)list_item->userdata;
1456 if(ad->sound_mode_popup)
1458 evas_object_del(ad->sound_mode_popup);
1459 ad->sound_mode_popup = NULL;
1463 static void __sound_mode_popup_del_cb(void *data, Evas_Object *obj, void *event_info)
1465 SETTING_TRACE(" REMOVE THE POPUP OBJECT BY THIS FUNCTION ");
1467 SettingProfileUG *ad = data;
1470 if(ad->sound_mode_popup)
1472 evas_object_del(ad->sound_mode_popup);
1473 ad->sound_mode_popup = NULL;
1478 static void setting_profile_sound_main_create_sound_mode_popup(void *data)
1480 SETTING_TRACE_BEGIN;
1481 setting_retm_if(data == NULL, "data is NULL");
1483 SettingProfileUG *ad = (SettingProfileUG *)data;
1485 ad->sound_mode_popup = elm_popup_add(ad->win_get);
1486 ea_object_event_callback_add(ad->sound_mode_popup, EA_CALLBACK_BACK, __sound_mode_popup_del_cb, ad);
1487 evas_object_size_hint_weight_set(ad->sound_mode_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1488 evas_object_smart_callback_add(ad->sound_mode_popup, "block,clicked", NULL, NULL);
1489 elm_object_part_text_set(ad->sound_mode_popup, "title,text", _("IDS_ST_OPT_SOUND_MODE_ABB"));
1491 Evas_Object *box = NULL;
1492 box = elm_box_add(ad->sound_mode_popup);
1493 evas_object_size_hint_weight_set(ad->sound_mode_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1495 Evas_Object *menu_glist = elm_genlist_add(box);
1496 elm_genlist_mode_set(menu_glist, ELM_LIST_COMPRESS);
1497 evas_object_size_hint_weight_set(menu_glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1498 evas_object_size_hint_align_set(menu_glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
1500 Evas_Object *rdg = elm_radio_add(menu_glist);
1501 elm_object_style_set(rdg, "list");
1502 evas_object_propagate_events_set(rdg, EINA_TRUE);
1503 elm_radio_state_value_set(rdg, -1);
1504 evas_object_data_set(menu_glist, "radio", rdg);
1505 ad->sound_mode_rdg = rdg;
1507 setting_create_Gendial_field_1radio(menu_glist, &itc_1text_1icon,
1508 __sound_mode_item_cb, ad,
1509 SWALLOW_Type_1RADIO,
1510 rdg, 0, "IDS_ST_HEADER_SOUND",
1511 __sound_mode_chk_changed_cb);
1513 setting_create_Gendial_field_1radio(menu_glist, &itc_1text_1icon,
1514 __sound_mode_item_cb, ad,
1515 SWALLOW_Type_1RADIO,
1516 rdg, 1, "IDS_ST_BODY_CALLALERTTYPE_VIBRATION",
1517 __sound_mode_chk_changed_cb);
1519 setting_create_Gendial_field_1radio(menu_glist, &itc_1text_1icon,
1520 __sound_mode_item_cb, ad,
1521 SWALLOW_Type_1RADIO,
1522 rdg, 2, "IDS_ST_BODY_MUTE",
1523 __sound_mode_chk_changed_cb);
1525 evas_object_show(menu_glist);
1526 elm_box_pack_end(box, menu_glist);
1527 evas_object_size_hint_min_set(box, -1, 288*elm_config_scale_get());
1528 elm_object_content_set(ad->sound_mode_popup, box);
1529 evas_object_show(ad->sound_mode_popup);
1534 vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound);
1535 vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibration);
1537 if(sound && !vibration)
1538 elm_radio_value_set(rdg, 0);
1539 else if(vibration && !sound)
1540 elm_radio_value_set(rdg, 1);
1541 else if(!vibration && !sound)
1542 elm_radio_value_set(rdg, 2);
1546 setting_profile_sound_main_mouse_up_Gendial_list_cb(void *data,
1551 ret_if(data == NULL);
1552 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1554 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1555 elm_genlist_item_selected_set(item, 0);
1556 char *swip_happened = evas_object_data_get(obj, "swip_happened");
1557 if(!safeStrCmp(swip_happened, "TRUE"))
1559 evas_object_data_set(obj, "swip_happened", NULL);
1562 Setting_GenGroupItem_Data *list_item =
1563 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1565 SettingProfileUG *ad = data;
1567 if(SETTING_RETURN_SUCCESS != setting_profile_close_all_mm_players(ad)){
1568 SETTING_TRACE_ERROR("close player fail.");
1572 int ret = haptic_stop_all_effects(ad->hnd_hpt);
1573 if (ret != HAPTIC_ERROR_NONE) {
1574 SETTING_TRACE_ERROR("haptic_stop_all_effects fail");
1578 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
1579 if (!safeStrCmp(SETTING_SOUND_TEXT_RINGTONES, list_item->keyStr)
1580 || !safeStrCmp(SETTING_SOUND_TEXT_NOTIFICATION_ALERT, list_item->keyStr))
1582 ad->ringtone_type = list_item->keyStr;
1583 setting_profile_sound_main_create_myfile_ug(ad, list_item->keyStr);
1585 else if(!safeStrCmp(VOLUME_STR, list_item->keyStr))
1587 /* Create slider popup */
1588 setting_profile_sound_main_create_popup_with_sliders(ad);
1590 else if(!safeStrCmp("IDS_ST_OPT_SOUND_MODE_ABB", list_item->keyStr))
1592 setting_profile_sound_main_create_sound_mode_popup(ad);
1595 else if(!safeStrCmp(SETTING_SOUND_TEXT_VIBRATE_WHEN_RING, list_item->keyStr))
1597 /* vibrate when ring*/
1598 int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
1599 if (vconf_set_bool(VCONFKEY_SETAPPL_VIBRATE_WHEN_RINGING_BOOL, !old_status) == 0) {
1601 setting_update_gl_item_chk_status(list_item, !old_status);
1604 else if (!safeStrCmp(SETTING_SOUND_TEXT_LOCK_SOUND, list_item->keyStr))
1606 int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
1607 if (vconf_set_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, !old_status) == 0) {
1609 setting_update_gl_item_chk_status(list_item, !old_status);
1612 else if (!safeStrCmp("IDS_ST_MBODY_DIALLING_KEYPAD_TONE", list_item->keyStr))
1614 int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
1615 /* To do : set vconfkey for touch sounds */
1616 if (vconf_set_bool(VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL, !old_status) == 0) {
1618 setting_update_gl_item_chk_status(list_item, !old_status);
1621 else if (!safeStrCmp("IDS_ST_BODY_TOUCH_SOUNDS", list_item->keyStr))
1623 int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
1624 /* To do : set vconfkey for touch sounds */
1625 if (vconf_set_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, !old_status) == 0) {
1627 setting_update_gl_item_chk_status(list_item, !old_status);
1630 else if (!safeStrCmp("IDS_SMEMO_MBODY_HAPTIC_FEEDBACK", list_item->keyStr))
1632 int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
1633 /* To do : set vconfkey for touch sounds */
1634 if (vconf_set_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, !old_status) == 0) {
1636 setting_update_gl_item_chk_status(list_item, !old_status);
1639 else if (!safeStrCmp(SETTING_SOUND_TEXT_MYSOUND, list_item->keyStr))
1641 SETTING_TRACE_DEBUG("Click My sound");
1642 bool running = false;
1644 app_manager_is_running("org.tizen.call-eq-analyzer", &running);
1646 if (running == true) {
1647 app_context_h appcontext = NULL;
1649 SETTING_TRACE_DEBUG("resume app");
1651 app_manager_get_app_context("org.tizen.call-eq-analyzer", &appcontext);
1652 ret_if(NULL == appcontext);
1654 app_manager_resume_app(appcontext);
1656 app_control_h service = NULL;
1658 result = app_control_create(&service);
1659 if(result != APP_CONTROL_ERROR_NONE) {
1660 SETTING_TRACE_DEBUG("service_create fail!! ret=%d", result);
1663 ret_if(NULL == service);
1665 app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
1666 app_control_set_app_id(service, "org.tizen.call-eq-analyzer");
1668 SETTING_TRACE_DEBUG("launch app");
1669 app_control_send_launch_request(service, NULL, NULL);
1670 app_control_destroy(service);
1674 else if (ad->data_msg_alert_repeat == list_item)
1676 bool status = !elm_genlist_item_expanded_get(item);
1677 elm_genlist_item_expanded_set(item, status);
1680 else if (ad->data_call_alert_vib == list_item)
1682 /* Create new view for incoming call vibration */
1683 setting_view_change(&setting_view_profile_sound_main, &setting_view_profile_sound_call_vibration, ad);
1684 __setting_profile_ug_key_ungrab(ad);
1685 __setting_profile_ug_menu_key_grab(ad);
1691 setting_profile_sound_main_call_ringtone_sound_slider_value_change_cb(void *data,
1695 SETTING_TRACE_BEGIN;
1698 ret_if(data == NULL);
1700 double val = elm_slider_value_get(obj);
1702 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1703 SettingProfileUG *ad = list_item->userdata;
1704 //SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1706 if(list_item->chk_status != (int)(val+0.5))
1708 list_item->chk_status = (int)(val+0.5);
1709 sound_manager_set_volume(SOUND_TYPE_RINGTONE, list_item->chk_status);
1710 SETTING_TRACE_DEBUG("ringtone volume is %d, %f", list_item->chk_status, val);
1712 appcore_measure_start();
1714 if(list_item->chk_status == 0)
1716 /* change to Vibration mode */
1717 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, FALSE);
1718 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, TRUE);
1724 vconf_set_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, TRUE);
1725 vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, FALSE);
1728 setting_profile_update_slider_icon(list_item, SND_SLIDER_CALL);
1729 SETTING_TRACE_DEBUG("[TIME] change sound mode : %d msec ", appcore_measure_time());
1732 setting_profile_create_warning_popup_during_call(ad);
1733 if(ad->no_play_popup)
1736 if(ad->play_ringtone_idler)
1738 ecore_idler_del(ad->play_ringtone_idler);
1739 ad->play_ringtone_idler = NULL;
1741 ad->play_ringtone_idler = ecore_idler_add(__play_ringtone_sound_idle_cb, list_item);
1743 //SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1747 setting_profile_sound_main_noti_sound_slider_value_change_cb(void *data,
1752 ret_if(data == NULL);
1754 double val = elm_slider_value_get(obj);
1756 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1757 SettingProfileUG *ad = list_item->userdata;
1758 //SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1760 if(list_item->chk_status != (int)(val+0.5))
1762 list_item->chk_status = (int)(val+0.5);
1763 sound_manager_set_volume(SOUND_TYPE_NOTIFICATION, list_item->chk_status);
1764 SETTING_TRACE_DEBUG("notification volume is %d, %f", list_item->chk_status, val);
1766 setting_profile_update_slider_icon(list_item, SND_SLIDER_NOTI);
1769 setting_profile_create_warning_popup_during_call(ad);
1770 if(ad->no_play_popup)
1773 if(ad->mp_noti == NULL)
1775 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_NOTIFICATION);
1776 if(list_item->chk_status > 0)
1778 char *pa_tone_path = NULL;
1779 pa_tone_path = vconf_get_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR);
1780 if(pa_tone_path == NULL)
1782 pa_tone_path = (char *)strdup(SETTING_DEFAULT_MSG_TONE);
1784 if(vconf_set_str(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, pa_tone_path) < 0) {
1789 setting_profile_play_sound_origin(&(ad->mp_noti), ad, NULL,
1791 (float)list_item->chk_status,
1792 SOUND_TYPE_NOTIFICATION);
1797 player_state_e state;
1798 player_get_state(*(ad->mp_noti), &state);
1799 SETTING_TRACE("noti player status : %d", state);
1800 if(state == PLAYER_STATE_PAUSED)
1802 player_start(*(ad->mp_noti));
1805 //SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1809 #define MAX_SAFETY_VOLUME_LEVEL 10
1811 setting_profile_sound_main_media_sound_slider_value_change_cb(void *data,
1816 ret_if(data == NULL);
1817 static bool safety_flag = FALSE;
1819 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1820 SettingProfileUG *ad = list_item->userdata;
1821 //SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1823 double val = elm_slider_value_get(obj);
1824 int value = (int)(val+0.5);
1825 if(list_item->chk_status != value)
1827 if(safety_flag && (value > MAX_SAFETY_VOLUME_LEVEL))
1830 list_item->chk_status = value;
1831 //int ret = sound_manager_set_volume_with_safety(SOUND_TYPE_MEDIA, value);
1832 int ret = sound_manager_set_volume(SOUND_TYPE_MEDIA, value);
1833 SETTING_TRACE_DEBUG("ret : 0x%.8x", ret);
1835 if(ret == SOUND_MANAGER_ERROR_NO_OPERATION
1836 || ret == SOUND_MANAGER_ERROR_INTERNAL)
1838 SETTING_TRACE_DEBUG("didn't set safety volume");
1839 if(value > MAX_SAFETY_VOLUME_LEVEL)
1841 ad->data_media_volume->chk_status = MAX_SAFETY_VOLUME_LEVEL;
1842 elm_slider_value_set(obj, list_item->chk_status);
1848 safety_flag = FALSE;
1850 SETTING_TRACE_DEBUG("media volume is %d, %f", list_item->chk_status, val);
1853 setting_profile_create_warning_popup_during_call(ad);
1854 if(ad->no_play_popup)
1857 if(ad->mp_media == NULL)
1859 setting_profile_close_other_mm_players_but_type(ad, SOUND_TYPE_MEDIA);
1860 if(list_item->chk_status > 0)
1862 char *pa_tone_path = NULL;
1864 pa_tone_path = (char*)strdup(SETTING_DEFAULT_CALL_TONE_SDK);
1866 pa_tone_path = (char*)strdup(SETTING_DEFAULT_MEDIA_TONE);
1869 sound_manager_get_current_sound_type(&type);
1870 if(type != SOUND_TYPE_MEDIA)
1871 setting_profile_play_sound_origin(&(ad->mp_media), ad, NULL,
1873 (float)list_item->chk_status,
1880 player_state_e state;
1881 player_get_state(*(ad->mp_media), &state);
1882 SETTING_TRACE("ringtone player status : %d", state);
1883 if(state == PLAYER_STATE_PAUSED)
1885 player_start(*(ad->mp_media));
1888 //SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1892 settings_profile_sound_main_sys_sound_slider_value_change_cb(void *data,
1897 ret_if(data == NULL);
1900 //---------------------------------------------
1901 const char *sub_type = NULL;
1902 sub_type = elm_object_widget_type_get(obj);
1903 SETTING_TRACE(">>>> slider type :%s", sub_type);
1904 //---------------------------------------------
1906 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1907 SettingProfileUG *ad = list_item->userdata;
1908 //SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1910 if (!ad || !ad->data_touch_volume || !ad->data_touch_volume->eo_check)
1912 SETTING_TRACE_ERROR("!ad || !ad->data_touch_volume || !ad->data_touch_volume->eo_check");
1916 setting_profile_close_all_mm_players(ad);
1918 //Get the current real value of slider
1919 double val = elm_slider_value_get(obj);
1920 int value = (int)(val+0.5);
1921 sound_manager_set_volume(SOUND_TYPE_SYSTEM, value);
1922 SETTING_TRACE_DEBUG("system volume is %d, %f", value, val);
1924 setting_profile_create_warning_popup_during_call(ad);
1925 if(ad->no_play_popup)
1928 if(list_item->chk_status != value)
1930 if(feedback_initialize() == FEEDBACK_ERROR_NONE)
1932 feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
1933 feedback_deinitialize();
1935 list_item->chk_status = value;
1936 setting_profile_update_slider_icon(list_item, SND_SLIDER_SYSTEM);
1938 //SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1942 setting_profile_sound_main_call_vib_sound_slider_value_change_cb(void *data,
1947 ret_if(data == NULL);
1949 static int priv_val_int = 0;
1950 double val = elm_slider_value_get(obj);
1951 SETTING_TRACE_DEBUG("val = %f", val);
1952 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1953 SettingProfileUG *ad = list_item->userdata;
1954 SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
1959 slider_value = (int)(val+0.5); /* to sync displayed value on slider */
1960 list_item->chk_status = slider_value;
1961 if (slider_value != priv_val_int) {
1962 setting_profile_close_all_mm_players(ad);
1963 priv_val_int = slider_value;
1964 vconf_set_int(VCONFKEY_SETAPPL_CALL_VIBRATION_LEVEL_INT, slider_value);
1965 if(slider_value != 0)
1967 SETTING_TRACE_DEBUG("play_value %d", slider_value);
1968 char *call_vib_pattern = vconf_get_str(VCONFKEY_SETAPPL_CALL_VIBRATION_PATTERN_STR);
1969 if(!call_vib_pattern)
1970 call_vib_pattern = (char*)strdup(SETTING_DEFAULT_CALL_PREVIEW_VIB);
1972 err = haptic_vibrate_file_with_detail(ad->hnd_hpt, call_vib_pattern,
1973 1, slider_value * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
1975 SETTING_TRACE_DEBUG("haptic_vibrate_file_with_detail() failed");
1977 FREE(call_vib_pattern);
1981 if (ad->hnd_hpt && haptic_stop_all_effects(ad->hnd_hpt) != 0) {
1982 SETTING_TRACE("ERROR haptic_stop_all_effects");
1986 setting_profile_update_slider_icon(list_item, SND_SLIDER_CALL_VIB);
1988 SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
1992 setting_profile_sound_main_vib_sound_slider_value_change_cb(void *data,
1997 ret_if(data == NULL);
1999 static int priv_val_int = 0;
2000 double val = elm_slider_value_get(obj);
2001 SETTING_TRACE_DEBUG("val = %f", val);
2002 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2003 SettingProfileUG *ad = list_item->userdata;
2004 SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
2009 slider_value = (int)(val+0.5); /* to sync displayed value on slider */
2010 list_item->chk_status = slider_value;
2011 if (slider_value != priv_val_int) {
2012 setting_profile_close_all_mm_players(ad);
2013 priv_val_int = slider_value;
2014 vconf_set_int(VCONFKEY_SETAPPL_NOTI_VIBRATION_LEVEL_INT, slider_value);
2015 if(slider_value != 0)
2017 SETTING_TRACE_DEBUG("play_value %d", slider_value);
2018 err = haptic_vibrate_file_with_detail(ad->hnd_hpt, SETTING_DEFAULT_NOTI_PREVIEW_VIB,
2019 1, slider_value * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
2021 SETTING_TRACE_DEBUG("haptic_vibrate_file_with_detail() failed");
2024 setting_profile_update_slider_icon(list_item, SND_SLIDER_NOTI_VIB);
2026 SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);
2030 setting_profile_sound_main_touchVib_sound_slider_value_change_cb(void *data,
2036 ret_if(data == NULL);
2038 static int priv_val_int = 0;
2039 double val = elm_slider_value_get(obj);
2040 SETTING_TRACE_DEBUG("val = %f", val);
2041 Setting_GenGroupItem_Data *list_item =
2042 (Setting_GenGroupItem_Data *) data;
2043 SettingProfileUG *ad = list_item->userdata;
2044 SWIP_EFFECT_DISABLE(ad->ly_main, ad->ctrl_bar);
2049 slider_value = (int)(val+0.5); /* to sync displayed value on slider */
2050 list_item->chk_status = slider_value;
2051 if (slider_value != priv_val_int) {
2052 setting_profile_close_all_mm_players(ad);
2053 priv_val_int = slider_value;
2054 vconf_set_int (VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, slider_value);
2055 if(slider_value != 0)
2057 SETTING_TRACE_DEBUG("play_value %d", slider_value);
2058 err = haptic_vibrate_file_with_detail(ad->hnd_hpt, SETTING_DEFAULT_HAPTIC_PREVIEW_VIB,
2059 1, slider_value * SETTING_VIB_FEEDBACK_RATE, HAPTIC_PRIORITY_MIN, NULL);
2061 SETTING_TRACE_DEBUG("haptic_vibrate_file_with_detail() failed");
2064 setting_profile_update_slider_icon(list_item, SND_SLIDER_SYSTEM_VIB);
2066 SWIP_EFFECT_ENABLE(ad->ly_main, ad->ctrl_bar);