TIZENIOT[1651] [Noti panel] [GUI] Add settings button at the left-bottom corner ... 03/238403/5
authordivyanshugautam17 <divyanshu.gm@samsung.com>
Mon, 13 Jul 2020 13:13:56 +0000 (18:43 +0530)
committerdivyanshugautam17 <divyanshu.gm@samsung.com>
Thu, 16 Jul 2020 08:51:24 +0000 (14:21 +0530)
Change-Id: Ia3570522b6dd1cf7e95cf9eebcde9a8e5cb0e341

22 files changed:
CMakeLists.txt
inc/noti.h
project_def.prop
res/edje/quickpanel.edc
res/edje/quickpanel_images.edc
res/edje/quickpanel_noti_section.edc
res/images/core_theme_bg_small.png [new file with mode: 0755]
res/images_icon/icon_moresettings_disabled.png [deleted file]
res/images_icon/icon_moresettings_off.png [deleted file]
res/images_icon/icon_moresettings_on.png [deleted file]
res/images_icon/icon_settings.png [new file with mode: 0755]
res/images_icon/icon_voice_control_disabled.png [new file with mode: 0755]
res/images_icon/icon_voice_control_off.png [new file with mode: 0755]
res/images_icon/icon_voice_control_on.png [new file with mode: 0755]
res/po/en_US.po
src/notifications/noti.c
src/notifications/noti_section.c
src/preference.c
src/settings/modules/more-settings.c [deleted file]
src/settings/modules/softkey.c
src/settings/modules/voice-control.c [new file with mode: 0755]
src/settings/settings.c

