tizen 2.4 release
[apps/home/settings.git] / setting-profile / include / setting-profile.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21 #ifndef __SETTING_PROFILE_H__
22 #define __SETTING_PROFILE_H__
23
24 #include <player.h>
25 #include <sound_manager.h>
26 #include <setting-common-general-func.h>
27 #include <setting-common-draw-widget.h>
28 #include <setting-common-view.h>
29 #include <efl_extension.h>
30 #include <feedback.h>
31 #include <call-manager.h>
32 #include <system_settings.h>
33
34 #define VOLUME_APP_NAME "org.tizen.setting.volume"
35 #define MAX_SAFETY_VOLUME_LEVEL 10
36 #define SETTING_PROFILE_SOUND_ALERTS_PATH   "/opt/usr/share/settings/Alerts"
37 #define SETTING_PROFILE_SOUND_RINGTONES_PATH    "/opt/usr/share/settings/Ringtones"
38 #define SETTING_PROFILE_MMC_PATH        "/opt/storage/sdcard"
39 #define SETTING_DEFAULT_MSG_TONE        "/opt/usr/share/settings/Alerts/Whistle.ogg"
40 #define SETTING_DEFAULT_MEDIA_TONE      "/opt/usr/share/settings/Previews/Media_preview_Over_the_horizon.ogg"
41 #define SUPPORT_PLAYER_ASYNC 1
42
43 /*Call ringtone:3 icon status */
44 #define ICON_CALL_VIB       SETTING_ICON_PATH_CFG"B04_slider_icon_vibrate.png"
45 #define ICON_CALL_NORMAL    SETTING_ICON_PATH_CFG"B04_slider_icon_ring.png"
46 #define ICON_CALL_MUTE      SETTING_ICON_PATH_CFG"B04_volume_icon_mute.png"
47
48 /*Notification: 2 icon status */
49 #define ICON_NOTI_MUTE      SETTING_ICON_PATH_CFG"B04_slider_icon_notification_mute.png"
50 #define ICON_NOTI_NORMAL    SETTING_ICON_PATH_CFG"B04_slider_icon_notification.png"
51
52 /*Media: 2 icon status */
53 #define ICON_MEDIA_MUTE     SETTING_ICON_PATH_CFG"B04_volume_icon_mute.png"
54 #define ICON_MEDIA_NORMAL   SETTING_ICON_PATH_CFG"00_volume_icon.png"
55
56 /*System:2 icon status */
57 #define ICON_SYSTEM_MUTE    SETTING_ICON_PATH_CFG"B04_slider_icon_system_mute.png"
58 #define ICON_SYSTEM_NORMAL  SETTING_ICON_PATH_CFG"B04_slider_icon_system.png"
59
60
61 typedef enum {
62     SND_SLIDER_CALL = 0,
63     SND_SLIDER_NOTI,
64     SND_SLIDER_MEDIA,
65     SND_SLIDER_SYSTEM,
66     SND_SLIDER_MAX,
67 } SoundType;
68
69 typedef struct _SettingProfileUG SettingProfileUG;
70
71 /**
72  * Setting Profile UG context
73  * all UG function has void* as an agument. this is casted back to SettingProfileUG
74  * and the functions access app context.
75  */
76 struct _SettingProfileUG {
77         ui_gadget_h ug;
78         ui_gadget_h ug_loading;
79         char *viewtype;
80
81         /* add more variables here (move your appdata to here) */
82         Evas *evas;
83         Evas_Object *win_main_layout;
84         Evas_Object *win_get;
85         Evas_Object *navi_bar;
86         Evas_Object *ly_main;
87         Evas_Object *gl_lite_main;
88
89         Elm_Genlist_Item_Class itc_layout;
90         Elm_Genlist_Item_Class itc_layout_1icon;
91
92         /* Main view */
93         Setting_GenGroupItem_Data *data_call_alert_tone;
94         Setting_GenGroupItem_Data *data_call_volume;
95         Setting_GenGroupItem_Data *data_msg_alert_tone;
96         Setting_GenGroupItem_Data *data_noti_volume;
97         Setting_GenGroupItem_Data *data_touch_volume;
98         Setting_GenGroupItem_Data *data_media_volume;
99         Setting_GenGroupItem_Data *data_sound_when_ring;
100         Setting_GenGroupItem_Data *data_do_not_disturb;
101
102         /* Feedback */
103         Setting_GenGroupItem_Data *data_lock_sound;
104         Setting_GenGroupItem_Data *data_keyboard_sound;
105         Setting_GenGroupItem_Data *data_button_sounds;
106         Setting_GenGroupItem_Data *data_touch_sounds;
107
108
109         player_h *mp_ringtone;
110         player_h *mp_noti;
111         player_h *mp_media;
112         player_h *mp_prepare_async;
113
114         bool sound_on;
115         char *song_playing;
116         char *ringtone_type;
117         char *sdcard_ringtone_path;
118
119         Ecore_Idler *play_ringtone_idler; /* for performance of incoming call ringtone slider */
120
121         Ecore_Event_Handler *keydown_handler;
122         Ecore_Event_Handler *keyup_handler;
123         bool is_pressing;
124         Ecore_Timer *updown_timer;
125         Evas_Object *calling_popup; /* Unable to pre-listening during a call */
126         int backup_ringtong_volume;
127         bool is_ringtone_slidering;
128 };
129
130 extern setting_view setting_view_sound_main;
131
132 extern void setting_sound_play_sound_origin(player_h **mp_handle, void *data,
133                                             void *cb, char *ringtone_file, float vol,
134                                             sound_type_e sound_type);
135 extern int setting_sound_check_file_exist(void *data, const char *file_path);
136
137 extern void system_settings_changed_silent_mode(system_settings_key_e key, void *user_data);
138
139 extern player_h *setting_sound_play_sound(void *data, void *cb,
140                                           char *ringtone_file,
141                                           int vol,
142                                           sound_type_e sound_type);
143
144 extern int __close_player(void *data, SoundType type);
145
146 extern int setting_sound_stop_sound(void *data, player_h *player);
147 extern int setting_sound_close_other_mm_players_but_type(void *data, sound_type_e type);
148 extern int setting_sound_close_all_mm_players(void *data);
149 extern void __setting_sound_ug_key_grab(SettingProfileUG *ad);
150 extern void __setting_sound_ug_key_ungrab(SettingProfileUG *ad);
151 extern char *setting_media_basename(char *path);
152 extern void setting_sound_create_warning_popup_during_call(void *data);
153 extern char *setting_sound_get_slider_icon(int type, int volume);
154 extern void setting_sound_update_slider_icon(Setting_GenGroupItem_Data *item_data, int type);
155 extern Evas_Object *setting_sound_init(void *data);
156 extern void setting_sound_deinit(void *data);
157 char *setting_do_not_disturb_is_enable(void *data);
158
159 #endif