update license verison number 1.0 -> 1.1
[apps/home/settings.git] / setting-powersaving / src / setting-powersaving-about.c
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.1 (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
18 #include <setting-powersaving-about.h>
19 #if SUPPORT_UI0_4
20 #define CPU_PS_DESC_DETAIL "IDS_ST_BODY_THIS_OPTION_LIMITS_THE_MAXIMUM_CPU_PERFORMANCE_AND_HELPS_TO_CONSERVE_BATTERY_LIFE_IT_WILL_NOT_EFFECT_NORMAL_USAGE_LIKE_BROWSING_AND_VIDEO_PLAYBACK_MSG"
21 #define CPU_PS_DESC KeyStr_CPU_PS
22
23 #define DISPLAY_PS_DESC_DETAIL "IDS_ST_BODY_THIS_OPTION_REDUCES_THE_SCREEN_FRAME_RATE_AND_LOWERS_THE_BRIGHTNESS_IT_HELPS_TO_EXTEND_BATTERY_LIFE_WHEN_THE_SCREEN_IS_TURNED_ON"
24 #define DISPLAY_PS_DESC KeyStr_DISPLAY_PS
25
26 #define BG_COLOR_DESC_DETAIL "IDS_ST_BODY_THIS_OPTION_CHANGES_THE_BACKGROUND_COLOUR_BRIGHTNESS_LEVEL_SO_THAT_IT_CONSUMES_LESS_BATTERY_MSG"
27 #define BG_COLOR_DESC KeyStr_BG_COLOR
28
29 #define VIBRATION_DESC_DETAIL "IDS_ST_BODY_THE_VIBRATE_FUNCTION_USES_ADDITIONAL_BATTERY_POWER"
30 #define VIBRATION_DESC KeyStr_SCREEN_VIB
31 #else
32 #define MAIN_DESC "1. System power saving settings<br>"\
33                 "Set system functions below<br>"\
34                 "  1.Dual core max<br>"\
35                 "  2.Brightness<br>"\
36                 "  3.UI rendering speed"
37
38 #define WIFI_DESC "2. Wi-Fi<br>"\
39                 "Turn off Wi-Fi, Turning off Wi-Fi can extend battery life, "\
40                 "However, if you surf the Web frequently, using Wi-Fi can "\
41                 "save more battery than using the cellular network."
42
43 #define BT_DESC "3. Bluetooth<br>"\
44                 "Turn off Bluetooth. Not using Bluetooth headset or Car home "\
45                 "mode can extend battery life"
46
47 #define GPS_DESC "4. GPS<br>"\
48                 "Applications using GPS location data reduce battery life. "\
49                 "Turning off BDU GPS can extend battery life"
50
51 #define SYNC_DESC "5. Data sync<br>"\
52                 "Applications such as Gmail, Calendar, and Twitter are auto"\
53                 "synced via wireless network at specific intervals. Syncing "\
54                 "data manually can extend battery life"
55
56 #define HOTSPOT_DESC "6. Portable Wi-Fi hotspot<br>"\
57                 "Turn off Portable Wi-Fi hotspot. Sharing mobile internet"\
58                 " connection with other devices can reduce battery life. "\
59                 "Turn off portable Wi-Fi hotspot to extend battery life."
60
61 #define BRIGHT_DESC "7. Brightness<br>"\
62                         "Lowering the brightness of the screen can extend battery life."\
63                         "Selecting Automatic brightness will adjust screen brightness"\
64                         " to ambient automatically"
65
66 #define ETC_DESC "8. Etc.<br>"\
67                 "1.Disabling Use packet data(Settings > Wireless and network >"\
68                 " Mobile networks) helps extend battery.<br>"\
69                 "2.Disabling Auto sync (Settings > Account and sync) "\
70                 "helps extend battery"
71 #endif
72 static int setting_powersaving_about_create(void *cb);
73 static int setting_powersaving_about_destroy(void *cb);
74 static int setting_powersaving_about_update(void *cb);
75 static int setting_powersaving_about_cleanup(void *cb);
76
77 setting_view setting_view_powersaving_about = {
78         .create = setting_powersaving_about_create,
79         .destroy = setting_powersaving_about_destroy,
80         .update = setting_powersaving_about_update,
81         .cleanup = setting_powersaving_about_cleanup,
82 };
83
84 /* ***************************************************
85  *
86  *basic func
87  *
88  ***************************************************/
89
90 static int setting_powersaving_about_create(void *cb)
91 {
92         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
93
94         SettingPowersavingUG *ad = (SettingPowersavingUG *) cb;
95         char temp[MAX_COMMON_BUFFER_LEN] ={0,};
96
97         Evas_Object *genlist;
98         setting_push_layout_navi_bar_genlist(ad->win_main_layout,
99                                              ad->win_get,
100                                              _(KeyStr_Powersaving_About),
101                                              _("IDS_COM_BODY_BACK"),
102                                              NULL,
103                                              setting_powersaving_about_click_back_cb,
104                                              NULL, ad, &genlist, ad->navi_bar);
105         #if SUPPORT_UI0_4
106         Setting_GenGroupItem_Data *item_data = NULL;
107         snprintf(temp, MAX_COMMON_BUFFER_LEN, "1. %s<br>%s", _(CPU_PS_DESC), _(CPU_PS_DESC_DETAIL));
108         item_data = setting_create_Gendial_field_def(genlist, &itc_multiline_text,
109                                          NULL,
110                                          ad,
111                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
112                                          NULL, NULL, 0, temp, NULL, NULL);
113         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
114
115         memset(temp, 0x00, MAX_COMMON_BUFFER_LEN);
116         snprintf(temp, MAX_COMMON_BUFFER_LEN, "2. %s<br>%s", _(VIBRATION_DESC), _(VIBRATION_DESC_DETAIL));
117         item_data = setting_create_Gendial_field_def(genlist, &itc_multiline_text,
118                                          NULL,
119                                          ad,
120                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
121                                          NULL, NULL, 0, temp, NULL, NULL);
122         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
123         #else
124         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
125                                          NULL,
126                                          ad,
127                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
128                                          NULL, NULL, 0, MAIN_DESC, NULL, NULL);
129
130         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
131                                          NULL,
132                                          ad,
133                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
134                                          NULL, NULL, 0, WIFI_DESC, NULL, NULL);
135
136         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
137                                          NULL,
138                                          ad,
139                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
140                                          NULL, NULL, 0, BT_DESC, NULL, NULL);
141
142         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
143                                          NULL,
144                                          ad,
145                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
146                                          NULL, NULL, 0, GPS_DESC, NULL, NULL);
147         setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL, ad,
148                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
149                                          NULL, NULL, 0, SYNC_DESC, NULL, NULL);
150
151         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
152                                          NULL,
153                                          ad,
154                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
155                                          NULL, NULL, 0, HOTSPOT_DESC, NULL,
156                                          NULL);
157
158         setting_create_Gendial_field_def(genlist, &itc_multiline_text,
159                                          NULL,
160                                          ad,
161                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
162                                          NULL, NULL, 0, BRIGHT_DESC, NULL,
163                                          NULL);
164
165         setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL, ad,
166                                          SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
167                                          NULL, NULL, 0, ETC_DESC, NULL, NULL);
168         #endif
169         setting_view_powersaving_about.is_create = 1;
170
171         return SETTING_RETURN_SUCCESS;
172 }
173
174 static int setting_powersaving_about_destroy(void *cb)
175 {
176         /* error check */
177         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
178
179         SettingPowersavingUG *ad = (SettingPowersavingUG *) cb;
180
181         elm_naviframe_item_pop(ad->navi_bar);
182         setting_view_powersaving_about.is_create = 0;
183
184         return SETTING_RETURN_SUCCESS;
185 }
186
187 static int setting_powersaving_about_update(void *cb)
188 {
189         return SETTING_RETURN_SUCCESS;
190 }
191
192 static int setting_powersaving_about_cleanup(void *cb)
193 {
194         return setting_powersaving_about_destroy(cb);
195 }
196
197 /* ***************************************************
198  *
199  *general func
200  *
201  ***************************************************/
202
203 /* ***************************************************
204  *
205  *call back func
206  *
207  ***************************************************/
208
209 static void
210 setting_powersaving_about_click_back_cb(void *data, Evas_Object *obj,
211                                         void *event_info)
212 {
213         /* error check */
214         setting_retm_if(data == NULL, " Data parameter is NULL");
215
216         SettingPowersavingUG *ad = (SettingPowersavingUG *) data;
217         setting_view_change(&setting_view_powersaving_about,
218                             &setting_view_powersaving_main, ad);
219 }