index 7e1b33ec54fca59cc0b7e0502c5ccfe470eb192e..e1f5f30b39dba38f271b9d8193801b89c1fe9b85 100755 (executable)
@@ -44,7 +44,7 @@ SET(SRCS
        src/notifications/noti.c
        src/device/brightness.c
        src/device/volume.c
-       src/settings/modules/more-settings.c
+       src/settings/modules/voice-control.c
        src/settings/modules/bluetooth.c
        src/settings/modules/dnd.c
        src/settings/modules/softkey.c
index cc4f9184f963adb4e756a7e055494d31ab6d9ab6..b6071bca76cedee653cf32fa2da28bb82e40833f 100755 (executable)
@@ -34,6 +34,7 @@ extern void quickpanel_noti_set_clear_all_status();
 
 extern void quickpanel_noti_on_clear_all_clicked(void *data, Evas_Object *obj, void *info);
 extern void quickpanel_noti_on_noti_setting_clicked(void *data, Evas_Object *obj, void *info);
+extern void quickpanel_setting_clicked(void *data, Evas_Object *obj, void *info);
 extern int quickpanel_noti_get_type_count(notification_type_e noti_type);
 extern void quickpanel_noti_update_by_system_time_changed_setting_cb(system_settings_key_e  key, void *data);
 extern void quickpanel_noti_update_by_system_time_changed_vconf_cb(keynode_t *key, void *data);
index 7a2489d71da9eb1edfab0545675081d11cc502a3..8fc7c47e0e0ae634fef3843d3fe2538abcd46d52 100755 (executable)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-4.0
 
 # C/CPP Sources
-USER_SRCS = src/notifications/noti_win.c src/settings/modules/softkey.c src/settings/settings_icon_common.c src/device/brightness.c src/device/volume.c src/common.c src/notifications/noti_listbox.c src/settings/modules/sound-profile.c src/notifications/animated_image.c src/notifications/noti_util.c src/vi/vi_manager.c src/notifications/noti_section.c src/service/keyboard.c src/settings/settings_gridbox.c src/settings/modules/more-settings.c src/voice_control.c src/datetime/datetime.c src/sim_controller.c src/service/animated_icon.c src/settings/modules/dnd.c src/service/reminder.c src/preference.c src/accessibility.c src/notifications/noti_view_listype.c src/settings/setting_module_api.c src/notifications/noti_list_item.c src/notifications/noti_node.c src/common_uic.c src/datetime/util-time.c src/handler_controller.c src/settings/modules/wifi.c src/list_util.c src/notifications/noti_view.c src/settings/setting_utils.c src/quickpanel-ui.c src/service/noti_led.c src/settings/modules/bluetooth.c src/page/pager_common.c src/minictrl/minictrl.c src/service/uninstall.c src/service/emergency_mode.c src/page/page_base.c src/page/pager.c src/settings/settings.c src/modules.c src/media.c src/settings/settings_view_featured.c src/notifications/activenoti.c src/notifications/noti_view_ongoing.c src/notifications/noti.c 
+USER_SRCS = src/notifications/noti_win.c src/settings/modules/softkey.c src/settings/settings_icon_common.c src/device/brightness.c src/device/volume.c src/common.c src/notifications/noti_listbox.c src/settings/modules/sound-profile.c src/notifications/animated_image.c src/notifications/noti_util.c src/vi/vi_manager.c src/notifications/noti_section.c src/service/keyboard.c src/settings/settings_gridbox.c src/settings/modules/voice-control.c src/voice_control.c src/datetime/datetime.c src/sim_controller.c src/service/animated_icon.c src/settings/modules/dnd.c src/service/reminder.c src/preference.c src/accessibility.c src/notifications/noti_view_listype.c src/settings/setting_module_api.c src/notifications/noti_list_item.c src/notifications/noti_node.c src/common_uic.c src/datetime/util-time.c src/handler_controller.c src/settings/modules/wifi.c src/list_util.c src/notifications/noti_view.c src/settings/setting_utils.c src/quickpanel-ui.c src/service/noti_led.c src/settings/modules/bluetooth.c src/page/pager_common.c src/minictrl/minictrl.c src/service/uninstall.c src/service/emergency_mode.c src/page/page_base.c src/page/pager.c src/settings/settings.c src/modules.c src/media.c src/settings/settings_view_featured.c src/notifications/activenoti.c src/notifications/noti_view_ongoing.c src/notifications/noti.c 
 
 # EDC Sources
 USER_EDCS =
index dbf4e62e1f6de72304176a865271afe97c92f037..fa640e0f3fe90db4457ce98f33a618a1993b50f7 100755 (executable)
@@ -71,6 +71,7 @@
 images {
        image: "handler_btn_02.png" COMP;
        image: "core_theme_bg_01.png" COMP;
+       image: "core_theme_bg_small.png" COMP;
 }
 
 styles {
@@ -123,6 +124,28 @@ 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;
index a6e3dd2d1c3e198958c679e021b95c50610683b0..bb922578874a69ee03c8a138b819fba241fd9d50 100755 (executable)
@@ -56,9 +56,9 @@ RESOURCE_IMAGE("icon_do not disturb_off.png");
 RESOURCE_IMAGE("icon_do not disturb_on.png");
 RESOURCE_IMAGE("icon_do not disturb_disabled.png");
 
-RESOURCE_IMAGE("icon_moresettings_off.png");
-RESOURCE_IMAGE("icon_moresettings_on.png");
-RESOURCE_IMAGE("icon_moresettings_disabled.png");
+RESOURCE_IMAGE("icon_voice_control_off.png");
+RESOURCE_IMAGE("icon_voice_control_on.png");
+RESOURCE_IMAGE("icon_voice_control_disabled.png");
 
 RESOURCE_IMAGE("icon_softkey_off.png");
 RESOURCE_IMAGE("icon_softkey_on.png");
index 6c55434a29a1b9e8f0e4ebc17dd90fb224dd6b0e..82995a8baaf249e9fc1072ea15610e680213e307 100755 (executable)
                                description
                                {
                                        state: "default" 0.0;
-                                       min: 412 48;
-                                       max: 412 48;
+                                       min: 1200 48;
+                                       max: 1200 48;
                                        rel1 {
                                                relative: 0.0 0.0;
                                        }
                                        visible: 1;
                                }
                        }
+                       part {
+                               name: "rect.settings";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min: 50 48;
+                                       max: 50 48;
+                                       fixed: 1 1;
+                                       rel1 {
+                                               to: "base";
+                                               relative: 0.0 0.0;
+                                       }
+                                       rel2 {
+                                               relative: 1.0 1.0;
+                                               to_y: "base";
+                                       }
+                                       align: 0.0 0.5;
+                                       color: 0 0 0 0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name : "settings_button_swallow";
+                               type: SWALLOW;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       align: 0 0;
+                                       rel1 { relative: 0.0 0.0; to: "rect.settings";}
+                                       rel2 { relative: 1.0 1.0; to: "rect.settings"; }
+                               }
+                       }
+                       part {
+                               name: "spacer_settings";
+                               type: SPACER;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min: 738 5;
+                                       max: 738 5;
+                                       fixed: 1 1;
+                                       rel1 {
+                                               to: "rect.settings";
+                                               relative: 1.0 0.0;
+                                       }
+                                       rel2 {
+                                               to_x: "base";
+                                               relative: 1.0 1.0;
+                                       }
+                                       align: 0.0 0.0;
+                               }
+                       }
 
                        part {
                                name: "rect.button.notisetting";
                                        max: 212 48;
                                        fixed: 1 1;
                                        rel1 {
-                                               to: "base";
-                                               relative: 0.0 0.0;
+                                               to: "spacer_settings";
+                                               relative: 1.0 0.0;
                                        }
                                        rel2 {
                                                relative: 1.0 1.0;
diff --git a/res/images/core_theme_bg_small.png b/res/images/core_theme_bg_small.png
new file mode 100755 (executable)
index 0000000..342815b
Binary files /dev/null and b/res/images/core_theme_bg_small.png differ
diff --git a/res/images_icon/icon_moresettings_disabled.png b/res/images_icon/icon_moresettings_disabled.png
deleted file mode 100755 (executable)
index 7b1d105..0000000
Binary files a/res/images_icon/icon_moresettings_disabled.png and /dev/null differ
diff --git a/res/images_icon/icon_moresettings_off.png b/res/images_icon/icon_moresettings_off.png
deleted file mode 100755 (executable)
index df3d21c..0000000
Binary files a/res/images_icon/icon_moresettings_off.png and /dev/null differ
diff --git a/res/images_icon/icon_moresettings_on.png b/res/images_icon/icon_moresettings_on.png
deleted file mode 100755 (executable)
index a9f33ed..0000000
Binary files a/res/images_icon/icon_moresettings_on.png and /dev/null differ
diff --git a/res/images_icon/icon_settings.png b/res/images_icon/icon_settings.png
new file mode 100755 (executable)
index 0000000..a093ede
Binary files /dev/null and b/res/images_icon/icon_settings.png differ
diff --git a/res/images_icon/icon_voice_control_disabled.png b/res/images_icon/icon_voice_control_disabled.png
new file mode 100755 (executable)
index 0000000..e36faf1
Binary files /dev/null and b/res/images_icon/icon_voice_control_disabled.png differ
diff --git a/res/images_icon/icon_voice_control_off.png b/res/images_icon/icon_voice_control_off.png
new file mode 100755 (executable)
index 0000000..b8b28d8
Binary files /dev/null and b/res/images_icon/icon_voice_control_off.png differ
diff --git a/res/images_icon/icon_voice_control_on.png b/res/images_icon/icon_voice_control_on.png
new file mode 100755 (executable)
index 0000000..797ed2d
Binary files /dev/null and b/res/images_icon/icon_voice_control_on.png differ
index b4d66c4185e1fd3e11d564aa81cfb6ae45e31e9d..e55a26e964155a8e39ee14344a573855f84d2967 100755 (executable)
@@ -34,8 +34,8 @@ msgstr "Bluetooth"
 msgid "IDS_ST_BUTTON2_AUTO_NROTATE"
 msgstr "Auto\nrotate"
 
-msgid "IDS_ST_BUTTON2_MORE_SETTINGS"
-msgstr "More\nsettings"
+msgid "IDS_ST_BUTTON2_VOICE_CONTROL"
+msgstr "Voice control"
 
 msgid "IDS_ST_BUTTON2_SOFTKEY_CONTAINER"
 msgstr "Soft key\ncontainer"
index f6c33c5a6aa419d016ccc99c366262d9a7b1bc31..1c5a8c80c7180e4fc03b1d6d6be199446927865f 100755 (executable)
@@ -1172,6 +1172,17 @@ HAPI void quickpanel_noti_set_clear_all_status()
        }
 }
 
