Add funtionality to add and remove quick setting buttons 02/252602/4
authoraman.jeph <aman.jeph@samsung.com>
Fri, 29 Jan 2021 13:26:54 +0000 (18:56 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Tue, 23 Feb 2021 07:06:35 +0000 (12:36 +0530)
Change-Id: I112da76839682cb6c0a5f459ccc89f2fbcc6d03d
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
project_def.prop
res/edje/quickpanel.edc
res/edje/quickpanel_setting.edc
src/page/page_base.c
src/settings/modules/bluetooth.c
src/settings/modules/dnd.c
src/settings/modules/softkey.c
src/settings/modules/sound-profile.c
src/settings/modules/voice-control.c
src/settings/modules/wifi.c
src/settings/settings_view_featured.c

index 8fc7c47e0e0ae634fef3843d3fe2538abcd46d52..d4ef2940a788536e3f553f1a1bfa5eff7c4df60b 100755 (executable)
@@ -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
index fa640e0f3fe90db4457ce98f33a618a1993b50f7..a34907d12f49e79e443df3aa4d8b8202942fae09 100755 (executable)
@@ -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";
index 0ea9db79acde0d824cf4ee2d0af652d6c48afc0a..77fea6541383bab797160de348940dd8e78e7635 100755 (executable)
@@ -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;
index 31905f583b93c0b7dff16bbd42576719cdb134ca..094aceeacf2466d051c369bc919a4e657b26ef9c 100755 (executable)
@@ -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);
index 0ffb7c8d4a7bf0870d927e895d5cab5dac191e72..2b9796cb3ddd8d36eee6e35d8b9b919f451812ba 100755 (executable)
@@ -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,
index 39e8119e921230614b06c4b9d8ecf2a8bb2a7781..e42ca77190f6c16e6ed404c27a2eae57f61e2fd7 100755 (executable)
@@ -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,
index 980d66e8aaf2d2d3cfecb5b632d0603fb55a0230..93958eec4a9562ceb7a5ef9f78b0185377dc2c6b 100755 (executable)
@@ -302,6 +302,17 @@ static int _handler_ipc(const char *command, void *data)
        return EINA_TRUE;\r
 }\r
 \r
+static int _support_get()\r
+{\r
+\r
+#ifdef ENABLE_QUICK_BUTTON_SOFTKEY\r
+       return 1;\r
+#else\r
+       return 0;\r
+#endif\r
+\r
+}\r
+\r
 QP_Module_Setting softkey = {\r
        .name                           = "softkey",\r
        .setting_pkgname        = "org.tizen.setting-softkey",\r
@@ -310,6 +321,7 @@ QP_Module_Setting softkey = {
        .lang_changed           = _lang_changed,\r
        .refresh                        = _refresh,\r
        .icon_get                       = _icon_get,\r
+       .supported_get          = _support_get,\r
        .label_get                      = _label_get,\r
        .view_update        = _view_update,\r
        .status_update          = _status_update,\r
index 0476addac84bd5f83062c194de9f9a6ca573a2c8..85202b84f485f4f94329431bc35c0f8f6368ad76 100755 (executable)
@@ -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,
 };
index 08df64eceace385e04d2a6cc22af3ab1b2588b5b..ab34d1adb65c65246b3f8a86c451e25a521c99c6 100755 (executable)
@@ -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,
index 64b1f53b0f11a93efb5b399233f2d34c435d3e5f..ab327e3c45ebf585a15c706c0c77b1372ce8562b 100755 (executable)
@@ -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,
index 605100cb30ed2ec23b4b56bf7cf65054c3f83aae..a63c321e752d7d6fa1114feab5d5b4a27dc65ddb 100755 (executable)
@@ -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 {