fe94f8da64f174c25c45f9fc66a375fda712c553
[apps/core/preloaded/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 <stdio.h>
25 #include <math.h>
26
27 #include <Elementary.h>
28 #include <glib-object.h>
29
30 #include <player.h>
31 #include <sound_manager.h>
32
33 #include <haptic.h>
34 #include <svi.h>
35
36 #include <setting-common-draw-widget.h>
37 #include <setting-common-view.h>
38 #include <pthread.h>
39
40 #define MIGRATION_HAPTIC 1
41
42 #define HAPTIC_TEST_ITERATION 1
43 #define VOLUME_DEN (15.0)       /* ie equals float(SETTING_SOUND_VOL_MAX) */
44
45 #define SETTING_SOUND_TEXT_REPEAT_ONCE                  "IDS_ST_BODY_ONCE"
46 #define SETTING_SOUND_TEXT_REPEAT_2MIN                  "IDS_ST_BODY_EVERY_2MIN"
47 #define SETTING_SOUND_TEXT_REPEAT_5MIN                  "IDS_ST_BODY_EVERY_5MIN"
48 #define SETTING_SOUND_TEXT_REPEAT_10MIN                 "IDS_ST_BODY_EVERY_10MINUTES"
49
50 #define SETTING_SOUND_REPEAT_TYPE_LEN 4
51
52 typedef enum {
53         SETTING_PROF_VIEW_VOL = 0,
54         SETTING_PROF_VIEW_RTN,
55         SETTING_PROF_VIEW_MAX
56 } setting_profile_types;
57
58 typedef enum {
59         SETTING_VOL_TYPE_RINGTONE = 0,
60         SETTING_VOL_TYPE_NOTIFICATION,
61         SETTING_VOL_TYPE_MEDIA,
62         SETTING_VOL_TYPE_SYSTEM,
63         SETTING_VOL_TYPE_NOTI_VIB,
64         SETTING_VOL_TYPE_HAPTIC_VIB,
65         SETTING_VOL_TYPE_MAX
66 } setting_volume_types;
67
68 typedef enum {
69         SETTING_VOL_SOUND_GROUP = 0,
70         SETTING_VOL_VIBRATION_GROUP,
71         SETTING_VOL_GROUP_MAX
72 } setting_volume_groups;
73
74 #define SETTING_VIB_VOL_MAX 5
75 #define SETTING_VIB_VOL_MIN 1
76 #define SETTING_SOUND_VOL_MAX 15
77 #define SETTING_SOUND_VOL_MIN 1
78 #define SETTING_SYSTEM_VOL_MAX 15
79 #define SETTING_SYSTEM_VOL_MIN 0
80 #define SETTING_SOUND_CONTROLBAR_ITEM_LEN 10
81
82 #define SETTING_DEFAULT_RINGTONE_VOL_INT        13
83 #define SETTING_DEFAULT_NOTI_VOL_INT            7
84 #define SETTING_DEFAULT_MEDIA_VOL_INT           7
85 #define SETTING_DEFAULT_SYSTEM_VOL_INT          5
86 #define SETTING_DEFAULT_NOTI_VIB_INT            5
87 #define SETTING_DEFAULT_HAPTIC_VIB_INT          3
88 #define SETTING_DEFAULT_ALERT_REPEAT_TYPE_INT   0
89 #define SETTING_SOUND_VIB_TYPE_LEN 5
90
91 #define SETTING_DEFAULT_RINGTONE_PATH   "/opt/share/settings/Ringtones"
92 #define SETTING_DEFAULT_ALERT_PATH              "/opt/share/settings/Alerts"
93 #define SETTING_PROFILE_MMC_PATH                "/opt/storage/sdcard/"
94 #define SETTING_DEFAULT_VIB_PATH                "/usr/share/svi/haptic/default/"
95
96 #define DELIM           "/"
97
98 #define SETTING_DEFAULT_CALL_TONE               SETTING_DEFAULT_RINGTONE_PATH""DELIM"ringtone_sdk.mp3"
99 #define SETTING_DEFAULT_MSG_TONE                SETTING_DEFAULT_ALERT_PATH""DELIM"General notification_sdk.wav"
100 #define SETTING_DEFAULT_EMAIL_TONE              SETTING_DEFAULT_MSG_TONE
101 #define SETTING_DEFAULT_MEDIA_TONE              SETTING_DEFAULT_CALL_TONE
102
103 typedef struct _SettingProfileUG SettingProfileUG;
104
105 /**
106  * Setting Profile UG context
107  * all UG function has void* as an agument. this is casted back to SettingProfileUG
108  * and the functions access app context.
109  */
110 struct _SettingProfileUG {
111         ui_gadget_h ug;
112         ui_gadget_h ug_loading;
113
114         /* add more variables here (move your appdata to here) */
115         Evas *evas;
116         Evas_Object *win_main_layout;
117         Evas_Object *win_get;
118         Evas_Object *navi_bar;
119         Evas_Object *ctrl_bar;
120         Evas_Object *view_layout;
121         Evas_Object *ly_main;
122         Evas_Object *sub_view[SETTING_PROF_VIEW_MAX];
123         Elm_Object_Item *ctrl_item[SETTING_SOUND_CONTROLBAR_ITEM_LEN];
124
125         Elm_Genlist_Item_Class itc_1text_1icon;
126         Elm_Genlist_Item_Class itc_group_item;
127         Elm_Genlist_Item_Class itc_2text_2;
128         Elm_Genlist_Item_Class itc_layout;
129         Elm_Genlist_Item_Class itc_seperator;
130         Elm_Genlist_Item_Class itc_bg_1icon;
131         Elm_Genlist_Item_Class itc_2text_3_parent;
132         Elm_Genlist_Item_Class itc_1icon_1text_sub;
133
134         /* Volume tab */
135         Setting_GenGroupItem_Data *data_sound;
136         Setting_GenGroupItem_Data *data_vibration;
137         Setting_GenGroupItem_Data *data_call_volume;
138         Setting_GenGroupItem_Data *data_noti_volume;
139         Setting_GenGroupItem_Data *data_vib_volume;
140         Setting_GenGroupItem_Data *data_touch_volume;
141         Setting_GenGroupItem_Data *data_touch_vib;
142         Setting_GenGroupItem_Data *data_media_volume;
143
144         player_h *mp_ringtone;
145         player_h *mp_noti;
146         player_h *mp_sys;
147         player_h *mp_media;
148
149         Ecore_Timer *volume_timer;
150         setting_volume_types cur_vol_type;
151
152         haptic_device_h hnd_hpt;
153         int playing_volume;
154         char *song_playing;
155         char *ringtone_type;
156
157         Ecore_Event_Handler *event_handler;
158
159         /* Ringtone tab */
160         Setting_GenGroupItem_Data *data_call_alert_tone;
161         Setting_GenGroupItem_Data *data_call_alert_vib;
162         Setting_GenGroupItem_Data *data_msg_alert_tone;
163         Setting_GenGroupItem_Data *data_email_alert_tone;
164         Setting_GenGroupItem_Data *data_msg_alert_repeat;
165         Setting_GenGroupItem_Data *data_email_alert_repeat;
166         Setting_GenGroupItem_Data *data_lock_sound;
167         Setting_GenGroupItem_Data *data_touch_sounds;
168
169 };
170
171 extern setting_view setting_view_profile_sound_main;
172
173 void setting_profile_play_sound_origin(player_h **mp_handle, void *data,
174                                         void *cb, char *ringtone_file, float vol,
175                                         sound_type_e sound_type);
176 int setting_profile_check_file_exist(void *data, const char *file_path);
177
178 player_h *setting_profile_play_sound(void *data, void *cb,
179                                         char *ringtone_file,
180                                         int vol,
181                                         sound_type_e sound_type);
182
183 int setting_profile_stop_sound(void *data, player_h *player);
184 void setting_profile_change_player_volume(player_h **mp_handle, float vol);
185 int setting_profile_close_other_mm_players_but_type(void *data,
186                                                     sound_type_e type);
187 int setting_profile_close_all_mm_players(void *data);
188 void setting_profile_play_vibration(void *data, int value);
189
190 int setting_profile_get_call_playing_vib_by_vconf_value(int call_vib_value);
191
192
193 #endif