+HAPI void quickpanel_setting_clicked(void *data, Evas_Object *obj, void *info)
+{
+       DBG("Settings clicked");
+
+       quickpanel_media_play_feedback();
+
+       quickpanel_common_launch_app("org.tizen.setting", NULL);
+
+       quickpanel_uic_close_quickpanel(true, 1);
+}
+
 HAPI void quickpanel_noti_on_noti_setting_clicked(void *data, Evas_Object *obj, void *info)
 {
        DBG("Noti Setting clicked");
index 9aac0490544bdf0bb281e3dc0fa4a3a9929738d9..1475798a15409f5ca09563d473486acf089dc78c 100755 (executable)
@@ -24,6 +24,7 @@
 #include <tzsh_quickpanel_service.h>
 #include <system_settings.h>
 #include <notification_setting_internal.h>
+#include <app.h>
 
 #include "quickpanel-ui.h"
 #include "quickpanel_def.h"
 static struct  _noti_section{
   Evas_Object *layout;
   Evas_Object *clear_btn;
-  Evas_Object *noti_setting_btn
+  Evas_Object *noti_setting_btn;
+  Evas_Object *setting_btn
 } noti_section_data = {
   .layout = NULL,
   .clear_btn = NULL,
   .noti_setting_btn = NULL,
+  .setting_btn = NULL,
 };
 
 static void _noti_section_set_text(Evas_Object *noti_section, int count)
@@ -116,12 +119,32 @@ HAPI void quickpanel_noti_section_create(Evas_Object *parent)
                return ;
        }
 
