Tizen 2.0 Release
[apps/home/settings.git] / setting-profile / include / setting-profile.h
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __SETTING_PROFILE_H__
18 #define __SETTING_PROFILE_H__
19
20 #include <stdio.h>
21 #include <math.h>
22
23 #include <Elementary.h>
24 #include <glib-object.h>
25
26 #include <player.h>
27 #include <sound_manager.h>
28
29 #include <haptic.h>
30 #include <svi.h>
31
32 #include <setting-common-draw-widget.h>
33 #include <setting-common-view.h>
34 #include <pthread.h>
35
36 #define MIGRATION_HAPTIC 1
37
38 #define HAPTIC_TEST_ITERATION 1
39 #define VOLUME_DEN (15.0)       /* ie equals float(SETTING_SOUND_VOL_MAX) */
40
41 #define SETTING_SOUND_TEXT_REPEAT_ONCE                  "IDS_ST_BODY_ONCE"
42 #define SETTING_SOUND_TEXT_REPEAT_2MIN                  "IDS_ST_BODY_EVERY_2MIN"
43 #define SETTING_SOUND_TEXT_REPEAT_5MIN                  "IDS_ST_BODY_EVERY_5MIN"
44 #define SETTING_SOUND_TEXT_REPEAT_10MIN                 "IDS_ST_BODY_EVERY_10MINUTES"
45
46 #define SETTING_SOUND_REPEAT_TYPE_LEN 4
47
48 typedef enum {
49         SETTING_PROF_VIEW_VOL = 0,
50         SETTING_PROF_VIEW_RTN,
51         SETTING_PROF_VIEW_MAX
52 } setting_profile_types;
53
54 typedef enum {
55         SETTING_VOL_TYPE_RINGTONE = 0,
56         SETTING_VOL_TYPE_NOTIFICATION,
57         SETTING_VOL_TYPE_MEDIA,
58         SETTING_VOL_TYPE_SYSTEM,
59         SETTING_VOL_TYPE_NOTI_VIB,
60         SETTING_VOL_TYPE_HAPTIC_VIB,
61         SETTING_VOL_TYPE_MAX
62 } setting_volume_types;
63
64 typedef enum {
65         SETTING_VOL_SOUND_GROUP = 0,
66         SETTING_VOL_VIBRATION_GROUP,
67         SETTING_VOL_GROUP_MAX
68 } setting_volume_groups;
69
70 #define SETTING_VIB_VOL_MAX 5
71 #define SETTING_VIB_VOL_MIN 1
72 #define SETTING_SOUND_VOL_MAX 15
73 #define SETTING_SOUND_VOL_MIN 1
74 #define SETTING_SYSTEM_VOL_MAX 15
75 #define SETTING_SYSTEM_VOL_MIN 0
76 #define SETTING_SOUND_CONTROLBAR_ITEM_LEN 10
77
78 #define SETTING_DEFAULT_RINGTONE_VOL_INT        13
79 #define SETTING_DEFAULT_NOTI_VOL_INT            7
80 #define SETTING_DEFAULT_MEDIA_VOL_INT           7
81 #define SETTING_DEFAULT_SYSTEM_VOL_INT          5
82 #define SETTING_DEFAULT_NOTI_VIB_INT            5
83 #define SETTING_DEFAULT_HAPTIC_VIB_INT          3
84 #define SETTING_DEFAULT_ALERT_REPEAT_TYPE_INT   0
85 #define SETTING_SOUND_VIB_TYPE_LEN 5
86
87 #define SETTING_DEFAULT_RINGTONE_PATH   "/opt/share/settings/Ringtones"
88 #define SETTING_DEFAULT_ALERT_PATH              "/opt/share/settings/Alerts"
89 #define SETTING_PROFILE_MMC_PATH                "/opt/storage/sdcard/"
90 #define SETTING_DEFAULT_VIB_PATH                "/usr/share/svi/haptic/default/"
91
92 #define DELIM           "/"
93
94 #define SETTING_DEFAULT_CALL_TONE               SETTING_DEFAULT_RINGTONE_PATH""DELIM"ringtone_sdk.mp3"
95 #define SETTING_DEFAULT_MSG_TONE                SETTING_DEFAULT_ALERT_PATH""DELIM"General notification_sdk.wav"
96 #define SETTING_DEFAULT_EMAIL_TONE              SETTING_DEFAULT_MSG_TONE
97 #define SETTING_DEFAULT_MEDIA_TONE              SETTING_DEFAULT_CALL_TONE
98
99 #define IMG_CTRL_ICON_RINGTONE          SETTING_ICON_PATH_CFG"A01-1_controlbar_icon_ringtones.png"
100 #define IMG_CTRL_ICON_VOLUME            SETTING_ICON_PATH_CFG"A01-1_controlbar_icon_volume.png"
101
102 #define SETTING_VIB_FEEDBACK_RATE               20
103
104 typedef struct _SettingProfileUG SettingProfileUG;
105
106 /**
107  * Setting Profile UG context
108  * all UG function has void* as an agument. this is casted back to SettingProfileUG
109  * and the functions access app context.
110  */
111 struct _SettingProfileUG {
112         ui_gadget_h ug;
113         ui_gadget_h ug_loading;
114
115         /* add more variables here (move your appdata to here) */
116         Evas *evas;
117         Evas_Object *win_main_layout;
118         Evas_Object *win_get;
119         Evas_Object *navi_bar;
120         Evas_Object *ctrl_bar;
121         Evas_Object *view_layout;
122         Evas_Object *ly_main;
123         Evas_Object *sub_view[SETTING_PROF_VIEW_MAX];
124         Elm_Object_Item *ctrl_item[SETTING_SOUND_CONTROLBAR_ITEM_LEN];
125
126         Elm_Genlist_Item_Class itc_1text_1icon;
127         Elm_Genlist_Item_Class itc_group_item;
128         Elm_Genlist_Item_Class itc_2text_2;
129         Elm_Genlist_Item_Class itc_layout;
130         Elm_Genlist_Item_Class itc_seperator;
131         Elm_Genlist_Item_Class itc_bg_1icon;
132         Elm_Genlist_Item_Class itc_2text_3_parent;
133         Elm_Genlist_Item_Class itc_1icon_1text_sub;
134
135         /* Volume tab */
136         Setting_GenGroupItem_Data *data_sound;
137         Setting_GenGroupItem_Data *data_vibration;
138         Setting_GenGroupItem_Data *data_call_volume;
139         Setting_GenGroupItem_Data *data_noti_volume;
140         Setting_GenGroupItem_Data *data_vib_volume;
141         Setting_GenGroupItem_Data *data_touch_volume;
142         Setting_GenGroupItem_Data *data_touch_vib;
143         Setting_GenGroupItem_Data *data_media_volume;
144
145         player_h *mp_ringtone;
146         player_h *mp_noti;
147         player_h *mp_sys;
148         player_h *mp_media;
149
150         Ecore_Timer *volume_timer;
151         setting_volume_types cur_vol_type;
152
153         haptic_device_h hnd_hpt;
154         int playing_volume;
155         char *song_playing;
156         char *ringtone_type;
157
158         Ecore_Event_Handler *event_handler;
159
160         /* Ringtone tab */
161         Setting_GenGroupItem_Data *data_call_alert_tone;
162         Setting_GenGroupItem_Data *data_call_alert_vib;
163         Setting_GenGroupItem_Data *data_msg_alert_tone;
164         Setting_GenGroupItem_Data *data_email_alert_tone;
165         Setting_GenGroupItem_Data *data_msg_alert_repeat;
166         Setting_GenGroupItem_Data *data_email_alert_repeat;
167         Setting_GenGroupItem_Data *data_lock_sound;
168         Setting_GenGroupItem_Data *data_touch_sounds;
169
170 };
171
172 extern setting_view setting_view_profile_sound_main;
173
174 void setting_profile_play_sound_origin(player_h **mp_handle, void *data,
175                                         void *cb, char *ringtone_file, float vol,
176                                         sound_type_e sound_type);
177 int setting_profile_check_file_exist(void *data, const char *file_path);
178
179 player_h *setting_profile_play_sound(void *data, void *cb,
180                                         char *ringtone_file,
181                                         int vol,
182                                         sound_type_e sound_type);
183
184 int setting_profile_stop_sound(void *data, player_h *player);
185 void setting_profile_change_player_volume(player_h **mp_handle, float vol);
186 int setting_profile_close_other_mm_players_but_type(void *data,
187                                                     sound_type_e type);
188 int setting_profile_close_all_mm_players(void *data);
189 void setting_profile_play_vibration(void *data, int value);
190
191 int setting_profile_get_call_playing_vib_by_vconf_value(int call_vib_value);
192
193 void __setting_profile_ug_key_grab(SettingProfileUG *ad);
194 void __setting_profile_ug_key_ungrab(SettingProfileUG *ad);
195
196
197 #endif