1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
|
/* * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd All Rights Reserved
*
* PROPRIETARY/CONFIDENTIAL
*
* This software is the confidential and proprietary information of
* SAMSUNG ELECTRONICS ("Confidential Information").
* You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement
* you entered into with SAMSUNG ELECTRONICS.
* SAMSUNG make no representations or warranties about the suitability
* of the software, either express or implied, including but not
* limited to the implied warranties of merchantability, fitness for
* a particular purpose, or non-infringement.
* SAMSUNG shall not be liable for any damages suffered by licensee as
* a result of using, modifying or distributing this software or its derivatives.
*/
/*
* setting-display.c
*
* Created on: Oct 9, 2013
* Author: min-hoyun
*/
#include <device/display.h>
#include <system_settings.h>
#include <vconf.h>
#include <vconf-keys.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <glib.h>
#include <stdint.h>
#include "setting_data_vconf.h"
#include "setting-display.h"
#include "setting_view_toast.h"
#include "setting-language.h"
#include "setting-homescreen.h"
#include "setting-motion.h"
#include "util.h"
#include "setting-clock.h"
/* temporary source code */
#define VCONFKEY_SETAPPL_LCD_TIMEOUT_BACKUP_FOR_WATCH_ALWAYS_ON "db/setting/lcd_backlight_timeout_backup"
static Evas_Object *g_btn_plus = NULL;
static Evas_Object *g_center_img = NULL;
static Evas_Object *g_btn_minus = NULL;
static Evas_Object *g_slider = NULL;
static int is_changed = 0;
static void _display_brightness_cb(void *data, Evas_Object *obj, void *event_info);
static void change_screen_time_cb(keynode_t *key, void *data);
static struct _display_menu_item display_menu_its[] = {
{ "IDS_ST_BUTTON_BRIGHTNESS", SETTING_DISPLAY_BRIGTHNESS, _display_brightness_cb },
{ "IDS_ST_MBODY_SCREEN_TIMEOUT_ABB", SETTING_DISPLAY_SCREEN_TIME, _display_gl_screen_timeout_cb },
/* { "IDS_ST_BUTTON_LANGUAGE", SETTING_DISPLAY_LANG, _display_gl_language_cb },
#if !defined(FEATURE_SETTING_SDK) && !(FEATURE_SETTING_EMUL)
{ "IDS_ST_MBODY_MANAGE_APPS_ABB", SETTING_DISPLAY_EDIT_APPS, _homescreen_gl_edit_apps_cb },
#endif
*/
};
static int timeout_arr[] = {
0, 15, 30, 60, 300
};
static char *rotate_screen_str[] = {
"IDS_COM_BODY_DEFAULT", "IDS_COM_OPT_ROTATE_CW", "IDS_COM_OPT_ROTATE_CCW", "IDS_ST_SBODY_180_DEGREE"
};
static appdata *g_app_context = NULL;
static Evas_Object *g_display_genlist = NULL;
static Evas_Object *g_screen_time_genlist = NULL;
static Evas_Object *g_rotate_screen_genlist = NULL;
static int g_screen_time_index = 1; /* default: 10 seconds */
static int rotate_screen_rot = 0; /* default: 0(0degree), vconf enum */
static int rotate_screen_index = 0; /* default: 0, list index */
static int touch_mode = NONE;
/* Main display list item */
static Elm_Object_Item *lang_item = NULL;
static Elm_Object_Item *wake_up_item = NULL;
static Elm_Object_Item *g_screen_time_item = NULL;
static void change_language_enabling(keynode_t *key, void *data);
static void change_screen_time_cb(keynode_t *key, void *data);
static void change_language_cb(keynode_t *key, void *data);
static void _set_rotate_screen(const int rotation);
static int _get_rotate_screen();
enum {
DISPLAY_TITLE_DISPLAY,
DISPLAY_TITLE_LANGUAGE,
DISPLAY_TITLE_SCREEN_TIMEOUT,
DISPLAY_TITLE_FONT,
DISPLAY_TITLE_FONT_STYLE,
DISPLAY_TITLE_FONT_SIZE,
DISPLAY_TITLE_NOTIFICATION_INDICATOR,
DISPLAY_TITLE_ROTATE,
};
static char *
_gl_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
int title_idx = (uintptr_t)data;
switch (title_idx) {
case DISPLAY_TITLE_DISPLAY:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_MBODY_DISPLAY_ABB"));
break;
case DISPLAY_TITLE_LANGUAGE:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BUTTON_LANGUAGE"));
break;
case DISPLAY_TITLE_SCREEN_TIMEOUT:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_MBODY_SCREEN_TIMEOUT_ABB"));
break;
case DISPLAY_TITLE_FONT:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BODY_FONT"));
break;
case DISPLAY_TITLE_FONT_STYLE:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BODY_FONT_STYLE"));
break;
case DISPLAY_TITLE_FONT_SIZE:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_ST_BODY_FONT_SIZE_ABB"));
break;
case DISPLAY_TITLE_NOTIFICATION_INDICATOR:
snprintf(buf, sizeof(buf)-1, "%s", _("WDS_CLOCK_MBODY_NOTIFICATION_INDICATOR"));
break;
case DISPLAY_TITLE_ROTATE:
snprintf(buf, sizeof(buf)-1, "%s", _("IDS_COM_OPT_ROTATE"));
break;
}
return strdup(buf);
}
void _init_display()
{
register_vconf_changing(VCONFKEY_WMS_WMANAGER_CONNECTED, change_language_enabling, NULL);
register_vconf_changing(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, change_screen_time_cb, NULL);
register_vconf_changing(VCONFKEY_LANGSET, change_language_cb, NULL);
/*_init_screen_rotate(); */
}
void _init_screen_rotate()
{
int rotate;
rotate = _get_rotate_screen();
rotate_screen_rot = rotate;
if (rotate == SETTING_SCREENROTATION_90_DEGREE) {
/*90R */
rotate_screen_index = 1;
} else if (rotate == SETTING_SCREENROTATION_270_DEGREE) {
/*90L */
rotate_screen_index = 2;
} else if (rotate == SETTING_SCREENROTATION_180_DEGREE) {
/*180 */
rotate_screen_index = 3;
}
if (rotate == -1) {
rotate_screen_rot = SETTING_SCREENROTATION_0_DEGREE;
}
}
void _update_menu_text_when_lang_changed()
{
DBG("Setting - Language is changed...update display list");
if (g_display_genlist) {
elm_genlist_realized_items_update(g_display_genlist);
}
if (g_app_context && g_app_context->main_genlist) {
elm_genlist_realized_items_update(g_app_context->main_genlist);
}
}
void _clear_display_cb(void *data, Evas *e, Elm_Object_Item *it, void *event_info)
{
g_app_context = NULL;
g_screen_time_genlist = NULL;
g_rotate_screen_genlist = NULL;
g_screen_time_item = NULL;
touch_mode = NONE;
unregister_vconf_changing(VCONFKEY_WMS_WMANAGER_CONNECTED, change_language_enabling);
unregister_vconf_changing(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, change_screen_time_cb);
unregister_vconf_changing(VCONFKEY_LANGSET, change_language_cb);
return;
}
void _display_gl_font_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
if (data != NULL) {
_show_font_list(data);
} else {
DBG("ad->font_name is NULL !!!!!!");
}
}
void _display_gl_font_style_cb(void *data, Evas_Object *obj, void *event_info)
{
DBG("_display_gl_font_style_cb");
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
if (data != NULL) {
_show_font_style_list(data);
}
}
void _display_gl_font_size_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
if (data != NULL) {
_show_font_size_list(data);
}
}
void _display_gl_rotate_screen_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
if (data != NULL) {
_show_rotate_screen_list(data);
}
}
void _display_gl_screen_timeout_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
if (data != NULL) {
_show_screen_timeout_list(data);
}
}
void _display_gl_language_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
Evas_Object *genlist = NULL;
Elm_Object_Item *nf_it = NULL;
appdata *ad = data;
if (ad == NULL) {
DBG("Setting - ad is null");
return;
}
if (ad->MENU_TYPE == SETTING_LANGUAGE) {
DBG("Already language screen enter:clear");
return;
}
if (is_connected_GM()) {
DBG("Setting - language can not change!!");
/* automatic freed!! */
struct _toast_data *toast = _create_toast(ad, _("IDS_ST_TPOP_CHANGE_LANGUAGE_ON_MOBILE_DEVICE"));
if (toast) {
_show_toast(ad, toast);
}
return;
}
ad->MENU_TYPE = SETTING_LANGUAGE;
_initialize_language(ad);
_set_launguage_update_cb(_update_menu_text_when_lang_changed);
genlist = _create_lang_list(data);
if (genlist == NULL) {
DBG("%s", "language cb - genlist is null");
return;
}
nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
back_button_cb_push(&back_key_generic_cb, data, NULL, g_display_genlist, "g_display_genlist");
evas_object_event_callback_add(genlist, EVAS_CALLBACK_DEL, _clear_lang_cb, ad);
#if !defined(FEATURE_SETTING_TELEPHONY)
elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE);
#endif
elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE);
ad->MENU_TYPE = SETTING_LANGUAGE;
}
char *_gl_display_title_get(void *data, Evas_Object *obj, const char *part)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Display_Item_Data *id = data;
int index = id->index;
if (!strcmp(part, "elm.text")) {
if (id->item == lang_item) {
if (is_connected_GM()) {
snprintf(buf, sizeof(buf) - 1, "<font color=#515151>%s</font>",
_(display_menu_its[index].name));
} else {
snprintf(buf, sizeof(buf) - 1, "%s",
_(display_menu_its[index].name));
}
DBG("buf --->%s", buf);
} else {
snprintf(buf, sizeof(buf) - 1, "%s", _(display_menu_its[index].name));
}
} else if (!strcmp(part, "elm.text.1")) {
char *text_color = "<font color=#4DCFFFC9>%s</font>";
const char *curr_lang = setting_get_lang_title();
if (id->item == lang_item) {
if (curr_lang) {
if (is_connected_GM()) {
snprintf(buf, sizeof(buf) - 1, "<font color=#515151>%s</font>", curr_lang);
} else {
snprintf(buf, sizeof(buf) - 1, "%s", curr_lang);
}
}
FREE(curr_lang);
} else if (id->item == g_screen_time_item) {
int time = 0;
vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &time);
switch (time) {
case 0:
snprintf(buf, sizeof(buf) - 1, text_color, "No off");
break;
case 15:
snprintf(buf, sizeof(buf) - 1, text_color, _("IDS_ST_BODY_15SEC"));
break;
case 30:
snprintf(buf, sizeof(buf) - 1, text_color, _("IDS_ST_BODY_30SEC"));
break;
case 60:
snprintf(buf, sizeof(buf) - 1, text_color, _("IDS_ST_BODY_1_MINUTE_ABB2"));
break;
case 300:
snprintf(buf, sizeof(buf) - 1, text_color, _("IDS_ST_BODY_5_MINUTES"));
break;
}
} else {
/*snprintf(buf, sizeof(buf) - 1, "%s", _get_wake_up_gesture_sub_title()); */
snprintf(buf, sizeof(buf)-1, "%s", "Motion is unsupported now.");
}
}
return strdup(buf);
}
void _display_gl_del(void *data, Evas_Object *obj)
{
Display_Item_Data *id = data;
FREE(id);
}
Evas_Object *_create_display_list(void *data)
{
appdata *ad = data;
if (ad == NULL) {
DBG("%s", "_create_display_list - appdata is null");
return NULL;
}
Evas_Object *genlist = NULL;
struct _display_menu_item *menu_its = NULL;
int idx = 0;
g_app_context = ad;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
itc->item_style = "1text";
itc->func.text_get = _gl_display_title_get;
itc->func.del = _display_gl_del;
Elm_Genlist_Item_Class *itc2 = elm_genlist_item_class_new();
itc2->item_style = "2text";
itc2->func.text_get = _gl_display_title_get;
itc2->func.del = _display_gl_del;
genlist = elm_genlist_add(ad->nf);
elm_genlist_block_count_set(genlist, 14);
elm_genlist_homogeneous_set(genlist, EINA_TRUE);
elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
connect_to_wheel_with_genlist(genlist, ad);
menu_its = display_menu_its;
Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new();
title_item->func.text_get = _gl_menu_title_text_get;
title_item->item_style = "title";
title_item->func.del = NULL;
elm_genlist_item_append(genlist, title_item, (void *)DISPLAY_TITLE_DISPLAY, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(title_item);
int size = sizeof(display_menu_its) / sizeof(struct _display_menu_item);
for (idx = 0; idx < size; idx++) {
Elm_Genlist_Item_Class *itc_tmp = NULL;
if (menu_its[idx].type == SETTING_DISPLAY_GESTURE
|| menu_its[idx].type == SETTING_DISPLAY_LANG
|| menu_its[idx].type == SETTING_DISPLAY_SCREEN_TIME) {
itc_tmp = itc2;
} else {
itc_tmp = itc;
}
Display_Item_Data *id = calloc(sizeof(Display_Item_Data), 1);
if (id) {
id->index = idx;
id->item = elm_genlist_item_append(
genlist, /* genlist object */
itc_tmp, /* item class */
id, /* data */
NULL,
ELM_GENLIST_ITEM_NONE,
menu_its[idx].func, /* call back */
ad);
if (menu_its[idx].type == SETTING_DISPLAY_LANG) {
lang_item = id->item;
} else if (menu_its[idx].type == SETTING_DISPLAY_GESTURE) {
DBG("wakeup item@!!!");
wake_up_item = id->item;
} else if (menu_its[idx].type == SETTING_DISPLAY_SCREEN_TIME) {
DBG("screen time item@!!!");
g_screen_time_item = id->item;
}
}
}
elm_genlist_item_class_free(itc);
elm_genlist_item_class_free(itc2);
Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new();
padding->item_style = "padding";
padding->func.del = _display_gl_del;
Elm_Object_Item *padding_item;
padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
elm_genlist_item_class_free(padding);
g_display_genlist = genlist;
return genlist;
}
static char *_gl_screen_timeout_title_get(void *data, Evas_Object *obj, const char *part)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Item_Data *id = data;
#if FEATURE_SETTING_EMUL
int emul_val = 1;
#else
/* int emul_val = 0; */
int emul_val = 1;
#endif
if (!strcmp(part, "elm.text")) {
if (emul_val == 1 && id->index == 0) {
snprintf(buf, sizeof(buf) - 1, "No off");
} else if (id->index == (0 + emul_val)) {
snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_ST_BODY_15SEC"));
} else if (id->index == (1 + emul_val)) {
snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_ST_BODY_30SEC"));
} else if (id->index == (2 + emul_val)) {
snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_ST_BODY_1_MINUTE_ABB2"));
} else if (id->index == (3 + emul_val)) {
snprintf(buf, sizeof(buf) - 1, "%s", _("IDS_ST_BODY_5_MINUTES"));
}
}
return strdup(buf);
}
static int _get_timeout_index(int seconds)
{
int index;
int length = 0;
length = sizeof(timeout_arr) / sizeof(timeout_arr[0]);
DBG("Setting - timeout_arr's length: %d", length);
for (index = 0; index < length; index++) {
if (timeout_arr[index] == seconds) {
DBG("Setting - timeout index : %d, sec : %d", index, timeout_arr[index]);
break;
}
}
return index;
}
static void _screen_timeout_gl_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
g_screen_time_index = (uintptr_t)data;
vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL , timeout_arr[g_screen_time_index]);
elm_genlist_realized_items_update(g_screen_time_genlist);
elm_naviframe_item_pop(g_app_context->nf);
back_button_cb_pop();
if (!g_app_context->screen_timeout_rdg) {
evas_object_del(g_app_context->screen_timeout_rdg);
g_app_context->screen_timeout_rdg = NULL;
}
}
static Evas_Object *_gl_screen_timeout_radio_get(void *data, Evas_Object *obj, const char *part)
{
Evas_Object *radio = NULL;
Evas_Object *radio_main = evas_object_data_get(obj, "radio_main");
Item_Data *id = data;
static int timeout = -1;
#if FEATURE_SETTING_EMUL
int emul_minus = 0;
#else
/* int emul_minus = 1; */
int emul_minus = 0;
#endif
if (!strcmp(part, "elm.icon")) {
radio = elm_radio_add(obj);
elm_radio_state_value_set(radio, id->index);
evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_radio_group_add(radio, radio_main);
evas_object_smart_callback_add(radio, "changed", _screen_timeout_gl_cb, (void *)(uintptr_t)id->index);
evas_object_propagate_events_set(radio, EINA_FALSE);
if (timeout == -1) {
vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &timeout);
g_screen_time_index = _get_timeout_index(timeout) - emul_minus;
}
if (g_screen_time_index == id->index) {
elm_radio_value_set(radio_main, g_screen_time_index);
}
elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_DESCRIBED_BY, radio);
elm_atspi_accessible_relationship_append(id->item, ELM_ATSPI_RELATION_CONTROLLER_FOR, radio);
elm_atspi_accessible_relationship_append(radio, ELM_ATSPI_RELATION_CONTROLLED_BY, id->item);
}
return radio;
}
static void _screen_timeout_gl_del(void *data, Evas_Object *obj)
{
Item_Data *id = data;
FREE(id);
}
void _show_screen_timeout_list(void *data)
{
appdata *ad = data;
if (ad == NULL) {
DBG("%s", "_show_screen_timeout_list - appdata is null");
return;
}
Evas_Object *genlist = NULL;
Elm_Object_Item *nf_it = NULL;
int idx;
g_app_context = ad;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
itc->item_style = "1text.1icon.1";
itc->func.text_get = _gl_screen_timeout_title_get;
itc->func.content_get = _gl_screen_timeout_radio_get;
itc->func.del = _screen_timeout_gl_del;
genlist = elm_genlist_add(ad->nf);
elm_genlist_block_count_set(genlist, 14);
elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
connect_to_wheel_with_genlist(genlist, ad);
int timeout = 0;
vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &timeout);
g_screen_time_index = _get_timeout_index(timeout);
Elm_Object_Item *curr_item = NULL;
#if FEATURE_SETTING_EMUL
int emul_end = 0;
#else
/* int emul_end = 1; */
int emul_end = 0;
#endif
Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new();
title_item->func.text_get = _gl_menu_title_text_get;
title_item->item_style = "title";
title_item->func.del = NULL;
elm_genlist_item_append(genlist, title_item, (void *)DISPLAY_TITLE_SCREEN_TIMEOUT, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(title_item);
for (idx = 0; idx < SCREEN_TIME_COUNT - emul_end; idx++) {
Item_Data *id = calloc(sizeof(Item_Data), 1);
if (id) {
id->index = idx;
id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _screen_timeout_gl_cb, (void *)(uintptr_t)idx);
if (idx == g_screen_time_index) {
curr_item = id->item;
}
}
}
ad->screen_timeout_rdg = elm_radio_add(genlist);
elm_radio_state_value_set(ad->screen_timeout_rdg, SCREEN_TIME_COUNT - emul_end);
elm_radio_value_set(ad->screen_timeout_rdg, g_screen_time_index);
evas_object_data_set(genlist, "radio_main", ad->screen_timeout_rdg);
if (curr_item) {
elm_genlist_item_show(curr_item, ELM_GENLIST_ITEM_SCROLLTO_TOP);
}
Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new();
padding->item_style = "padding";
padding->func.del = _screen_timeout_gl_del;
Elm_Object_Item *padding_item;
padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
elm_genlist_item_class_free(padding);
g_screen_time_genlist = genlist;
elm_genlist_item_class_free(itc);
nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
back_button_cb_push(&back_key_generic_cb, data, NULL, g_display_genlist, "g_display_genlist");
#if !defined(FEATURE_SETTING_TELEPHONY)
elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE);
#endif
elm_object_item_domain_text_translatable_set(nf_it, SETTING_PACKAGE, EINA_TRUE);
}
static char *_gl_roatate_screen_title_get(void *data, Evas_Object *obj, const char *part)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Item_Data *id = data;
if (!strcmp(part, "elm.text")) {
snprintf(buf, sizeof(buf) - 1, "%s", _(rotate_screen_str[id->index]));
}
return strdup(buf);
}
static Evas_Object *_gl_rotate_screen_radio_get(void *data, Evas_Object *obj, const char *part)
{
Evas_Object *radio = NULL;
Evas_Object *radio_main = evas_object_data_get(obj, "radio_main");
Item_Data *id = data;
static int rotate = -1;
if (!strcmp(part, "elm.icon")) {
radio = elm_radio_add(obj);
elm_radio_state_value_set(radio, id->index);
evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_radio_group_add(radio, radio_main);
/*get_int rotate */
rotate = _get_rotate_screen();
rotate_screen_rot = rotate;
if (rotate == SETTING_SCREENROTATION_90_DEGREE) {
/*90R */
rotate_screen_index = 1;
} else if (rotate == SETTING_SCREENROTATION_270_DEGREE) {
/*90L */
rotate_screen_index = 2;
} else if (rotate == SETTING_SCREENROTATION_180_DEGREE) {
/*180 */
rotate_screen_index = 3;
}
if (rotate == -1) {
rotate_screen_rot = SETTING_SCREENROTATION_0_DEGREE;
}
}
return radio;
}
static void _rotate_screen_gl_del(void *data, Evas_Object *obj)
{
Item_Data *id = data;
FREE(id);
}
static void _rotate_screen_gl_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
rotate_screen_index = (uintptr_t)data;
if (rotate_screen_index == 1) {
/*90R */
rotate_screen_rot = SETTING_SCREENROTATION_90_DEGREE;
} else if (rotate_screen_index == 2) {
/*90L */
rotate_screen_rot = SETTING_SCREENROTATION_270_DEGREE;
} else if (rotate_screen_index == 3) {
/*180 */
rotate_screen_rot = SETTING_SCREENROTATION_180_DEGREE;
} else {
rotate_screen_rot = SETTING_SCREENROTATION_0_DEGREE;
}
/*set int */
_set_rotate_screen(rotate_screen_rot);
elm_genlist_realized_items_update(g_rotate_screen_genlist);
elm_naviframe_item_pop(g_app_context->nf);
if (!g_app_context->rotate_screen_rdg) {
evas_object_del(g_app_context->rotate_screen_rdg);
g_app_context->rotate_screen_rdg = NULL;
}
}
void _show_rotate_screen_list(void *data)
{
appdata *ad = data;
if (ad == NULL) {
DBG("%s", "_show_screen_timeout_list - appdata is null");
return;
}
Evas_Object *genlist = NULL;
Elm_Object_Item *nf_it = NULL;
int idx;
g_app_context = ad;
Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
itc->item_style = "1text.1icon.1";
itc->func.text_get = _gl_roatate_screen_title_get;
itc->func.content_get = _gl_rotate_screen_radio_get;
itc->func.del = _rotate_screen_gl_del;
genlist = elm_genlist_add(ad->nf);
elm_genlist_block_count_set(genlist, 14);
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
connect_to_wheel_with_genlist(genlist, ad);
Elm_Genlist_Item_Class *title_item = elm_genlist_item_class_new();
title_item->func.text_get = _gl_menu_title_text_get;
title_item->item_style = "title";
title_item->func.del = NULL;
elm_genlist_item_append(genlist, title_item, (void *)DISPLAY_TITLE_ROTATE, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_class_free(title_item);
for (idx = 0; idx < ROTATE_SCREEN_COUNT; idx++) {
Item_Data *id = calloc(sizeof(Item_Data), 1);
if (id) {
id->index = idx;
id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, _rotate_screen_gl_cb, (void *)(uintptr_t)idx);
}
}
ad->rotate_screen_rdg = elm_radio_add(genlist);
elm_radio_state_value_set(ad->rotate_screen_rdg, -1);
elm_radio_value_set(ad->rotate_screen_rdg, rotate_screen_index);
evas_object_data_set(genlist, "radio_main", ad->rotate_screen_rdg);
Elm_Genlist_Item_Class *padding = elm_genlist_item_class_new();
padding->item_style = "padding";
padding->func.del = _rotate_screen_gl_del;
Elm_Object_Item *padding_item;
padding_item = elm_genlist_item_append(genlist, padding, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_atspi_accessible_role_set(padding_item, ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
elm_genlist_item_class_free(padding);
g_screen_time_genlist = genlist;
elm_genlist_item_class_free(itc);
nf_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, genlist, "empty");
elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE);
}
static void _set_rotate_screen(const int rotation)
{
vconf_set_int(VCONFKEY_SETAPPL_SCREENROTATION_DEG_INT, rotation);
}
static int _get_rotate_screen()
{
int rot;
vconf_get_int(VCONFKEY_SETAPPL_SCREENROTATION_DEG_INT, &rot);
return rot;
}
static void change_language_enabling(keynode_t *key, void *data)
{
if (lang_item == NULL) {
DBG("Setting - lang_item is null!!");
return;
}
int enable = 0;
vconf_get_bool(VCONFKEY_WMS_WMANAGER_CONNECTED, &enable);
if (enable) {
DBG("Setting - Language is disabled");
} else {
DBG("Setting - Language is enabled");
}
if (lang_item) {
elm_genlist_item_update(lang_item);
}
}
static void change_screen_time_cb(keynode_t *key, void *data)
{
DBG("Setting - change_screen_time_cb");
if (g_screen_time_item) {
elm_genlist_item_update(g_screen_time_item);
}
}
static void change_language_cb(keynode_t *key, void *data)
{
DBG("Setting - change_language_cb");
if (lang_item) {
elm_genlist_item_update(lang_item);
}
}
int brightness_index = 0;
int brightness_origin_level = 0;
Evas_Object *brightness_layout = NULL;
static void _brightness_pop_cb(void *data, Evas_Object *obj, void *event_info);
static void brightness_vconf_changed_cb(keynode_t *key, void *data);
static void sync_brightness(int real_brightness);
static int _change_bright_lovel_to_index(int level);
#if 0 /*!(FEATURE_SETTING_EMUL) */
static void _set_HBM_mode(int enable);
#endif
static int _change_bright_index_to_level(int index);
int hbm_mode_on_original = 0; /* backup for cancel */
/*#if FEATURE_SETTING_EMUL */
int display_get_hbm()
{
/* DUMMY FUNCTION FOR EMULATOR */
return 0;
}
int display_enable_hbm(int enable, int timeout)
{
/* after timeout(sec) minutes, HBM mode will be off! */
return 0;
}
/*#endif */
static void _display_brightness_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
Evas_Object *layout = NULL;
Elm_Object_Item *navi_it = NULL;
appdata *ad = data;
if (ad != NULL) {
layout = _show_brightness_popup(ad, obj, event_info);
}
if (layout) {
navi_it = elm_naviframe_item_push(ad->nf, NULL, NULL, NULL, layout, NULL);
elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
elm_object_item_domain_text_translatable_set(navi_it, SETTING_PACKAGE, EINA_TRUE);
back_button_cb_push(&_brightness_pop_cb, data, NULL, g_display_genlist, "g_display_genlist");
register_vconf_changing(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, brightness_vconf_changed_cb, NULL);
}
}
static void _change_btn_img(void *data, Evas_Object *btn_obj, char *path, char *btn_str)
{
char img_path[PATH_MAX];
Evas_Object *page_layout = (Evas_Object *)data;
snprintf(img_path, sizeof(img_path), "%s/%s", IMG_DIR, path);
elm_image_file_set(btn_obj, img_path, NULL);
elm_object_part_content_set(page_layout, btn_str, btn_obj);
}
static void change_center_img(void *data, int brightness_value)
{
char img_path[PATH_MAX];
snprintf(img_path, sizeof(img_path), "Brightness/b_setting_brightness_%02d.png", brightness_value);
_change_btn_img(data, g_center_img, img_path, "elm.icon");
evas_object_color_set(g_center_img, 0, 0, 0, 255);
}
static void _brightness_value_plus(void *data)
{
if (brightness_index < 10) {
brightness_index++;
_change_btn_img(data, g_btn_minus, "b_slider_icon_minus.png", "btn1");
}
if (brightness_index == 10) {
ERR("disable plus btn2 ");
_change_btn_img(data, g_btn_plus, "b_slider_icon_plus_disable.png", "btn2");
}
change_center_img(data, brightness_index);
}
static void _brightness_value_minus(void *data)
{
if (brightness_index > 1) {
brightness_index--;
_change_btn_img(data, g_btn_plus, "b_slider_icon_plus.png", "btn2");
}
if (brightness_index == 1) {
ERR("disable minus btn1");
_change_btn_img(data, g_btn_minus, "b_slider_icon_minus_disable.png", "btn1");
}
change_center_img(data, brightness_index);
}
static void change_brightness(int brt_index)
{
int ret, level;
level = _change_bright_index_to_level(brightness_index);
ret = device_display_set_brightness(0, level);
if (ret == DEVICE_ERROR_NONE)
vconf_set_int("db/setting/Brightness", level);
else
ERR("Failed to set brightness (ret:%d)\n", ret);
}
static Eina_Bool
_value_changed_rotary(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Evas_Object *page_layout = (Evas_Object *)data;
if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) {
_brightness_value_plus(data);
} else {
_brightness_value_minus(data);
}
snprintf(buf, sizeof(buf), "%02d", brightness_index);
ERR("Slider value = %s\n", buf);
elm_object_part_text_set(page_layout, "elm.text.slider", buf);
is_changed = 1; /* changed flag!! */
DBG("Setting - brightness_index : %d", brightness_index);
/*
#if !(FEATURE_SETTING_EMUL)
if (brightness_index > 0 && brightness_index < 6) {
int enable = display_get_hbm();
if (enable < 0) {
DBG("Setting - dispaly_get_hbm() is fail!!");
} else if (enable == TRUE) {
DBG("Setting - current HBM mode!!");
//elm_object_part_text_set(brightness_layout, "elm.text.2", "");
_set_HBM_mode(FALSE);
}
*/
/*set off sequnce : hbm off -> bright level down */
/*
change_brightness(brightness_index);
} else if (brightness_index == 6) {
DBG("Setting - HBM mode on!!");
_set_HBM_mode(TRUE);
// elm_object_translatable_part_text_set(brightness_layout, "elm.text.2", "IDS_ST_BODY_OUTDOOR_MODE_ABB");
}
#else
*/
change_brightness(brightness_index);
/*#endif*/
return EINA_TRUE;
}
static void _press_plus_brightness_cb(void *data, Evas_Object *obj, void *event_info)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Evas_Object *page_layout = (Evas_Object *)data;
_brightness_value_plus(data);
snprintf(buf, sizeof(buf), "%02d", brightness_index);
ERR("Pressed Plus btn!! Slider value = %s\n", buf);
elm_object_part_text_set(page_layout, "elm.text.slider", buf);
eext_circle_object_value_set(g_slider, (float)brightness_index);
is_changed = 1; /* changed flag!! */
DBG("Setting - brightness_index : %d", brightness_index);
change_brightness(brightness_index);
}
static void _press_minus_brightness_cb(void *data, Evas_Object *obj, void *event_info)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
Evas_Object *page_layout = (Evas_Object *)data;
_brightness_value_minus(data);
snprintf(buf, sizeof(buf), "%02d", brightness_index);
ERR("Pressed Plus btn!! Slider value = %s\n", buf);
elm_object_part_text_set(page_layout, "elm.text.slider", buf);
eext_circle_object_value_set(g_slider, (float)brightness_index);
is_changed = 1; /* changed flag!! */
DBG("Setting - brightness_index : %d", brightness_index);
change_brightness(brightness_index);
}
static char *
_accessible_name_cb(void *data, Evas_Object *obj)
{
Evas_Object *layout = data;
return strdup(elm_object_part_text_get(layout, "elm.text.slider"));
}
static char *
_accessible_name_cb_img(void *data, Evas_Object *obj)
{
char buf[__SETTING_BUF_SIZE__] = {0,};
int text_num = *(int *)data;
switch (text_num) {
case 1:
snprintf(buf, sizeof(buf)-1, "Decrease %s Button", _("IDS_ST_BUTTON_BRIGHTNESS"));
break;
case 2:
snprintf(buf, sizeof(buf)-1, "Increase %s Button", _("IDS_ST_BUTTON_BRIGHTNESS"));
break;
case 3:
snprintf(buf, sizeof(buf)-1, " %s", _("IDS_ST_BUTTON_BRIGHTNESS"));
break;
default:
snprintf(buf, sizeof(buf)-1, " %s", _("IDS_ST_BUTTON_BRIGHTNESS"));
break;
}
return strdup(buf);
}
static char *
_accessible_slider_name_cb(void *data, Evas_Object *obj)
{
return strdup(_("IDS_ST_BUTTON_BRIGHTNESS"));
}
static char *
_accessible_slider_description_cb(void *data, Evas_Object *obj)
{
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%d", (int)eext_circle_object_value_get(obj));
return strdup(buf);
}
static void
_img_accessible_register(Evas_Object *layout, Evas_Object *img, int *val)
{
Evas_Object *ao_btn;
ao_btn = elm_access_object_register(img, layout);
elm_atspi_accessible_name_cb_set(ao_btn, _accessible_name_cb_img, val);
elm_atspi_accessible_reading_info_type_set(ao_btn, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
}
Evas_Object *_show_brightness_popup(void *data, Evas_Object *obj, void *event_info)
{
char img_path[PATH_MAX];
appdata *ad = data;
int brightness_level = 0;
int real_brightness = 0;
if (ad == NULL)
return NULL;
device_display_get_brightness(0, &real_brightness);
DBG("Setting - Real brightness : %d", real_brightness);
/* Vconf brightness level */
vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness_level);
if (real_brightness != brightness_level) { /* HBM mode -> normal level(4) */
sync_brightness(real_brightness);
brightness_level = real_brightness;
}
int enable = display_get_hbm();
if (enable < 0) {
DBG("Setting - dispaly_get_hbm() is fail!!");
}
if (enable == TRUE) {
DBG("Setting - current HBM mode!!");
brightness_index = 6;
} else {
brightness_index = _change_bright_lovel_to_index(brightness_level);
}
DBG("Setting - level: %d, index: %d", brightness_level, brightness_index);
brightness_origin_level = brightness_level;
Evas_Object *slider = NULL;
Evas_Object *img_bg = NULL;
Evas_Object *page_layout = elm_layout_add(ad->nf);
evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(page_layout, 0, EVAS_HINT_FILL);
elm_layout_file_set(page_layout, EDJE_PATH, "slider_brightness_layout");
evas_object_show(page_layout);
brightness_layout = page_layout;
/* Add new eext_circle_object_slider with Eext_Circle_Surface object to render.
Value is set as 3 which is within range from 0 to 15. */
g_slider = slider = eext_circle_object_slider_add(page_layout, ad->circle_surface);
eext_circle_object_value_min_max_set(slider, 1.0, 10.0);
eext_circle_object_value_set(slider, (float)brightness_index);
/* Activate Circle slider's rotary object event.
Its value increases/decreases its value by 0.5 to clockwise/counter clockwise
rotary event. */
eext_circle_object_slider_step_set(slider, 1.0);
char buf[__SETTING_BUF_SIZE__] = {0,};
snprintf(buf, sizeof(buf), "%02d", brightness_index);
elm_object_part_text_set(page_layout, "elm.text.slider", buf);
Evas_Object *ao, *to;
to = (Evas_Object *)edje_object_part_object_get((const Edje_Object *)elm_layout_edje_get(page_layout), "elm.text.slider");
ao = elm_access_object_register(to, page_layout);
elm_atspi_accessible_name_cb_set(ao, _accessible_name_cb, page_layout);
elm_atspi_accessible_reading_info_type_set(ao, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
elm_atspi_accessible_name_cb_set(slider, _accessible_slider_name_cb, NULL);
elm_atspi_accessible_description_cb_set(slider, _accessible_slider_description_cb, NULL);
Evas_Object *btn_minus;
btn_minus = elm_image_add(page_layout);
if (brightness_index > 1)
snprintf(img_path, sizeof(img_path), "%s/b_slider_icon_minus.png", IMG_DIR);
else
snprintf(img_path, sizeof(img_path), "%s/b_slider_icon_minus_disable.png", IMG_DIR);
elm_image_file_set(btn_minus, img_path, NULL);
elm_object_part_content_set(page_layout, "btn1", btn_minus);
evas_object_smart_callback_add(btn_minus, "clicked", _press_minus_brightness_cb, page_layout);
evas_object_show(btn_minus);
static int minus_name = 1;
_img_accessible_register(page_layout, btn_minus, &minus_name);
Evas_Object *btn_plus;
btn_plus = elm_image_add(page_layout);
if (brightness_index < 10)
snprintf(img_path, sizeof(img_path), "%s/b_slider_icon_plus.png", IMG_DIR);
else
snprintf(img_path, sizeof(img_path), "%s/b_slider_icon_plus_disable.png", IMG_DIR);
elm_image_file_set(btn_plus, img_path, NULL);
elm_object_part_content_set(page_layout, "btn2", btn_plus);
evas_object_smart_callback_add(btn_plus, "clicked", _press_plus_brightness_cb, page_layout);
evas_object_show(btn_plus);
static int plus_name = 2;
_img_accessible_register(page_layout, btn_plus, &plus_name);
g_btn_plus = btn_plus;
g_btn_minus = btn_minus;
Eina_Bool res = eext_rotary_object_event_callback_add(slider, _value_changed_rotary, page_layout);
ERR("rotary_event_handler result = %d", res);
img_bg = elm_image_add(page_layout);
snprintf(img_path, sizeof(img_path), "%s/b_slider_btn_bg.png", IMG_DIR);
elm_image_file_set(img_bg, img_path, NULL);
elm_object_part_content_set(page_layout, "elm.icon_circle", img_bg);
evas_object_show(img_bg);
Evas_Object *img = NULL;
img = elm_image_add(page_layout);
snprintf(img_path, sizeof(img_path), "%s/Brightness/b_setting_brightness_%02d.png", IMG_DIR, brightness_index);
elm_image_file_set(img, img_path, NULL);
evas_object_color_set(img, 0, 0, 0, 255);
elm_object_part_content_set(page_layout, "elm.icon", img);
elm_object_part_text_set(page_layout, "elm.text.bottom", _("IDS_ST_BUTTON_BRIGHTNESS"));
g_center_img = img;
evas_object_show(img);
static int brightness_name = 3;
_img_accessible_register(page_layout, img, &brightness_name);
Evas_Object *to_bottom_text = (Evas_Object *)edje_object_part_object_get((const Edje_Object *)elm_layout_edje_get(page_layout), "elm.text.bottom");
Evas_Object *ao_bottom_text = elm_access_object_register(to_bottom_text, page_layout);
elm_atspi_accessible_reading_info_type_set(ao_bottom_text, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
elm_atspi_accessible_name_cb_set(ao_bottom_text, _accessible_name_cb_img, &brightness_name);
/* Make unselect state all of the pages except first one */
elm_object_signal_emit(page_layout, "elm,state,thumbnail,unselect", "elm");
eext_rotary_object_event_activated_set(slider, EINA_TRUE);
return page_layout;
}
static void _brightness_pop_cb(void *data, Evas_Object *obj, void *event_info)
{
DBG("Setting - brightness_pop_cb() is called!");
appdata *ad = (appdata *)data;
if (ad) {
elm_naviframe_item_pop(ad->nf);
back_button_cb_pop();
} else {
ERR("data ptr is NULL");
}
unregister_vconf_changing(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, brightness_vconf_changed_cb);
return;
}
static void brightness_vconf_changed_cb(keynode_t *key, void *data)
{
DBG("Setting - brightness vconf changed!!");
}
static void sync_brightness(int real_brightness)
{
DBG("Setting - Synchronized brightness level");
vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, real_brightness);
}
static int _change_bright_lovel_to_index(int level)
{
int index = 0;
if (level >= 0 && level <= 100) {
index = (level / 10);
DBG("Setting - level -> index : %d", index);
}
return index;
}
static int _change_bright_index_to_level(int index)
{
int level = 1;
if (index > 0 && index < 11) {
switch (index) {
case 1:
level = 10;
break;
case 2:
level = 20;
break;
case 3:
level = 30;
break;
case 4:
level = 40;
break;
case 5:
level = 50;
break;
case 6:
level = 60;
break;
case 7:
level = 70;
break;
case 8:
level = 80;
break;
case 9:
level = 90;
break;
case 10:
level = 100;
break;
}
}
DBG("Setting - index -> level : %d", level);
return level;
}
#if 0 /*!(FEATURE_SETTING_EMUL) */
static void _set_HBM_mode(int enable)
{
if (display_enable_hbm(enable, 300) == 0) { /* after 5 minutes, HBM mode will be off! */
DBG("Setting - HBM %s!!", (enable) ? "enabled" : "disabled");
} else {
DBG("Setting - HBM api failed!!");
}
}
#endif
|