+       Evas_Object *setting_button = elm_button_add(section);
+       retif(setting_button == NULL, NULL, "failed to create setting_button object");
+       Evas_Object *img = elm_image_add(setting_button);
+       char buffer[1024] = {0,};
+       const char *path  = app_get_resource_path();
+       if(path == NULL) {
+               ERR("Unable to get path for image");
+               return ;
+       }
+       DBG("Image path = %s",path);
+       snprintf(buffer, 1024, "%s%s%s", path, "images_icon/", "icon_settings.png");
+       elm_image_file_set(img, buffer, NULL);
+       evas_object_size_hint_min_set(img, ELM_SCALE_SIZE(48), ELM_SCALE_SIZE(48));
+       evas_object_size_hint_max_set(img, ELM_SCALE_SIZE(48), ELM_SCALE_SIZE(48));
+       elm_object_part_content_set(setting_button, "icon", img);
+       elm_object_style_set(setting_button, "focus");
+       elm_object_part_content_set(section, "settings_button_swallow", setting_button);
+       evas_object_smart_callback_add(setting_button, "clicked", quickpanel_setting_clicked, NULL);
+       evas_object_show(setting_button);
+       free(path);
+
        elm_object_part_content_set(section, "focus", focus_clear);
        evas_object_smart_callback_add(focus_clear, "clicked", quickpanel_noti_on_clear_all_clicked, NULL);
        elm_object_part_content_set(section, "focus.setting", focus_setting);
        evas_object_smart_callback_add(focus_setting, "clicked", quickpanel_noti_on_noti_setting_clicked, NULL);
-
-       elm_grid_pack(parent, section, NOTI_SECTION_X, NOTI_SECTION_Y, NOTI_SECTION_WIDTH, NOTI_SECTION_HEIGHT);
+       elm_grid_pack(parent, section, 32, NOTI_SECTION_Y, 1200, NOTI_SECTION_HEIGHT);
 
        noti_section_data.layout = section;
        noti_section_data.clear_btn = focus_clear;
index f5eb85bbccff658f5946e99d47c1fbea886c1875..0165ab61e10ef53eeff0a123e114c85218ddc683 100755 (executable)
@@ -32,7 +32,7 @@ static const char *_default_preference_get(const char *key)
        if (strcmp(key, PREF_BRIGHTNESS) == 0)
                return "OFF";
        else if (strcmp(key, PREF_QUICKSETTING_ORDER) == 0)
-               return "wifi,bluetooth,sound,dnd,softkey,moresettings,mobile_data,assisitvelight,u_power_saving,wifi_hotspot,flightmode";
+               return "wifi,bluetooth,sound,dnd,softkey,voicecontrol,mobile_data,assisitvelight,u_power_saving,wifi_hotspot,flightmode";
        else if (strcmp(key, PREF_QUICKSETTING_FEATURED_NUM) == 0)
                return "11";
        else if (strcmp(key, PREF_SHORTCUT_ENABLE) == 0)
