From: aman.jeph Date: Fri, 29 Jan 2021 13:26:54 +0000 (+0530) Subject: Add funtionality to add and remove quick setting buttons X-Git-Tag: submit/tizen/20210223.130217~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f937b8253a390e39a842b112646da1b2bc7c1b0;p=profile%2Fiot%2Fapps%2Fnative%2Fquickpanel.git Add funtionality to add and remove quick setting buttons Change-Id: I112da76839682cb6c0a5f459ccc89f2fbcc6d03d Signed-off-by: aman.jeph --- diff --git a/project_def.prop b/project_def.prop index 8fc7c47..d4ef294 100755 --- a/project_def.prop +++ b/project_def.prop @@ -18,7 +18,17 @@ USER_EDCS = USER_POS = res/po/ca.po res/po/fr.po res/po/nl.po res/po/sk.po res/po/ar.po res/po/hu.po res/po/da.po res/po/en.po res/po/ja_JP.po res/po/lt.po res/po/nb.po res/po/sv.po res/po/zh_TW.po res/po/fr_CA.po res/po/de.po res/po/fi.po res/po/zh_HK.po res/po/bg.po res/po/sr.po res/po/ga.po res/po/lv.po res/po/sl.po res/po/en_PH.po res/po/zh_CN.po res/po/uk.po res/po/ro.po res/po/eu.po res/po/it_IT.po res/po/kk.po res/po/ru_RU.po res/po/el_GR.po res/po/et.po res/po/is.po res/po/ka.po res/po/pt_BR.po res/po/cs.po res/po/pl.po res/po/gl.po res/po/hy.po res/po/en_US.po res/po/es_ES.po res/po/tr_TR.po res/po/pt_PT.po res/po/az.po res/po/ko_KR.po res/po/es_US.po res/po/mk.po res/po/uz.po res/po/hr.po # User Defines -USER_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING +############################################################################# +# Remove the user define to remove the quick buttons from quickpanel +############################################################################# +USER_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING \ + ENABLE_QUICK_BUTTON_WIFI \ + ENABLE_QUICK_BUTTON_BLUETOOTH \ + ENABLE_QUICK_BUTTON_SOUND \ + ENABLE_QUICK_BUTTON_DND \ + ENABLE_QUICK_BUTTON_VC \ + ENABLE_QUICK_BUTTON_SOFTKEY + USER_CPP_DEFS = # User Undefines diff --git a/res/edje/quickpanel.edc b/res/edje/quickpanel.edc index fa640e0..a34907d 100755 --- a/res/edje/quickpanel.edc +++ b/res/edje/quickpanel.edc @@ -18,7 +18,7 @@ #include "../../inc/quickpanel_def.h" #include "color_classes.edc" -#define QP_SETTING_H 224 +#define QP_SETTING_H 240 #define QP_SETTING_SEPERATOR_H 0 #define QP_VOICE_CONTROL_H 80 #define QP_ENABLE_VOICE_CONTROL_H ((QP_SETTING_H + QP_VOICE_CONTROL_H) / QP_SETTING_H) @@ -124,28 +124,6 @@ collections { } } } - part{ - name: "background_2"; - type: IMAGE; - scale: 1; - description { - state: "default" 0.0; - fixed: 1 1; - align: 0.5 0.5; - min: 1200 250; - max: 1200 250; - rel1 { - relative: 40/1280 30/720; - to: "base"; - } - rel2 { - relative: 1240/1280 280/720; - } - image { - normal: "core_theme_bg_small.png"; - } - } - } part{ name: "qp.base.rect.datetime"; type:SPACER; @@ -416,8 +394,8 @@ collections { type: SPACER; scale: 1; description { state: "default" 0.0; - min: 0 56; - max: -1 56; + min: 0 32; + max: -1 32; fixed: 0 1; rel1 { to_y: "qp.base.setting.swallow"; diff --git a/res/edje/quickpanel_setting.edc b/res/edje/quickpanel_setting.edc index 0ea9db7..77fea65 100755 --- a/res/edje/quickpanel_setting.edc +++ b/res/edje/quickpanel_setting.edc @@ -31,11 +31,12 @@ images { image: "quick_button_icon_bg.png" COMP; image: "quick_pressed_button_icon_bg.png" COMP; image: "quick_dimmed_button_icon_bg.png" COMP; + image: "core_theme_bg_small.png" COMP; } #define ENABLE_COLOR_CLIP -#define QP_SETTINGS_HEIGHT 224 +#define QP_SETTINGS_HEIGHT 240 #define QP_SETTING_SLIDER_SWALLOW_HEIGHT 32 #define QP_SETTING_SLIDER_SWALLOW_WIDTH 468 @@ -65,7 +66,7 @@ group { type: SPACER; scale: 1; description { state: "default" 0.0; - min: 100 0; + min: 40 0; fixed: 1 0; rel1 { relative: 0.0 0.0; @@ -82,7 +83,7 @@ group { type: SPACER; scale: 1; description { state: "default" 0.0; - min: 100 0; + min: 40 0; fixed: 1 0; rel1 { relative: 1.0 0.0; @@ -95,11 +96,23 @@ group { align: 1.0 0.0; } } + part { name: "setting.bg"; + type: IMAGE; + scale: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { to: "setting.margin.left"; relative: 1.0 0.0; } + rel2 { to: "setting.margin.right"; relative: 0.0 1.0; } + image { + normal: "core_theme_bg_small.png"; + } + } + } part { name: "setting.margin.top"; type: SPACER; scale: 1; description { state: "default" 0.0; - min: 0 32; + min: 0 24; fixed: 0 1; rel1 { to_x: "setting.margin.left"; to_y: "background"; relative: 1.0 0.0; } rel2 { to_x: "setting.margin.right"; to_y: "background"; relative: 0.0 0.0; } @@ -140,8 +153,8 @@ group { type: SPACER; scale: 1.0; description { state: "default" 0.0; - min: 16 32; - max: 16 32; + min: 76 32; + max: 76 32; fixed: 1.0 1.0; rel1 { to_x: "setting.margin.left"; to_y: "quickseting.volume_brightness.gap"; relative: 1.0 1.0; } align: 0.0 0.0; diff --git a/src/page/page_base.c b/src/page/page_base.c index 31905f5..094acee 100755 --- a/src/page/page_base.c +++ b/src/page/page_base.c @@ -281,6 +281,7 @@ HAPI Evas_Object *quickpanel_page_base_create(Evas_Object *parent, void *data) evas_object_show(scroller); Evas_Object *bg_touch = elm_image_add(view); + elm_image_aspect_fixed_set(bg_touch, EINA_FALSE); if (bg_touch != NULL) { const char *bg_path = util_get_res_file_path(NOTIFICATION_LIST_BG_IMAGE); elm_image_file_set(bg_touch, bg_path, NULL); diff --git a/src/settings/modules/bluetooth.c b/src/settings/modules/bluetooth.c index 0ffb7c8..2b9796c 100755 --- a/src/settings/modules/bluetooth.c +++ b/src/settings/modules/bluetooth.c @@ -264,6 +264,18 @@ static void _refresh(void *data) quickpanel_setting_module_icon_view_update_text(module); } +static int _support_get() +{ + // if don't want to support than return 0 +#ifdef ENABLE_QUICK_BUTTON_BLUETOOTH + return 1; +#else + return 0; +#endif + +} + + QP_Module_Setting bluetooth = { .name = "bluetooth", .setting_pkgname = "ug-bluetooth-efl", @@ -272,6 +284,7 @@ QP_Module_Setting bluetooth = { .lang_changed = _lang_changed, .refresh = _refresh, .icon_get = _icon_get, + .supported_get = _support_get, .label_get = _label_get, .view_update = _view_update, .status_update = _status_update, diff --git a/src/settings/modules/dnd.c b/src/settings/modules/dnd.c index 39e8119..e42ca77 100755 --- a/src/settings/modules/dnd.c +++ b/src/settings/modules/dnd.c @@ -386,6 +386,17 @@ static int _handler_ipc(const char *command, void *data) return EINA_TRUE; } +static int _support_get() +{ + // if don't want to support than return 0 +#ifdef ENABLE_QUICK_BUTTON_DND + return 1; +#else + return 0; +#endif + +} + QP_Module_Setting dnd = { .name = "dnd", .setting_pkgname = "org.tizen.setting-notification", @@ -395,6 +406,7 @@ QP_Module_Setting dnd = { .refresh = _refresh, .icon_get = _icon_get, .label_get = _label_get, + .supported_get = _support_get, .view_update = _view_update, .status_update = _status_update, .state_change = _state_change, diff --git a/src/settings/modules/softkey.c b/src/settings/modules/softkey.c index 980d66e..93958ee 100755 --- a/src/settings/modules/softkey.c +++ b/src/settings/modules/softkey.c @@ -302,6 +302,17 @@ static int _handler_ipc(const char *command, void *data) return EINA_TRUE; } +static int _support_get() +{ + +#ifdef ENABLE_QUICK_BUTTON_SOFTKEY + return 1; +#else + return 0; +#endif + +} + QP_Module_Setting softkey = { .name = "softkey", .setting_pkgname = "org.tizen.setting-softkey", @@ -310,6 +321,7 @@ QP_Module_Setting softkey = { .lang_changed = _lang_changed, .refresh = _refresh, .icon_get = _icon_get, + .supported_get = _support_get, .label_get = _label_get, .view_update = _view_update, .status_update = _status_update, diff --git a/src/settings/modules/sound-profile.c b/src/settings/modules/sound-profile.c index 0476add..85202b8 100755 --- a/src/settings/modules/sound-profile.c +++ b/src/settings/modules/sound-profile.c @@ -280,19 +280,32 @@ static void _refresh(void *data) _status_update(module, FLAG_VALUE_VOID, FLAG_VALUE_VOID); } +static int _support_get() +{ + // if don't want to support than return 0 +#ifdef ENABLE_QUICK_BUTTON_SOUND + return 1; +#else + return 0; +#endif + +} + + QP_Module_Setting sound = { - .name = "sound", - .setting_pkgname = "org.tizen.setting-profile", + .name = "sound", + .setting_pkgname = "org.tizen.setting-profile", .init = _init, .fini = _fini, .lang_changed = _lang_changed, .refresh = _refresh, .icon_get = _icon_get, - .label_get = _label_get, + .supported_get = _support_get, + .label_get = _label_get, .view_update = _view_update, - .status_update = _status_update, + .status_update = _status_update, .handler_longpress = _long_press_cb, - .handler_press = _mouse_clicked_cb, - .is_disable_feedback = 1, + .handler_press = _mouse_clicked_cb, + .is_disable_feedback = 1, }; diff --git a/src/settings/modules/voice-control.c b/src/settings/modules/voice-control.c index 08df64e..ab34d1a 100755 --- a/src/settings/modules/voice-control.c +++ b/src/settings/modules/voice-control.c @@ -243,6 +243,18 @@ static void _refresh(void *data) quickpanel_setting_module_icon_view_update_text(module); } +static int _support_get() +{ + // if don't want to support than return 0 +#ifdef ENABLE_QUICK_BUTTON_VC + return 1; +#else + return 0; +#endif + +} + + QP_Module_Setting voicecontrol = { .name = "voicecontrol", .setting_pkgname = "org.tizen.voice-control-panel", @@ -251,6 +263,7 @@ QP_Module_Setting voicecontrol = { .lang_changed = _lang_changed, .refresh = _refresh, .icon_get = _icon_get, + .supported_get = _support_get, .label_get = _label_get, .view_update = _view_update, .status_update = _status_update, diff --git a/src/settings/modules/wifi.c b/src/settings/modules/wifi.c index 64b1f53..ab327e3 100755 --- a/src/settings/modules/wifi.c +++ b/src/settings/modules/wifi.c @@ -579,6 +579,17 @@ static int _handler_ipc(const char *command, void *data) return EINA_TRUE; } +static int _support_get() +{ + // if don't want to support than return 0 +#ifdef ENABLE_QUICK_BUTTON_WIFI + return 1; +#else + return 0; +#endif + +} + QP_Module_Setting wifi = { .name = "wifi", .setting_pkgname = "wifi-efl-ug", @@ -587,6 +598,7 @@ QP_Module_Setting wifi = { .lang_changed = _lang_changed, .refresh = _refresh, .icon_get = _icon_get, + .supported_get = _support_get, .label_get = _label_get, .view_update = _view_update, .status_update = _status_update, diff --git a/src/settings/settings_view_featured.c b/src/settings/settings_view_featured.c index 605100c..a63c321 100755 --- a/src/settings/settings_view_featured.c +++ b/src/settings/settings_view_featured.c @@ -39,7 +39,7 @@ #endif #define QUICK_SETTING_ICON_GAP 72 -#define QUICK_SETTING_GRID_WIDTH 1080 +#define QUICK_SETTING_GRID_WIDTH 1200 #define QUICK_SETTING_GRID_HEIGHT 140 #define GRID_WIDTH ELM_SCALE_SIZE(QUICK_SETTING_GRID_WIDTH) @@ -95,6 +95,21 @@ static void _view_layout_create(void *data) quickpanel_setting_layout_set(ad->ly, container); } +static int _get_padding_of_icon(int item_count) +{ + if(item_count < 6) + return 120; + else + return 72; +} + +static int _get_quick_setting_margin(int item_count, int padding) +{ + int items_area = QUICK_SETTING_ICON_WIDTH * item_count + padding * (item_count - 1); + + return ((QUICK_SETTING_GRID_WIDTH - items_area) / 2); +} + static void _view_icons_add(void *data) { int index = 0, total = 0; @@ -111,14 +126,18 @@ static void _view_icons_add(void *data) retif(list_featured_icon == NULL, , "Invalid parameter!"); total = eina_list_count(list_featured_icon); - int pos_x = 0, pos_y = 0; + DBG("Total nums of enabled featured for quick buttons: %d", total); + int padding = _get_padding_of_icon(total); + int margin = _get_quick_setting_margin(total, padding); + DBG("Quick Buttons Marging: %d \t Padding: %d", margin, padding); + int pos_x = margin, pos_y = 0; EINA_LIST_FOREACH_SAFE(list_featured_icon, l, l_next, module) { icon = quickpanel_setting_module_icon_create(module, grid); quickpanel_setting_module_icon_add(module, icon, QP_SETTING_ICON_CONTAINER_FEATURED); quickpanel_setting_icon_pack(grid, icon, pos_x, pos_y); quickpanel_setting_module_icon_status_update(module, FLAG_VALUE_VOID, FLAG_VALUE_VOID); index++; - pos_x += (QUICK_SETTING_ICON_WIDTH + QUICK_SETTING_ICON_GAP); + pos_x += (QUICK_SETTING_ICON_WIDTH + padding); } eina_list_free(list_featured_icon); @@ -281,7 +300,9 @@ HAPI void quickpanel_setting_view_featured_reload(Eina_List *list_all_module, in total = eina_list_count(list_all_module); DBG("total:%d", total); - int pos_x = 0, pos_y = 0; + int padding = _get_padding_of_icon(total); + int margin = _get_quick_setting_margin(total, padding); + int pos_x = margin, pos_y = 0; EINA_LIST_FOREACH_SAFE(list_all_module, l, l_next, module) { if (index < num_featured) { if ((icon = quickpanel_setting_module_icon_get(module, @@ -292,7 +313,7 @@ HAPI void quickpanel_setting_view_featured_reload(Eina_List *list_all_module, in quickpanel_setting_module_icon_add(module, icon, QP_SETTING_ICON_CONTAINER_FEATURED); quickpanel_setting_icon_pack(grid, icon, pos_x, pos_y); quickpanel_setting_module_icon_status_update(module, FLAG_VALUE_VOID, FLAG_VALUE_VOID); - pos_x += (QUICK_SETTING_ICON_WIDTH + QUICK_SETTING_ICON_GAP); + pos_x += (QUICK_SETTING_ICON_WIDTH + padding); } DBG("all list:%s", module->name); } else {