diff --git a/src/settings/modules/more-settings.c b/src/settings/modules/more-settings.c
deleted file mode 100755 (executable)
index f912ad0..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <Elementary.h>
-
-#include <vconf.h>
-#include <system_settings.h>
-#include <bundle_internal.h>
-#include <tzsh.h>
-#include <tzsh_quickpanel_service.h>
-
-#include "common.h"
-#include "quickpanel-ui.h"
-#include "settings.h"
-#include "setting_utils.h"
-#include "setting_module_api.h"
-#include "settings_icon_common.h"
-
-#define BUTTON_LABEL _("IDS_ST_BUTTON2_MORE_SETTINGS")
-#define BUTTON_ICON_NORMAL "icon_moresettings_off.png"
-#define BUTTON_ICON_HIGHLIGHT "icon_moresettings_on.png"
-#define BUTTON_ICON_DIM "icon_moresettings_disabled.png"
-
-static void _mouse_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
-
-static const char *_label_get(void)
-{
-       return BUTTON_LABEL;
-}
-
-static const char *_icon_get(qp_setting_icon_image_type type)
-{
-       if (type == QP_SETTING_ICON_NORMAL) {
-               return BUTTON_ICON_NORMAL;
-       } else if (type == QP_SETTING_ICON_HIGHLIGHT) {
-               return BUTTON_ICON_HIGHLIGHT;
-       } else if (type == QP_SETTING_ICON_DIM) {
-#ifdef BUTTON_ICON_DIM
-               return BUTTON_ICON_DIM;
-#endif
-       }
-
-       return NULL;
-}
-
-static void _long_press_cb(void *data)
-{
-       QP_Module_Setting *module = (QP_Module_Setting *)data;
-
-       if (quickpanel_setting_module_is_immediate_actionable(module, QP_SETTING_ICON_LONGPRESSED) == false)
-               return;
-
-       quickpanel_setting_icon_handler_longpress(module->setting_pkgname, "viewtype", "main");
-}
-
-static void _view_update(Evas_Object *view, int state, int flag_extra_1, int flag_extra_2)
-{
-       Evas_Object *image = NULL;
-       const char *icon_path = NULL;
-
-       quickpanel_setting_icon_state_set(view, state);
-
-       if (state == ICON_VIEW_STATE_ON) {
-#ifdef BUTTON_ICON_HIGHLIGHT
-               icon_path = BUTTON_ICON_HIGHLIGHT;
-#endif
-       } else if (state == ICON_VIEW_STATE_DIM) {
-#ifdef BUTTON_ICON_DIM
-               icon_path = BUTTON_ICON_DIM;
-#endif
-       } else {
-               icon_path = BUTTON_ICON_NORMAL;
-       }
-
-       if (icon_path == NULL)
-               icon_path = BUTTON_ICON_NORMAL;
-
-       image = quickpanel_setting_icon_image_new(view, icon_path);
-       quickpanel_setting_icon_content_set(view, image);
-       quickpanel_setting_icon_text_set(view, BUTTON_LABEL, state);
-}
-
-static void _status_update(QP_Module_Setting *module, int flag_extra_1, int flag_extra_2)
-{
-       int ret = 0;
-       bool status = false;
-       retif(module == NULL, , "Invalid parameter!");
-
-       ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, &status);
-       msgif(ret !=  SYSTEM_SETTINGS_ERROR_NONE , "failed to notify key SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO : %d", ret);
-
-       if (status == true)
-               quickpanel_setting_module_icon_state_set(module, ICON_VIEW_STATE_ON);
-       else
-               quickpanel_setting_module_icon_state_set(module, ICON_VIEW_STATE_OFF);
-
-
-       quickpanel_setting_module_icon_view_update(module, quickpanel_setting_module_icon_state_get(module), FLAG_VALUE_VOID);
-}
-
-static void _mouse_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
-       QP_Module_Setting *module = (QP_Module_Setting *)data;
-       DBG(" ***** mouse clicked -cb  128 *****");
-       DBG("***** first   %d value *****",quickpanel_setting_module_icon_state_get(module));
-       if(quickpanel_setting_module_icon_state_get(module) == 1) {
-               DBG("***** %d value *****",quickpanel_setting_module_icon_state_get(module));
-               quickpanel_setting_module_icon_state_set(module, 0);
-               quickpanel_setting_module_icon_view_update(module ,0,FLAG_VALUE_VOID);
-       }
-       else {
-               DBG("***** %d value *****",quickpanel_setting_module_icon_state_get(module));
-               quickpanel_setting_module_icon_state_set(module, 1);
-               quickpanel_setting_module_icon_view_update(module ,1,FLAG_VALUE_VOID);
-               quickpanel_common_launch_app("org.tizen.setting" ,NULL);
-       }
-}
-
-static int _register_module_event_handler(void *data)
-{
-       int ret = 0;
-       return QP_OK;
-}
-
-static int _unregister_module_event_handler(void *data)
-{
-       int ret = 0;
-       return QP_OK;
-}
-
-/****************************************************************************
- *
- * Quickpanel Item functions
- *
- ****************************************************************************/
-static int _init(void *data)
-{
-       int ret = QP_OK;
-
-       ret = _register_module_event_handler(data);
-
-       return ret;
-}
-
-static int _fini(void *data)
-{
-       int ret = QP_OK;
-
-       ret = _unregister_module_event_handler(data);
-
-       return ret;
-}
-
-static void _lang_changed(void *data)
-{
-       QP_Module_Setting *module = (QP_Module_Setting *)data;
-       retif(module == NULL, , "Invalid parameter!");
-
-       quickpanel_setting_module_icon_view_update_text(module);
-}
-
-static void _refresh(void *data)
-{
-       QP_Module_Setting *module = (QP_Module_Setting *)data;
-       retif(module == NULL, , "Invalid parameter!");
-
-       quickpanel_setting_module_icon_view_update_text(module);
-}
-
-QP_Module_Setting moresettings = {
-       .name                           = "moresettings",
-       .setting_pkgname        = "org.tizen.setting",
-       .init                           = _init,
-       .fini                           = _fini,
-       .lang_changed           = _lang_changed,
-       .refresh                        = _refresh,
-       .icon_get                       = _icon_get,
-       .label_get                      = _label_get,
-       .view_update        = _view_update,
-       .status_update          = _status_update,
-       .handler_longpress              = _long_press_cb,
-       .handler_press          = _mouse_clicked_cb,
-};
index c1a148983678f76dcfe7ff808e232690dbb3f5a5..5f341f1c250c3942c3fd567496115e7d02682620 100755 (executable)
@@ -103,8 +103,8 @@ static void _status_update(QP_Module_Setting *module, int flag_extra_1, int flag
        quickpanel_setting_module_icon_timer_del(module);\r
        ret = vconf_get_bool(VCONFKEY_SETAPPL_SOFT_KEY, &status);\r
        msgif(ret != 0, "fail to get VCONFKEY_SETAPPL_SOFT_KEY:%d", ret);\r
-       DBG(">>>> status[%d] == %s <<<", status, (status == true ? "TRUE" : "FALSE"));\r
-       if (status == true) {\r
+       DBG(">>>> status[%d] == %s <<<", status, (status == 1 ? "TRUE" : "FALSE"));\r
+       if (status == 1) {\r
                quickpanel_setting_module_icon_state_set(module, ICON_VIEW_STATE_ON);\r
        }\r
        else {\r
@@ -118,15 +118,14 @@ static void _status_update(QP_Module_Setting *module, int flag_extra_1, int flag
 static void _state_change(QP_Module_Setting *module)\r
 {\r
        int ret = 0;\r
-       bool enable = 0;\r
        DBG(">>> Entered state_change");\r
-       Eina_Bool state =  quickpanel_setting_module_icon_state_get(module);\r
-       DBG(">>>> _state_change , state value = %s <<<", state == false ? "FALSE" : "TRUE");\r
+       int state =  quickpanel_setting_module_icon_state_get(module);\r
+       DBG(">>>> _state_change , state value = %s <<<", state == 0 ? "FALSE" : "TRUE");\r
        ret = vconf_set_bool(VCONFKEY_SETAPPL_SOFT_KEY, !state);\r
        msgif(ret != 0, "failed set VCONFKEY_SETAPPL_SOFT_KEY:%d", ret);\r
        ret = vconf_get_bool(VCONFKEY_SETAPPL_SOFT_KEY, &state);\r
        msgif(ret != 0, "fail to get VCONFKEY_SETAPPL_SOFT_KEY:%d", ret);\r
-       DBG("softkey check value = %s", state == false ? "FALSE" : "TRUE");\r
+       DBG("softkey check value = %s", state == 0 ? "FALSE" : "TRUE");\r
        DBG(">>> END");\r
 }\r
 \r
diff --git a/src/settings/modules/voice-control.c b/src/settings/modules/voice-control.c
new file mode 100755 (executable)
index 0000000..db991a3
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <Elementary.h>
+
+#include <vconf.h>
+#include <system_settings.h>
+#include <bundle_internal.h>
+#include <tzsh.h>
+#include <tzsh_quickpanel_service.h>
+#include <voice_control_setting.h>
+#include <voice_control_common.h>
+#include <aul.h>
+#include <app_manager.h>
+#include <app_control.h>
+
+#include "common.h"
+#include "common_uic.h"
+#include "quickpanel-ui.h"
+#include "settings.h"
+#include "setting_utils.h"
+#include "setting_module_api.h"
+#include "settings_icon_common.h"
+
+#define BUTTON_LABEL _("IDS_ST_BUTTON2_VOICE_CONTROL")
+#define BUTTON_ICON_NORMAL "icon_voice_control_off.png"
+#define BUTTON_ICON_HIGHLIGHT "icon_voice_control_on.png"
+#define BUTTON_ICON_DIM "icon_voice_control_disabled.png"
+#define VOICE_CONTROL_PKG "org.tizen.voice-control-panel"
+
+static void _mouse_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+
+static int vcpid = -1;
+
+static const char *_label_get(void)
+{
+       return BUTTON_LABEL;
+}
+
+static int _check_dead_signal(int pid, void *data)
+{
+       DBG("Process %d is terminated", pid);
+       if (pid < 0) {
+               ERR("pid : %d", pid);
+               return 0;
+       }
+       if(pid == vcpid) {
+               DBG("pid = %d and vcpid = %d",pid,vcpid);
+               QP_Module_Setting *module = (QP_Module_Setting *)data;
+               DBG("name of module = %s",module->name);
+               if(module == NULL) {
+                       ERR("module is NULL");
+                       return 0;
+               }
+               DBG(" check_dead_signal, setting the module icon state to 0");
+               quickpanel_setting_module_icon_state_set(module, 0);
+               quickpanel_setting_module_icon_view_update(module ,0,FLAG_VALUE_VOID);
+       }
+       return 0;
+}
+
+static const char *_icon_get(qp_setting_icon_image_type type)
+{
+       if (type == QP_SETTING_ICON_NORMAL) {
+               return BUTTON_ICON_NORMAL;
+       } else if (type == QP_SETTING_ICON_HIGHLIGHT) {
+               return BUTTON_ICON_HIGHLIGHT;
+       } else if (type == QP_SETTING_ICON_DIM) {
+#ifdef BUTTON_ICON_DIM
+               return BUTTON_ICON_DIM;
+#endif
+       }
+
+       return NULL;
+}
+
+static void _long_press_cb(void *data)
+{
+       QP_Module_Setting *module = (QP_Module_Setting *)data;
+
+       if (quickpanel_setting_module_is_immediate_actionable(module, QP_SETTING_ICON_LONGPRESSED) == false)
+               return;
+
+       quickpanel_setting_icon_handler_longpress(module->setting_pkgname, "viewtype", "main");
+}
+
+static void _view_update(Evas_Object *view, int state, int flag_extra_1, int flag_extra_2)
+{
+       Evas_Object *image = NULL;
+       const char *icon_path = NULL;
+
+       quickpanel_setting_icon_state_set(view, state);
+
+       if (state == ICON_VIEW_STATE_ON) {
+#ifdef BUTTON_ICON_HIGHLIGHT
+               icon_path = BUTTON_ICON_HIGHLIGHT;
+#endif
+       } else if (state == ICON_VIEW_STATE_DIM) {
+#ifdef BUTTON_ICON_DIM
+               icon_path = BUTTON_ICON_DIM;
+#endif
+       } else {
+               icon_path = BUTTON_ICON_NORMAL;
+       }
+
+       if (icon_path == NULL)
+               icon_path = BUTTON_ICON_NORMAL;
+
+       image = quickpanel_setting_icon_image_new(view, icon_path);
+       quickpanel_setting_icon_content_set(view, image);
+       quickpanel_setting_icon_text_set(view, BUTTON_LABEL, state);
+}
+
+static void _status_update(QP_Module_Setting *module, int flag_extra_1, int flag_extra_2)
+{
+       DBG(" _status_update quickpanel");
+       retif(module == NULL, , "Invalid parameter!");
+
+       bool status = false;
+       if (VC_ERROR_NONE != vc_setting_get_enabled(&status)) {
+               ERR("Fail to get_enabled");
+               return ;
+       }
+       DBG("_status_update[1], _check_voice_control_enabled [%d]", status);
+       if (status == true) {
+               if (VC_ERROR_NONE != vc_setting_set_enabled(false)) {
+                       ERR("Fail to set_disabled");
+                       return ;
+               }
+       }
+       if (VC_ERROR_NONE != vc_setting_get_enabled(&status)) {
+               ERR("Fail to get_enabled");
+               return ;
+       }
+       DBG(" after vc_setting_get_enabled ");
+       DBG("_status_update[2], _check_voice_control_enabled [%d]", status);
+       if (status == true)
+               quickpanel_setting_module_icon_state_set(module, ICON_VIEW_STATE_ON);
+       else
+               quickpanel_setting_module_icon_state_set(module, ICON_VIEW_STATE_OFF);
+       quickpanel_setting_module_icon_view_update(module, quickpanel_setting_module_icon_state_get(module), FLAG_VALUE_VOID);
+}
+
+static void _mouse_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+       QP_Module_Setting *module = (QP_Module_Setting *)data;
+       DBG(" ***** mouse clicked -cb  128 *****");
+       DBG("***** first   %d value *****",quickpanel_setting_module_icon_state_get(module));
+
+       if(quickpanel_setting_module_icon_state_get(module) == 1) {
+               DBG("***** %d value *****",quickpanel_setting_module_icon_state_get(module));
+
+               if(VC_ERROR_NONE != vc_setting_set_enabled(false)) {
+                       ERR("Fail to set enabled");
+                       return;
+               }
+
+               bool disabled = true;
+               if (VC_ERROR_NONE != vc_setting_get_enabled(&disabled)) {
+                       ERR("Fail to get disabled");
+                       return ;
+               }
+               DBG("_check_voice_control_disabled [%d]", disabled);
+
+               quickpanel_setting_module_icon_state_set(module, 0);
+               quickpanel_setting_module_icon_view_update(module ,0,FLAG_VALUE_VOID);
+       }
+       else {
+               DBG("***** %d value *****",quickpanel_setting_module_icon_state_get(module));
+               if(VC_ERROR_NONE != vc_setting_set_enabled(true)) {
+                       ERR("Fail to set enabled");
+                       return ;
+               }
+
+               bool enabled = false;
+               if (VC_ERROR_NONE != vc_setting_get_enabled(&enabled)) {
+                       ERR("Fail to get enabled");
+                       return;
+               }
+               DBG("_check_voice_control_enabled [%d]", enabled);
+
+               quickpanel_setting_module_icon_state_set(module, 1);
+               quickpanel_setting_module_icon_view_update(module ,1,FLAG_VALUE_VOID);
+
+               int ret = 0;
+               ret = quickpanel_common_send_message_to_app(VOICE_CONTROL_PKG, NULL, NULL, NULL);
+               quickpanel_common_inform_launch_app_result(VOICE_CONTROL_PKG, ret);
+
+               app_context_h app_context_handle = NULL;
+               ret = app_manager_get_app_context(VOICE_CONTROL_PKG, &app_context_handle);
+               if (ret != APP_MANAGER_ERROR_NONE) {
+                       ERR("Failed to get app context");
+                       return ;
+               }
+
+               ret = app_context_get_pid(app_context_handle, &vcpid);
+               if (ret != APP_MANAGER_ERROR_NONE) {
+                       ERR("Failed to get pid");
+                       return ;
+               }
+
+               ret = aul_listen_app_dead_signal(_check_dead_signal, module);
+               if (ret < 0) {
+                       ERR("aul_listen_app_dead_signal failed");
+                       return ;
+               }
+               DBG(" pid of voice_control is = %d ",vcpid);
+               quickpanel_uic_close_quickpanel(true, 1);
+       }
+}
+
+static int _register_module_event_handler(void *data)
+{
+       int ret = 0;
+       return QP_OK;
+}
+
+static int _unregister_module_event_handler(void *data)
+{
+       int ret = 0;
+       return QP_OK;
+}
+
+/****************************************************************************
+ *
+ * Quickpanel Item functions
+ *
+ ****************************************************************************/
+static int _init(void *data)
+{
+       if (VC_ERROR_NONE != vc_setting_initialize()) {
+               ERR("Fail to init ");
+               return QP_FAIL;
+       }
+       int ret = QP_OK;
+
+       ret = _register_module_event_handler(data);
+
+       return ret;
+}
+
+static int _fini(void *data)
+{
+       int ret = QP_OK;
+
+       ret = _unregister_module_event_handler(data);
+
+       return ret;
+}
+
+static void _lang_changed(void *data)
+{
+       QP_Module_Setting *module = (QP_Module_Setting *)data;
+       retif(module == NULL, , "Invalid parameter!");
+
+       quickpanel_setting_module_icon_view_update_text(module);
+}
+
+static void _refresh(void *data)
+{
+       QP_Module_Setting *module = (QP_Module_Setting *)data;
+       retif(module == NULL, , "Invalid parameter!");
+
+       quickpanel_setting_module_icon_view_update_text(module);
+}
+
+QP_Module_Setting voicecontrol = {
+       .name                           = "voicecontrol",
+       .setting_pkgname        = "org.tizen.voice-control-panel",
+       .init                           = _init,
+       .fini                           = _fini,
+       .lang_changed           = _lang_changed,
+       .refresh                        = _refresh,
+       .icon_get                       = _icon_get,
+       .label_get                      = _label_get,
+       .view_update        = _view_update,
+       .status_update          = _status_update,
+       .handler_longpress              = _long_press_cb,
+       .handler_press          = _mouse_clicked_cb,
+};
index dcc1902ffe4f66d5c0b4ddf68613e02e8929e7d2..ff748e823fdec6994f4ee926148904d7a577dd02 100755 (executable)
@@ -52,7 +52,7 @@ extern QP_Module_Setting wifi;
 extern QP_Module_Setting dnd;
 extern QP_Module_Setting bluetooth;
 extern QP_Module_Setting sound;
-extern QP_Module_Setting moresettings;
+extern QP_Module_Setting voicecontrol;
 extern QP_Module_Setting softkey;
 
 QP_Module settings = {
@@ -74,7 +74,7 @@ static struct _info {
                &wifi,
                &dnd,
                &sound,
-               &moresettings,
+               &voicecontrol,
                &bluetooth,
                &softkey,
                NULL,